Arepa::PackageDb - Arepa package database API
my $pdb = Arepa::PackageDb->new('path/to/packages.db'); %attrs = (name => 'dhelp', full_version => '0.6.17', architecture => 'all', distribution => 'unstable'); my $id = $package_db->insert_source_package(%attrs); my $id2 = $package_db->get_source_package_id($name, $full_version); my $id3 = $package_db->get_source_package_id($name, '*latest*'); my %source_package = $package_db->get_source_package_by_id($id); $pdb->request_compilation($source_id, $arch, $distribution); @queue = $pdb->get_compilation_queue; @latest_queue = $pdb->get_compilation_queue(limit => 5); @pending_queue = $pdb->get_compilation_queue(status => 'pending'); @compiling_queue = $pdb->get_compilation_queue(status => 'compiling'); my %compilation_attrs = $pdb->get_compilation_request_by_id($id); $pdb->mark_compilation_started($compilation_id, $builder_name); $pdb->mark_compilation_completed($compilation_id); $pdb->mark_compilation_failed($compilation_id); $pdb->mark_compilation_pending($compilation_id);
Arepa stores information about the available source packages and the requests to compile them in an SQLite 3 database. This class gives a standard and abstract way to access and update the information in that database.
Usually this class shouldn't be used directly, but through Arepa::Repository, Arepa::BuilderFarm and others.
Arepa::Repository
Arepa::BuilderFarm
It creates a new database access object for the database in the given $path.
$path
Inserts a new source package with the given attributes. At least name and full_version have to be given. If a package with the given name and full_version already exists, its id is returned and the rest of the attributes are ignored. Otherwise, the new source package is created and its id is returned.
name
full_version
Returns the id for the package with $name and $full_version. The special value *latest* for $full_version means latest available in the repository. Returns undef if there's no package with that name and version.
$name
$full_version
*latest*
undef
Returns a hash with the attributes for the package with id $source_id. If the given id doesn't exist, an exception is thrown.
$source_id
Inserts a new compilation request for the given $source_id, $architecture and $distribution. No checks are made as to ensure that the given architecture and distribution match the original source package.
$architecture
$distribution
Returns a list compilation requests. Each request is a hashref with all the attributes. By default, all elements in the queue are returned. However, %options can be used to customise the results: a key status only returns the requests in the given status; a key limit limits the results to only as many as specified; a key order tweaks the order (it's plain SQL, so you can add more than one field and or "DESC" after each one).
%options
status
limit
order
Returns a hash with the attributes of the compilation request with the given $request_id. If no request with the given id exists, an exception is thrown.
$request_id
Marks the given compilation request as started by the given $builder_name. If $timestamp is passed, that timestamp is used. Otherwise, the current time.
$builder_name
$timestamp
Marks the given compilation request as finished. If $timestamp is passed, that timestamp is used. Otherwise, the current time.
Marks the given compilation request as failed. If $timestamp is passed, that timestamp is used. Otherwise, the current time.
Marks the given compilation request as pending (re-queue, sort of). If $timestamp is passed, that timestamp is used. Otherwise, the current time.
Arepa::BuilderFarm, Arepa::Repository.
Esteban Manchado Velázquez <estebanm@opera.com>.
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.
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:
Non-ASCII character seen before =encoding in 'Velázquez'. Assuming UTF-8
To install Arepa, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Arepa
CPAN shell
perl -MCPAN -e shell install Arepa
For more information on module installation, please visit the detailed CPAN module installation guide.