Stephen Quinney > PkgForge-Server > PkgForge::BuildCommand::Builder::RPM

Download:
PkgForge-Server-1.1.10.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.1.10   Source  

NAME ^

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

VERSION ^

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

SYNOPSIS ^

     use PkgForge::Job;
     use PkgForge::BuildCommand::Builder::RPM;
     use PkgForge::BuildInfo;

     my $builder = PkgForge::BuildCommand::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);

       my $buildinfo = PkgForge::BuildInfo->new( jobid => $job->id );

       $builder->run( $job, $buildinfo );

     }

DESCRIPTION ^

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

ATTRIBUTES ^

This inherits most attributes from the PkgForge::BuildCommand::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::BuildCommand::Builder role. The class has the following extra methods:

build( $job, $buildinfo )

This is the main method which drives the building of RPMs. It takes a PkgForge::Job object and a PkgForge::BuildInfo object. Currently, only the mock build method is supported so the Job and the BuildInfo objects are 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.

mock_run( $job, $buildinfo )

This is the main mock build method. It takes a PkgForge::Job object and a PkgForge::BuildInfo object. It will attempt to build each source package in turn. If createrepo is being used then generated packages can be used as build-dependencies for later packages in the job as soon as they are successfully built. If any packages fail to build the job will be considered a failure and this method will log the errors and return 1.

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($bucket)

This takes the name of the target package bucket and 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_find_logs($chroot)

This finds all the log files (i.e. *.log) in the mock results directory for the chroot and returns the list.

mock_find_results($chroot)

This finds all the packages (i.e. *.rpm) in the mock results directory for the chroot and returns the list.

fix_sources($buildinfo)

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 BuildInfo object 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::Job, PkgForge::BuildCommand::Builder, PkgForge::BuildInfo

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.

syntax highlighting: