NAME

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

VERSION

This documentation refers to PkgForge::Source version 1.4.8

SYNOPSIS

This is a Moose role and cannot be instantiated directly. Use it
as shown below, note that you are required to implement an
instance method named C<validate>.

package PkgForge::Source::SRPM;

use Moose;

with 'PkgForge::Source';

sub validate { }

DESCRIPTION

This module provides a representation of a source package which is used by the LCFG Package Forge software suite. It is not intended to be comprehensive but rather to just fulfill the simple requirements for representing build jobs.

A source package can be anything, it could be a source tar file or an SRPM for example.

ATTRIBUTES

basedir

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.

file

This is the file name of the source package, this attribute is required when creating new objects. It is not required for the file to exist but you will need it if you want to find the sha1sum or carry out validation tests.

sha1sum

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

size

This is the size of the source package, measured in bytes. If the file does not exist then this will be zero.

type

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".

SUBROUTINES/METHODS

Class Methods

There is one class method.

can_handle($file)

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

There are several instance methods.

gen_sha1sum

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'.

check_sha1sum

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.

fullpath

This returns the full path to the source package (i.e. the combination of the basedir and file attributes).

validate($file)

This will carry out type-specific validation (e.g. for SRPM we would ensure that it really is a proper SRPM not just something with a .src.rpm suffix). This method must be provided by all classes implementing this role. It will take either a file name as an argument or use the fullpath method.

DEPENDENCIES

This module is powered by Moose and also uses MooseX::Types and Digest::SHA1.

SEE ALSO

PkgForge, PkgForge::Job, PkgForge::Types, PkgForge::Source::SRPM

PLATFORMS

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

BUGS AND LIMITATIONS

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

AUTHOR

Stephen Quinney <squinney@inf.ed.ac.uk>

LICENSE AND COPYRIGHT

Copyright (C) 2010-2011 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 239:

You forgot a '=back' before '=head2'