The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PkgForge::Builder::RPM - A PkgForge class for building RPMs

VERSION

This documentation refers to PkgForge::Builder::RPM version 1.1.10

SYNOPSIS

     use PkgForge::Job;
     use PkgForge::Builder::RPM;

     my $builder = PkgForge::Builder::RPM->new( platform     => 'f13',
                                                architecture => 'x86_64' );

     my $verified = eval { $self->builder->verify_environment };
     if ( $verified && !$@ ) {

       my $job = PkgForge::Job->new_from_dir($job_dir);

       $builder->build( $job, $results_dir );

     }

DESCRIPTION

This is a Package Forge builder class for building RPMs from source using mock.

ATTRIBUTES

This inherits most attributes from the PkgForge::Builder role. This class has the following extra attributes:

use_mock

This is a boolean value which controls whether mock should be used to build packages. Currently this is the only supported build tool so the default is true.

rpm_api_version

This is a string which contains the rpmlib version number. This is discovered using the rpm_api_version method in the RPM2 Perl module.

SUBROUTINES/METHODS

This inherits some methods from the PkgForge::Builder role. The class has the following extra methods:

run($topic)

This is the main method which drives the building of RPMs. It takes a PkgForge::BuildTopic object. Currently, only the mock build method is supported so the build topic is passed into the mock_run method.

verify_environment()

This method ensures that the mock and pkgsubmit tools are available. If anything is missing this method will die. This is not called automatically, if you need to run this check you need to do that yourself before calling build.

submit_packages($topic)

This method takes a PkgForge::BuildTopic object. It uses the pkgsubmit tool to submit the built packages. There must be a configuration file named like platform-arch.conf (e.g. /etc/pkgsubmit/f13-i386.conf for each supported build environment. The packages will be submitted into the bucket specified in the job. If anything fails this method will die.

mock_run($topic)

This is the main mock build method. It takes a PkgForge::BuildTopic object. It will attempt to build each source package in turn. If createrepo is being used then packages can be used as build-dependencies for later packages in the job as soon as they are successfully built. After all the package builds have been attempted the log files will be stored (using mock_store_logs). If the job was successful, then the built packages will also be stored (using mock_store_results). If any packages fail to build the job will be considered a failure and this method will die.

mock_query( $chroot, $key )

This will query the specified configuration option for the specified mock chroot and return the value. It does this using a rather hacky python script, named mock_config_query, which relies on loading the mock python code in a slightly odd way (BE WARNED, this might explode at any moment). This method will die if it cannot find a value for the specified key.

mock_chroot_name($topic)

This returns the name of the mock chroot based on the builder platform, architecture and the bucket being used for the job. The chroot name will be formed like platform-bucket-arch, e.g. f13-lcfg-i386.

mock_clear_resultsdir($chroot)

This will remove all files and directories in the results directory for the specified chroot. Normally this is called before actually running mock so that it starts with a clean environment. This makes it easy to collect the build products and log files. This method will die if it cannot remove all files and directories.

mock_createrepo($chroot)

If the createrepo_on_rpms mock configuration option is set for the specified chroot then this method will run the command which is specified in the mock createrepo_command configuration option. This method will die if anything fails whilst running createrepo.

mock_init($chroot)

This method will initialise the specified mock chroot. Currently this consists of calling mock_clear_resultsdir and mock_createrepo.

mock_store_logs( $chroot, $topic )

This finds all the log files (i.e. *.log) in the mock results directory for the chroot and copies them into the results directory for the job.

mock_store_results( $chroot, $topic )

This finds all the packages (i.e. *.rpm) in the mock results directory for the chroot and copies them into the results directory for the job.

rebuild_sources($topic)

This is a big ugly horrid hack to work around the fact that SRPMs created on newer platforms with a recent version of rpmlib (4.6 and newer) cannot be used on older platforms. This is, for example, particularly a problem when needing to build from the same source packages on SL5 and F13.

The SRPM is installed and unpacked, using rpm, into a temporary directory using the --nomd5 option. The SRPM is then regenerated using rpmbuild and copied back into the results directory for the job. A new PkgForge::Source::SRPM object is created for each package and the sources list for the topic is updated.

CONFIGURATION AND ENVIRONMENT

This module does not directly use any configuration files.

You will need to ensure you have mock installed and the chroots correctly configured. The mock chroots are expected to be named like platform-bucket-arch (e.g. there might be a /etc/mock/f13-lcfg-i386.cfg file). If you use LCFG to manage your configuration you can use the mock component to do this for you.

You will also need the pkgsubmit tool for submitting the built packages. There should be a pkgsubmit configuration for each supported platform/architecture combination, they must be named like platform-arch.conf, e.g. /etc/pkgsubmit/f13-i386.conf

DEPENDENCIES

This module is powered by Moose and uses MooseX::Types. It also requires " File::Find::Rule", IPC::Run, RPM2 and Readonly.

SEE ALSO

PkgForge, PkgForge::Builder, PkgForge::BuildTopic

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 633:

L<> starts or ends with whitespace