summaryrefslogtreecommitdiff
path: root/Perl-RPM
diff options
context:
space:
mode:
authorrjray <devnull@localhost>2000-08-01 07:59:47 +0000
committerrjray <devnull@localhost>2000-08-01 07:59:47 +0000
commitb41b30411afffc3c928687f4da1b5e4ac9d11fb0 (patch)
treeabeb18fb208b1de00cee1f1e488622e890c55b15 /Perl-RPM
parent11fa17601b6caec51119c7b744e840c9bd24521c (diff)
downloadrpm-b41b30411afffc3c928687f4da1b5e4ac9d11fb0.tar.gz
rpm-b41b30411afffc3c928687f4da1b5e4ac9d11fb0.tar.bz2
rpm-b41b30411afffc3c928687f4da1b5e4ac9d11fb0.zip
Added the filenames() method and documented it. This method re-assembles
the file fully-qualified names from the three header tags. CVS patchset: 3995 CVS date: 2000/08/01 07:59:47
Diffstat (limited to 'Perl-RPM')
-rw-r--r--Perl-RPM/RPM/Header.pm54
1 files changed, 52 insertions, 2 deletions
diff --git a/Perl-RPM/RPM/Header.pm b/Perl-RPM/RPM/Header.pm
index 461e75632..331227101 100644
--- a/Perl-RPM/RPM/Header.pm
+++ b/Perl-RPM/RPM/Header.pm
@@ -5,7 +5,7 @@
#
###############################################################################
#
-# $Id: Header.pm,v 1.6 2000/06/22 08:42:00 rjray Exp $
+# $Id: Header.pm,v 1.7 2000/08/01 07:59:47 rjray Exp $
#
# Description: The RPM::Header class provides access to the RPM Header
# structure as a tied hash, allowing direct access to the
@@ -35,7 +35,7 @@ use RPM::Error;
use RPM::Constants ':rpmerr';
$VERSION = $RPM::VERSION;
-$revision = do { my @r=(q$Revision: 1.6 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r };
+$revision = do { my @r=(q$Revision: 1.7 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r };
1;
@@ -48,6 +48,47 @@ sub new
return (tied %hash);
}
+###############################################################################
+#
+# Sub Name: filenames
+#
+# Description: Glue together the contents of BASENAMES, DIRNAMES and
+# DIRINDEXES to create a single list of fully-qualified
+# filenames
+#
+# Arguments: NAME IN/OUT TYPE DESCRIPTION
+# $self in ref Object of this class
+#
+# Globals: None.
+#
+# Environment: None.
+#
+# Returns: Success: listref
+# Failure: undef
+#
+###############################################################################
+sub filenames
+{
+ my $self = shift;
+
+ # Each of these three fetches will have already triggered rpm_error, were
+ # there any problems.
+ my $base = $self->{BASENAMES} || return undef;
+ my $dirs = $self->{DIRNAMES} || return undef;
+ my $idxs = $self->{DIRINDEXES} || return undef;
+
+ unless (@$base == @$idxs)
+ {
+ rpm_error(RPMERR_INTERNAL,
+ "Mis-matched elements lists for BASENAMES and DIRINDEXES");
+ return undef;
+ }
+
+ # The value from DIRNAMES already has the trailing separator
+ [ map { "$dirs->[$idxs->[$_]]$base->[$_]" } (0 .. $#$base) ];
+}
+
+
__END__
=head1 NAME
@@ -115,6 +156,15 @@ hash reference, it can be used to call these methods via:
=over
+=item filenames
+
+The B<RPM> system attempts to save space by splitting up the file paths into
+the leafs (stored by the tag C<BASENAMES>), the directories (stored under
+C<DIRNAMES>) and indexes into the list of directories (stored under
+C<DIRINDEXES>). As a convenience, this method re-assembles the list of
+filenames and returns it as a list reference. If an error occurs, C<undef>
+will be returned after C<rpm_error> has been called.
+
=item is_source
Returns true (1) or false (0), depending on whether the package the header