NAME
Arepa::PackageDb - Arepa package database API
SYNOPSIS
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);
DESCRIPTION
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.
METHODS
- new($path)
-
It creates a new database access object for the database in the given
$path
. - insert_source_package(%attrs)
-
Inserts a new source package with the given attributes. At least
name
andfull_version
have to be given. If a package with the givenname
andfull_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. - get_source_package_id($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. Returnsundef
if there's no package with that name and version. - get_source_package_by_id($source_id)
-
Returns a hash with the attributes for the package with id
$source_id
. If the given id doesn't exist, an exception is thrown. - request_compilation($source_id, $architecture, $distribution)
-
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. - get_compilation_queue(%options)
-
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 keystatus
only returns the requests in the given status; a keylimit
limits the results to only as many as specified; a keyorder
tweaks the order (it's plain SQL, so you can add more than one field and or "DESC" after each one). - get_compilation_request_by_id($request_id)
-
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. - mark_compilation_started($request_id, $builder_name)
- mark_compilation_started($request_id, $builder_name, $timestamp)
-
Marks the given compilation request as started by the given
$builder_name
. If$timestamp
is passed, that timestamp is used. Otherwise, the current time. - mark_compilation_completed($request_id)
- mark_compilation_completed($request_id, $timestamp)
-
Marks the given compilation request as finished. If
$timestamp
is passed, that timestamp is used. Otherwise, the current time. - mark_compilation_failed($request_id)
- mark_compilation_failed($request_id, $timestamp)
-
Marks the given compilation request as failed. If
$timestamp
is passed, that timestamp is used. Otherwise, the current time. - mark_compilation_pending($request_id)
- mark_compilation_pending($request_id, $timestamp)
-
Marks the given compilation request as pending (re-queue, sort of). If
$timestamp
is passed, that timestamp is used. Otherwise, the current time.
SEE ALSO
Arepa::BuilderFarm
, Arepa::Repository
.
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 434:
Non-ASCII character seen before =encoding in 'Velázquez'. Assuming UTF-8