| Arepa documentation | view source | Contained in the Arepa distribution. |
Arepa::Config - Arepa package database API
my $config = Arepa::Config->new('path/to/config.yml');
my $config = Arepa::Config->new('path/to/config.yml',
builder_config_dir => 'path/to/builderconf');
my $pdb_path = $config->get_key('package_db');
my $repo_path = $config->get_key('repository:path');
if ($config->key_exists('optional:key')) {
$value = $config->get_key('optional:key');
}
my @builder_names = $config->get_builders;
my %builder_config = $config->get_builder_config('some-builder');
my $value = $config->get_builder_config_key('some-builder', $key);
This class allows easy access to the Arepa configuration. The configuration is
divided in two parts: the basic configuration (a single YAML file) and the
configuration for the builders (a YAML file for each builder). Typically you
would pass a single path for the main configuration, and the builder
configuration would be loaded from the directory builders inside the same
parent directory as the main configuration file. However, if you want you can
specify a custom directory to load the builder configuration from.
This is an excerpt of an example configuration file:
--- repository: path: /home/zoso/src/apt-web/test-repo/ upload_queue: path: /home/zoso/src/apt-web/incoming package_db: /home/zoso/src/apt-web/package.db web_ui: base_url: http://localhost user_file: /home/zoso/src/apt-web/repo-tools-web/users.yml
This is an example of a builder configuration file (say, squeeze32.yaml):
--- type: sbuild architecture: i386 distribution: my-squeeze other_distributions: [squeeze, unstable]
Usually this class is not used directly, but internally in Arepa::Repository
or Arepa::BuilderFarm.
It creates a new configuration access object for the configuration file in the
given $path. The only valid option is builder_config_dir, the path where
the builder configuration files are located.
Return true/false if the given configuration key is defined or not.
Returns the value of the given $key in the configuration file. If it's not a
top-level key, the subkeys must be separated by a colon (":"). If the key
cannot be found, an exception is thrown.
Returns an array of names of the defined builders.
Returns a hash with the configuration of the given $builder_name. If no
builder (or more than one) is found by that name, an exception is thrown.
Returns the value for the given configuration $key for the given
$builder_name.
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.
| Arepa documentation | view source | Contained in the Arepa distribution. |