NAME
Arepa::Repository - Arepa repository access class
SYNOPSIS
my $repo = Arepa::Repository->new('path/to/config.yml');
my $value = $repo->get_config_key('repository:path');
my @distros = $repo->get_distributions;
my @archs = $repo->get_architectures;
my $bool = $repo->insert_source_package($dsc_file, $distro);
my $bool = $repo->insert_source_package($dsc_file, $distro,
priority => 'optional',
section => 'perl');
my $bool = $repo->insert_source_package($dsc_file, $distro,
priority => 'optional',
section => 'perl',
comments => 'Why this was approved',
canonical_distro => 'lenny');
my $bool = $repo->insert_binary_package($deb_file, $distro);
my $text = $repo->last_cmd_output;
DESCRIPTION
This class represents a reprepro-managed APT repository. It allows you get information about the repository and to insert new source and binary packages in it.
It uses the Arepa configuration to get the repository path, and the own repository reprepro configuration to figure out the distributions and architectures inside it.
METHODS
- new($path)
-
Creates a new repository access object, using the configuration file in
$path
. - get_config_key($key)
-
Gets the configuration key
$key
from the Arepa configuration. - get_distributions
-
Returns an array of hashrefs. Each hashref represents a distribution declared in the repository
conf/distributions
configuration file, and contains a (always lowercase) key for every distribution attribute. - get_architectures
-
Returns a list of all the architectures mentioned in any of the repository distributions.
- insert_source_package($dsc_file, $distribution, %options)
-
Inserts the source package described by the given
$dsc_file
in the repository and the package database, for the given$distribution
. Priority and section can be specified with thepriority
andsection
options in%options
. Other possible options arecomments
(comments about the source package e.g. why it was added to the repo or its origin) andcanonical_distro
(the "canonical" distribution, that is the distribution in your repository the source package should be added to, as opposed to the distribution specified in the actual source package changes file). - insert_binary_package($deb_file, $distribution)
-
Inserts the given binary package
$deb_file
in the repository, for the given$distribution
. - last_cmd_output
-
Returns the text output of the last executed command. This can help debugging problems.
- get_package_list
-
Returns a data structure representing all the available packages in all the known distributions. The data structure is a hash that looks like this:
(foobar => { "lenny/main" => { "1.0-1" => ['source'] } }, pkg2 => { "lenny/main" => { "1.0-1" => [qw(amd64 source)], "1.0-2" => ['i386'], }, "etch/contrib" => { "0.8-1" => [qw(i386 amd64 source) } }, dhelp => { "lenny/main" => { "0.6.15" => [qw(i386 source)] } }, )
That is, the keys are the package names, and the values are another hash. This hash has
distribution/component
as keys, and hashes as values. These hashes have available versions as keys, and a list of architectures as values. - get_source_package_information($package_name, $distro)
-
Returns a hash with the information for the source package with the given
$package_name
inside distribution$distro
. If there is no source package by that name in that distribution, an empty hash will be returned.Note that keys in the hash are lowercase.
- get_binary_package_information($package_name, $distro, $arch)
-
Returns a hash with the information for the binary package with the given
$package_name
inside distribution$distro
/$arch
. If there is no binary package by that name in that distribution, for that architecture, an empty hash will be returned. - add_distribution(%properties)
-
Adds a new distribution to the repository, with whatever properties are specified. The properties are specified in lowercase (see
get_distributions
) andcodename
is mandatory. Also, you can't specify a codename of an existing distribution, or a suite name that an existing distribution already has. It returns 1 on success, or 0 on failure. - sign_distribution($dist_name)
-
Signs the
Release
file for a single distribution (with codename$dist_name
). It returns if GPG returned error status zero. - sync_remote
-
Syncs the local repository to the remote location, if available in the config. Returns if the synchronisation worked (needs the
rsync
command) or false if there wasn't any remote repository location in the config. - is_synced
-
Returns if the local repository is synced with the remote repository. It returns false if there's no remote repository location in the config.
SEE ALSO
Arepa::BuilderFarm
, 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 507:
Non-ASCII character seen before =encoding in 'Velázquez'. Assuming UTF-8