PkgForge::Registry - A Moose class used for access to the PkgForge registry.
This documentation refers to PkgForge::Registry version 1.3.0
use PkgForge::Registry; my $registry = PkgForge::Registry->new(); # or more usefully... my $registry = PkgForge::Registry->new_with_config( configfile => "foo.yml" ); # Get the DBIx::Class schema object my $schema = $registry->schema; # Provides some high-level methods if ( !$registry->job_exists($job) ) { $registry->register_job($job); } $registry->update_job_status($job,'valid');
This class manages access to the Package Forge registry. It provides configuration handling methods for setting the various DBI parameters which are used to load the DBIx::Class schema object. It also provides some high-level functions which are used for registering build jobs and managing the status of separate tasks associated with each job.
This class has the following attributes:
This is the name of the database being used to store the registry information. This attibute MUST be specified, there is no default value.
This is the host name for the database server. This attribute is optional, see DBD::Pg for details of the default value.
This is the port number for the database server. This attribute is optional, see DBD::Pg for details of the default value.
This is the name of the user to be used for accessing the database. This attribute is optional, see DBD::Pg for details of the default value.
This is the password for the user to be used for accessing the database. This attribute is optional, see DBD::Pg for details of the default value.
This gives access to the DBIx::Class::Schema object.
The name for a configuration file which can be used for loading the registry attributes. The default is /etc/pkgforge/registry.yml. This only has an effect when you create a new object using the new_with_config method.
/etc/pkgforge/registry.yml
new_with_config
This class has the following methods:
Create a new instance of this class. Optionally a hash (or reference to a hash) of attributes and their values can be specified.
Create a new instance of this class using the attribute values set in a configuration file. By default, the /etc/pkgforge/registry.yml will be loaded, if it exists. The configuration file can be changed using the configfile attribute. See PkgForge::ConfigFile for more details.
configfile
This returns the DBI Data Source Name (DSN) built from the various attributes. The DSN is passed through to the DBI layer and this method is mainly provided to help future sub-classes which might need to override the database driver.
This method takes a PkgForge::Job object and registers the job into the PkgForge registry. Firstly a check is made that no other job with the same UUID has already been registered. If successful the method will return true, if anything fails then the method will die.
This method takes a PkgForge::Job object and registers the associated tasks (if any). Firstly this method checks that the job has already been registered (this should be done with register_job). It then calls the process_build_targets method on the job object with the current list of active build target platforms to find out which platforms and architectures are required. A task is added for each required platform (if any). The job status will be updated to registered if the tasks are successfully registered. If successful the method will return true, if anything fails then the method will die.
register_job
process_build_targets
registered
This method takes a PkgForge::Job object and returns the name of the current status for the job. This method will die if it cannot find the relevant job, if no status is found then unknown will be returned.
unknown
This method takes a PkgForge::Job object and the name of a status to which the job status field should be set. If anything fails this method will die.
This method takes the name of a registered builder and resets any associated unfinished tasks (in the building status) to the needs build status. This is particularly useful when a shut down of a builder has been requested before a task is finished. The task can then be picked up again later by another operational daemon.
building
needs build
This method takes the name of a registered builder and returns the next task in the status needs build (if any). If a new task is found then it will be moved into the building status, the current job for that builder will be recorded and a PkgForge::Registry::Schema::Result::Job object will be returned. If no new tasks are found the method will return undef, if an error occurs the method will die.
current
undef
Whilst selecting the next task all rows in the database for that platform containing tasks needing building will be locked. This is to avoid multiple builders for the same platform taking on the same tasks.
This registers a task as having failed to build on the platform supported by the specified builder. Note that, to maintain consistency, this method requires the specified job to be the same as that which is considered current for the builder.
This registers a task as having successfully built on the platform supported by the specified builder. Note that, to maintain consistency, this method requires the specified job to be the same as that which is considered current for the builder.
If the new_with_config method is used then configuration information can be loaded from a file. The default file name is /etc/pkgforge/registry.yml but that can be overridden using the configfile attribute.
It is not necessary to set all the attributes to successfully connect to the database. The DBI layer has support for using environment variables for nearly all possible connection options, see DBD::Pg for full details.
This module is powered by Moose and uses MooseX::ConfigFromFile and MooseX::Types. The DBIx::Class object-relational mapper modules are used for database access. Currently PkgForge requires PostgreSQL for the database backend, this means that the DBD::Pg module is also necessary.
PkgForge
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 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.
To install PkgForge::Registry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PkgForge::Registry
CPAN shell
perl -MCPAN -e shell install PkgForge::Registry
For more information on module installation, please visit the detailed CPAN module installation guide.