Opera Software AS
and 1 contributors

NAME

Arepa::BuilderFarm - Arepa builder farm access class

SYNOPSIS

 my $repo = Arepa::BuilderFarm->new('path/to/config.yml');
 my $repo = Arepa::BuilderFarm->new('path/to/config.yml',
                                    builder_config_dir =>
                                                    'path/to/builderconf');
 $repo->last_build_log;
 $repo->package_db;

 my %config = $repo->get_builder_config($builder_name);
 my $module_name = $repo->builder_type_module($type);
 my $module_name = $repo->builder_module($builder_name);
 my $builder     = $repo->builder($builder_name);

 $repo->init_builders;
 $repo->init_builder($builder_name);
 $repo->uninit_builders;
 $repo->uninit_builder($builder_name);

 my $r = $repo->compile_package_from_dsc($builder_name,
                                         $dsc_file,
                                         %opts);
 my $r = $repo->compile_package_from_queue($builder_name,
                                           $request_id,
                                           %opts);

 $repo->request_package_compilation($source_id);
 my @arch_distro_pairs = $repo->get_compilation_targets($source_id);
 my @builders = $repo->get_matching_builders($architecture,
                                             $distribution);

 my $source_id = $repo->register_source_package(%source_package_attrs);

DESCRIPTION

This class gives access to the "builder farm", to actions like initialising the builders, compiling packages and calculating which builders should compile which packages.

The builder farm uses the Arepa configuration to get the needed information.

METHODS

new($path)
new($path, %options)

Creates a new builder farm access object, using the configuration file in $path. The only valid option is builder_config_dir (see Arepa::Config documentation for details).

last_build_log

Returns the output of the last compilation attempt.

package_db

Returns a Arepa::PackageDb object pointing to the package database used by the builder farm.

get_builder_config($builder_name)

Returns a hash with the configuration for the builder $builder_name.

builder_type_module($type)

Returns the module name implementing the features for the builder type $type.

builder_module($builder_name)

Returns the module name implementing the features for the given $builder_name.

builder($builder_name)

Returns the builder object identified by $builder_name.

init_builders

Initialises all the builders. It should be called once per machine boot (e.g. inside an init script).

init_builder($builder_name)

Initialises the builder $builder_name.

uninit_builders

Uninitialises all the builders. It should be called once per machine shutdown (e.g. inside an init script).

uninit_builder($builder_name)

Uninitialises the builder $builder_name.

compile_package_from_dsc($builder_name, $dsc_file, %opts)

Compiles the source package described by the .dsc file $dsc_file using the builder $builder_name, and puts the resulting .deb files in the appropriate output directory. You can specify it with the output_dir option in %opts. If no directory is specified, they're left in the current directory.

bin_nmu_id($src_pkg_attrs, $builder_name)

Returns the binary NMU id that $builder_name should use when building the given source package. The first parameter, $src_pkg_attrs, is a hashref with the attributes of the source package (see get_source_package_by_id in Arepa::PackageDb). The binNMU id is a number, or undef if the given builder should not build the given source package as a binNMU.

compile_package_from_queue($builder_name, $request_id, %opts)

Compiles the request $request_id using the builder $builder_name, and puts the resulting .deb files in the output directory (by default, the current directory). The only valid option is output_dir (to change the output directory).

request_package_compilation($source_id)

Adds a compilation request for the source package with id $source_id.

get_compilation_targets($source_id)

Returns an array of targets for the given source package $source_id. Each target is an arrayref with two elements: architecture and distribution.

get_matching_builders($architecture, $distribution)

Gets the builders that should compile packages for the given $architecture and $distribution. It returns a list of builder names.

register_source_package(%source_package_attrs)

Registers the source package with the given %source_package_attrs. This method is seldom used, as you would normally add the source package to the repository first (using Arepa::Repository), which automatically registers the source package.

canonical_distribution($arch, $distro)

Calculates the canonical distribution, ie. the distribution as registered by one of the Arepa builders, given an architecture and distribution from a changes file or similar. It's needed for the reprepro call. If reprepro accepted "reprepro includesrc 'funnydistro' ...", having 'funnydistro' in the AlsoAcceptFor list, this wouldn't be necessary.

SEE ALSO

Arepa::Repository, Arepa::PackageDb, Arepa::Config.

AUTHOR

Esteban Manchado Velázquez <estebanm@opera.com>.

LICENSE AND COPYRIGHT

This code is offered under the Open Source BSD license.

Copyright (c) 2010, Opera Software. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of Opera Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

DISCLAIMER OF WARRANTY

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 428:

Non-ASCII character seen before =encoding in 'Velázquez'. Assuming UTF-8