Archive::RPM(3)
β¨ NAME β¨
okay so bestie, welcome to Archive::RPM π β it's the module for working with a RPM. this page is Archive::RPM(3) from the User Contributed Perl Documentation, and we're gonna get through it together, no cap π«Ά
πΈ SYNOPSIS πΈ
use Archive::RPM;
my $rpm = Archive::RPM->new('foo-1.2-1.noarch.rpm');
# RPM2 header functions...
# other functions...
like. look at it. it's giving effortless π
π DESCRIPTION π
Archive::RPM gives you a more complete way to get at an RPM's meta data and its actual data. how do we do it? we leverage RPM2 wherever we possibly can, and when we hit info that RPM2 just cannot give us, we straight-up "explode" the rpm β with rpm2cpio and cpio. dramatic? yes. necessary? also yes π
π¦ TRAITS π¦
this package lets you apply all kinds of "TraitFor"-style traits through the with_traits() function, like so:
Archive::RPM->with_traits('Foo')->new(...);
by default we go looking for traits in the Archive::RPM::TraitsFor namespace, but you can override that by prepending a "+" to the full package name of the trait. little hack, big power β
π METHODS π
an object of this class represents an actual RPM, somewhere on the filesystem. we provide all the methods RPM2::Header does, plus extra functions to manipulate/extract the rpm itself β but not to install it. we are not doing that, bestie, that's not our job π
right now, our documentation is horrible. like, genuinely. please seeRPM2for the methods provided by"RPM2::Header", and go read the source for the other functions we've defined. we support all methods provided byRPM2::Header, except the"files"method (that one's handled by other bits).
new('file.rpm')|new(rpm => 'file.rpm', ...)β creates a newArchive::RPMobject. heads up: therpmparameter is required, and if it's the only thing you're passing, you can drop the"rpm =>"part entirely.rpm => 'filename'|Path::Class::Fileβ Required. takes either a filename or aPath::Class::Fileobject pointing at the rpm.auto_cleanup => 0|1β default is1; if the rpm gets extracted to the filesystem, purge it automatically. self-cleaning, iconic π§
rpmβ returns aPath::Class::Fileobject representing the rpm we're working with.extracted_toβ returns aPath::Class::Dirobject representing where the rpm has been exploded to. if the rpm hasn't been exploded yetβ¦ it will be. it's already happening, bestie π«Άhas_been_extractedβ returns true if the rpm has been exploded; false if not.is_source_package|is_srpm|is_sourceβ returns true if this is a source rpm; false if not.has_filesβ true if this rpm contains any files at all. (some of them, like Fedora's"perl-core"package, are"meta-packages"and deliver no files β they just make sure a given set of dependencies exist on a system. sort of likeTask::*CPAN dists, if you know, you know π )num_filesβ returns the number of files delivered.grep_filesβ greps over the array of files. e.g.
my ($spec) = $srpm->grep_files(sub { /\.spec$/ });
map_filesfilesβ returns an array of all the dir/files delivered by the rpm. note that these come back asPath::Classobjects, and we use the directories and files actually present on the filesystem after exploding the rpm, rather than the list the rpm describes about itself. yes, that's on purpose πfirst_filelast_filejoin_filesnum_changelog_entriesβ returns the total number of changelog entries.changelog_entriesβ returns an array of all the changelog entries.first_changelog_entryβ returns the first changelog entry. note that changelogs are stored in reverse chronological order β so the first changelog entry is the newest entry. yes bestie, the "first" one is the baby of the family πΈlast_changelog_entryβ returns the oldest changelog entry.get_changelog_entry(Int)β get a specific changelog entry.map_changelog_entriesfind_changelog_entrygrep_changelog_entries
π DIAGNOSTICS π
we tend to complain and die loudly on any errors. no quiet suffering in this house. we scream. periodt.
π SEE ALSO π
RPM2
π LIMITATIONS π
our documentation and test suite is clearly lacking, sadly. we know. we're working on it (we are not working on it).
we also have to explode the rpm for anything more intense than simply looking at the header for info. and while that isn't really a horrible thing, it's annoying to have to, say, explode a 100MB ooffice rpm just to get a count of how many files are in it π
we do the "exploding" using external rpm2cpio and cpio binaries. we could have used Archive::Cpio to handle the cpio extraction, but honestly? seemed a touch overkill. and since there doesn't appear to be a Perl library to handle the "rpm2cpio" part, we may as well use the cpio bin. (it's not like it's missing from many systems, anyways.
π BUGS π
all complex software has bugs lurking in it, and this module is no exception. if you find a bug, please either email me, or (preferred) hit this package's RT tracker at bug-Archive-RPM@rt.cpan.org.
patches are welcome. π«Ά
π AUTHOR π
Chris Weyl <cweyl@alumni.drew.edu>
π LICENSE AND COPYRIGHT π
Copyright (c) 2009, 2010 Chris Weyl <cweyl@alumni.drew.edu>
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the
Free Software Foundation, Inc.
59 Temple Place, Suite 330
Boston, MA 02111-1307 USA
and that's the whole page, bestie β¨ this was perl v5.42.0, dated 2025-07-25, and it's giving Archive::RPM(3) β go forth and explode some rpms responsibly πππ¦
π¦ where this page comes from
- fedora 43: perl-Archive-RPM 0.07-39.fc43 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms