PkgForge::BuildCommand::Builder::RPM - A PkgForge class for building RPMs
This documentation refers to PkgForge::BuildCommand::Builder::RPM version 1.1.10
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 ); }
This is a Package Forge builder class for building RPMs from source using mock.
This inherits most attributes from the PkgForge::BuildCommand::Builder role. This class has the following extra attributes:
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.
This is a string which contains the rpmlib version number. This is discovered using the rpm_api_version method in the RPM2 Perl module.
rpm_api_version
This inherits some methods from the PkgForge::BuildCommand::Builder role. The class has the following extra methods:
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.
mock_run
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
pkgsubmit
build
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.
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_config_query
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.
platform-bucket-arch
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.
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.
createrepo_on_rpms
createrepo_command
This method will initialise the specified mock chroot. Currently this consists of calling mock_clear_resultsdir and mock_createrepo.
mock_clear_resultsdir
mock_createrepo
This finds all the log files (i.e. *.log) in the mock results directory for the chroot and returns the list.
*.log
This finds all the packages (i.e. *.rpm) in the mock results directory for the chroot and returns the list.
*.rpm
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.
rpm
--nomd5
rpmbuild
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.
/etc/mock/f13-lcfg-i386.cfg
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
platform-arch.conf
/etc/pkgsubmit/f13-i386.conf
This module is powered by Moose and uses MooseX::Types. It also requires " File::Find::Rule", IPC::Run, RPM2 and Readonly.
PkgForge, PkgForge::Job, PkgForge::BuildCommand::Builder, PkgForge::BuildInfo
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 bugs@lcfg.org, feedback and patches are also always very welcome.
Stephen Quinney <squinney@inf.ed.ac.uk>
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:
L<> starts or ends with whitespace
To install PkgForge::Queue, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PkgForge::Queue
CPAN shell
perl -MCPAN -e shell install PkgForge::Queue
For more information on module installation, please visit the detailed CPAN module installation guide.