Parse::RPM::Spec - Perl extension to parse RPM spec files.
use Parse::RPM::Spec; my $spec = Parse::RPM::Spec->new( { file => 'some_package.spec' } ); print $spec->name; # some_package print $spec->version; # 0.01 (for example)
RPM is the package management system used on Linux distributions based on Red Hat Linux. These days that includes Fedora, Red Hat Enterprise Linux, Centos, SUSE, Mandriva and many more.
RPMs are build from the source of a packages along with a spec file. The spec file controls how the RPM is built.
This module creates Perl objects which model spec files. Currently it gives you simple access to various pieces of information from the spec file.
This is still in development. I particular it doesn't currently parse all of a spec file. It just does the bits that I currently use. I will be adding support for the rest of the file very soon.
Creates a new Parse::RPM::Spec object. Takes one mandatory parameter which is the path to the spec file that you are interested in. Throws an exception if it doesn't find a valid spec.
Parses the given spec file. This is called as part of the initialisation carried out by the new method, so there is generally no need to call it yourself.
new
Attribute accessors for the spec file object. Each one returns a piece of information from the spec file header. The source, buildrequires and requires methods are slightly different. Because these keys can have multiple values, they return a reference to an array of values.
source
buildrequires
requires
Moose-provided class method for introspection. Generally not needed by users.
None.
Plenty still to do here. Firstly, and most importantly, parsing the rest of the spec file.
Red Hat RPM Guide - http://docs.fedoraproject.org/drafts/rpm-guide-en/index.html
Maximum RPM - http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
Dave Cross, <dave@mag-sol.com<gt>
Copyright (C) 2008 by Magnum Solutions Ltd.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.
To install Parse::RPM::Spec, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::RPM::Spec
CPAN shell
perl -MCPAN -e shell install Parse::RPM::Spec
For more information on module installation, please visit the detailed CPAN module installation guide.