Archive::RPM(3)

πŸ“¦
version 0.07 Β· 2 versions
, in fedora 43

✨ 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 see RPM2 for the methods provided by "RPM2::Header", and go read the source for the other functions we've defined. we support all methods provided by RPM2::Header, except the "files" method (that one's handled by other bits).
  • new('file.rpm') | new(rpm => 'file.rpm', ...) β€” creates a new Archive::RPM object. heads up: the rpm parameter 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 a Path::Class::File object pointing at the rpm.
    • auto_cleanup => 0 | 1 β€” default is 1; if the rpm gets extracted to the filesystem, purge it automatically. self-cleaning, iconic 🧚
  • rpm β€” returns a Path::Class::File object representing the rpm we're working with.
  • extracted_to β€” returns a Path::Class::Dir object 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 like Task::* 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_files
  • files β€” returns an array of all the dir/files delivered by the rpm. note that these come back as Path::Class objects, 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_file
  • last_file
  • join_files
  • num_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_entries
  • find_changelog_entry
  • grep_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>


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