1Archive::RPM(3)       User Contributed Perl Documentation      Archive::RPM(3)
2
3
4

NAME

6       Archive::RPM - Work with a RPM
7

SYNOPSIS

9               use Archive::RPM;
10           my $rpm = Archive::RPM->new('foo-1.2-1.noarch.rpm');
11
12           # RPM2 header functions...
13
14           # other functions...
15

DESCRIPTION

17       Archive::RPM provides a more complete method of accessing an RPM's
18       meta- and actual data.  We access this information by leveraging RPM2
19       where we can, and by "exploding" the rpm (with rpm2cpio and cpio) when
20       we need information we can't get through RPM2.
21

TRAITS

23       This package allows for the application of various "TraitFor" style
24       traits through the with_traits() function, e.g.:
25
26           Archive::RPM->with_traits('Foo')->new(...);
27
28       By default, we look for traits in the "Archive::RPM::TraitsFor"
29       namespace, though this can be overridden by prepending a "+" to the
30       full package name of the trait.
31

METHODS

33       An object of this class represents an actual RPM, somewhere on the
34       filesystem.  We provide all the methods RPM2::Header does, as well as
35       additional functions to manipulate/extract the rpm itself (but not to
36       install).
37
38       Right now, our documentation is horrible.  Please see RPM2 for the
39       methods provided by "RPM2::Header", and the source for the other
40       functions we have defined.  We support all methods provided by
41       RPM2::Header, except the "files" method (that's handled by other bits).
42
43       new('file.rpm') | new(rpm => 'file.rpm', ...)
44           Creates a new Archive::RPM object.  Note that the rpm parameter is
45           required, and if it is the only one being passed the "rpm =>" may
46           be omitted.
47
48           rpm => 'filename'|Path::Class::File
49               Required.  Takes either a filename or a Path::Class::File
50               object pointing to the rpm.
51
52           auto_cleanup => 0|1
53               Default is 1; if the rpm is extracted to the filesystem, purge
54               this automatically.
55
56       rpm Returns a Path::Class::File object representing the rpm we're
57           working with.
58
59       extracted_to
60           Returns a Path::Class::Dir object representing where the rpm has
61           been exploded to.  If the rpm has not been exploded, it will be.
62
63       has_been_extracted
64           Returns true if the rpm has been exploded; false if not.
65
66       is_source_package | is_srpm | is_source
67           Returns true if this is a source rpm; false if not.
68
69       has_files
70           True if this rpm contains any files. (Some, e.g. Fedora's "perl-
71           core" package, are "meta-packages" and do not deliver files; they
72           simply ensure a given set of dependencies exist on a system.  Sort
73           of like Task::* CPAN dists.)
74
75       num_files
76           Returns the number of files delivered.
77
78       grep_files
79           Grep over the array of files; e.g.
80
81               my ($spec) = $srpm->grep_files(sub { /\.spec$/ });
82
83       map_files
84       files
85           Returns an array of all the dir/files delievered by the rpm.  Note
86           that these are returned as Path::Class objects, and we use the
87           directories and files present on the filesystem after exploding the
88           rpm rather than the list described by the rpm itself.
89
90       first_file
91       last_file
92       join_files
93       num_changelog_entries
94           Returns the total number of changelog entries.
95
96       changelog_entries
97           Returns an array of all the changelog entries.
98
99       first_changelog_entry
100           Returns the first changelog entry; note that changelogs are stored
101           in reverse chronological order.  That is, the first changelog entry
102           is the newest entry.
103
104       last_changelog_entry
105           Returns the oldest changelog entry.
106
107       get_changelog_entry(Int)
108           Get a specific changelog entry.
109
110       map_changelog_entries
111       find_changelog_entry
112       grep_changelog_entries
113

DIAGNOSTICS

115       We tend to complain and die loudly on any errors.
116

SEE ALSO

118       RPM2
119

LIMITATIONS

121       Our documentation and test suite is clearly lacking, sadly.
122
123       We also have to explode the rpm for anything more intense than simply
124       looking at the header for info.  While this isn't really a _horrible_
125       thing, it's annoying to have to, say, explode a 100MB ooffice rpm just
126       to get a count of how many files there are in it.
127
128       We do the "exploding" using external rpm2cpio and cpio binaries.  While
129       we could have used Archive::Cpio to handle the cpio extraction, it
130       seemed a touch overkill; as there does not appear to be a Perl library
131       to handle the "rpm2cpio" part, we may as well use the cpio bin.  (It's
132       not like it's missing from many systems, anyways.
133

BUGS

135       All complex software has bugs lurking in it, and this module is no
136       exception.  If you find a bug please either email me, or (preferred) to
137       this package's RT tracker at "bug-Archive-RPM@rt.cpan.org".
138
139       Patches are welcome.
140

AUTHOR

142       Chris Weyl  <cweyl@alumni.drew.edu>
143
145       Copyright (c) 2009, 2010 Chris Weyl <cweyl@alumni.drew.edu>
146
147       This library is free software; you can redistribute it and/or modify it
148       under the terms of the GNU Lesser General Public License as published
149       by the Free Software Foundation; either version 2.1 of the License, or
150       (at your option) any later version.
151
152       This library is distributed in the hope that it will be useful, but
153       WITHOUT ANY WARRANTY; without even the implied warranty of
154       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
155       Lesser General Public License for more details.
156
157       You should have received a copy of the GNU Lesser General Public
158       License along with this library; if not, write to the
159
160           Free Software Foundation, Inc.
161           59 Temple Place, Suite 330
162           Boston, MA  02111-1307  USA
163
164
165
166perl v5.38.0                      2023-07-20                   Archive::RPM(3)
Impressum