PkgForge::Source::SRPM - A source RPM class for the LCFG Package Forge


This documentation refers to PkgForge::Source::SRPM version 1.4.8


     use PkgForge::Source::SRPM;

     my $pkg = PkgForge::Source::SRPM->new( file => "foo-1-2.src.rpm" );

     my $ok = eval { $pkg->validate() };

     if ( !$ok || $@ ) {
       warn "$pkg failed to validate: $@\n";


This module provides a representation of a source RPM package which is used by the LCFG Package Forge software suite.


These attributes all come from the interface which this module implements, there are no overrides.


This is the directory in which the source package can be found. If none is given then it defaults to the current directory. The directory must exist.


This is the file name of the source package, this attribute is required when creating new objects. The file must exist.


This is the SHA1 checksum of the source package. It will be calculated the first time the attribute is queried.


This is a string representing the type of the source package. It is the final part of the name of the module which implements this role. For example, for "PkgForge::Source::SRPM" the type is "SRPM".


Class Methods


This class method takes the path to a source file. It returns true or false based on whether or not the module can handle that type of source file. It uses the validate method to do the working of checking the source package. Note that under normal circumstances (i.e. when checking the source package validity) this method must not die.

Instance Methods


This method generates the SHA1 digest for the package and returns it in hexadecimal form. The length of the returned string will be 40 and it will only contain characters from this set: '0'..'9' and 'a'..'f'.


This will compare the current value of the SHA1 checksum, as stored in the sha1sum attribute, against the value found by running gen_sha1sum on the package. It returns a boolean value reflecting whether they match.


This does the following validity checks:

The file must exist.
The file must have the '.src.rpm' suffix.
It must be a proper source RPM.
It must contain a specfile with the '.spec' suffix.

If all tests pass then a true value is returned, otherwise the method will die with an appropriate message for the failed test. You will need the RPM2 module for this method to work. It will take either a file name as an argument or use the fullpath method.


This module is powered by Moose. It is based on PkgForge::Source. It requires RPM2 to validate an SRPM.


PkgForge, PkgForge::Source


This is the list of platforms on which we have tested this software. We expect this software to work on any Unix-like platform which is supported by Perl.

ScientificLinux5, Fedora13


Please report any bugs or problems (or praise!) to, feedback and patches are also always very welcome.


    Stephen Quinney <>


    Copyright (C) 2010 University of Edinburgh. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GPL, version 2 or later.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 112:

'=item' outside of any '=over'