Dave Cross

NAME

Parse::RPM::Spec - Perl extension to parse RPM spec files.

SYNOPSIS

  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)

DESCRIPTION

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 module spec files. Currently it gives you simple access to various pieces of information from the spec file.

CAVEAT

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.

METHODS

$spec = Parse::RPM::Spec->new('some_package.spec')

Creates a new Parse::EPM::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.

$spec->parse_file('some_package.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.

$spec->name, $spec->version, $spec->release, $spec->summary, $spec->license, $spec->group, $spec->url, $spec->source, $spec->buildroot, $spec->buildarch, $spec->buildrequires, $spec->requires

Attribute accessors for the spec file object. Each one returns a piece of information from the spec file header. The buildrequires and requires methods are slightly different. Because these keys can have multiple values, they return a reference to an array of values.

EXPORT

None.

TO DO

Plenty still to do here. Firstly, and most importantly, parsing the rest of the spec file.

SEE ALSO

AUTHOR

Dave Cross, <dave@mag-sol.com<gt>

COPYRIGHT AND LICENSE

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.