NAME

RPM::Toolbox::Spec - parse RPM specs with macro expansion

SYNOPSIS

  use RPM::Toolbox::Spec;
  
  $spec = RPM::Toolbox::Spec->parse_file ($filename, %options);
  $spec = RPM::Toolbox::Spec->parse_string ($spec_text, %options);
  
  @packages = $spec->packages;
  @sources = $spec->sources;
  @patches = $spec->patches;
  @icons = $spec->icons;

  $buildroot = $spec->buildroot;
  @buildarchs = $spec->buildarchs;
  @buildrequires = $spec->buildrequires;
  @buildconflicts = $spec->buildconflicts;

  $srcrpm = $spec->srcrpm; # "foo-1.0.src.rpm"
  @rpms = $spec->rpms;     # ("foo-1.0.i386.rpm", ...)

  $name = $spec->name;
  $epoch = $spec->epoch ($subpackage); # subpackage is optional
  $version = $spec->version ($subpackage);
  $release = $spec->release ($subpackage);
  ...
  # supported tags are documented below

DESCRIPTION

RPM is a package management system for UNIX-like operating systems; spec files are used by RPM to define and maintain meta information and build commands for a set of related packages.

This module extracts various bits of information from RPM spec files. It aims at arriving at the same conclusions as rpm and rpmbuild commands would on your system by expanding macros, evaluating conditionals, etc. It does so by executing rpm/rpmbuild commands and analyzing their output.

This process is quite slow -- in the order of seconds for complex spec files; caching may be used to store/load the results of processing, providing significant performance improvements when processing the same file multiple times.

This module requires rpm/rpmbuild >= 4.3.3 with lua support compiled-in.

CONSTRUCTORS

METHODS

CAVEATS

This class doesn't really parse anything, it extracts information by calling rpm and rpmbuild in various ways and analyzing their output. It takes several passes to obtain all of the fields, so the spec is evaluated more than once. This is quite slow; the "cache" option improves that somewhat.

This class redefines '%_sourcedir' to point to a temporary location, so don't rely on this macro in any place that may affect macro expansion, e.g.:

 ...
 # this will fail since %_sourcedir will be redefined while parsing
 Version: %(cat %_sourcedir/version)
 ...
 %build
 # OK, since this class doesn't execute any scriptlets
 cp %_sourcdir/version .
 ...

This doesn't affect "expand" expressions though.

SEE ALSO

rpm(8), rpmbuild(8)

AUTHOR

Davlet Panech - dpanech at users dot sourceforge dot net

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Davlet Panech

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.