aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-26 23:34:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-26 23:34:14 +0000
commita3bc51b78ba5be6ac9a7807a06d3378fd0abdb3e (patch)
tree8c18a501461ac7642df0c0691aa80292dffa2ec0
parentb79077e6ddc4e5ec6b8a7781f16eda4a36ee1ec5 (diff)
downloadpaludis-a3bc51b78ba5be6ac9a7807a06d3378fd0abdb3e.tar.gz
paludis-a3bc51b78ba5be6ac9a7807a06d3378fd0abdb3e.tar.xz
Add support for a repository_defaults.conf file. Fixes: ticket:8
-rw-r--r--doc/configuration.html.skel6
-rw-r--r--paludis/environment/default/default_config.cc7
-rw-r--r--paludis/util/collection.hh17
-rw-r--r--paludis/util/collection_concrete.hh5
4 files changed, 34 insertions, 1 deletions
diff --git a/doc/configuration.html.skel b/doc/configuration.html.skel
index 0b21281..3021f73 100644
--- a/doc/configuration.html.skel
+++ b/doc/configuration.html.skel
@@ -201,6 +201,12 @@ two different repositories contain an identical package atom (e.g. foo/bar-1.0).
The repository with the higher importance will always be chosen first. If not
provided, the default is 0.</p>
+<p>To avoid duplication across configuration files, a file named
+<code>repository_defaults.conf</code> can be used to specify defaults (this file
+does <strong>not</strong> live in the <code>repositories/</code> subdirectory).
+Keys in this file are overridden by identically named keys in individual
+configuration files.</p>
+
<h4>ebuild Format Repositories</h4>
<p>The following keys are available for <code>format = ebuild</code>:</p>
diff --git a/paludis/environment/default/default_config.cc b/paludis/environment/default/default_config.cc
index 5e2b09f..70908bd 100644
--- a/paludis/environment/default/default_config.cc
+++ b/paludis/environment/default/default_config.cc
@@ -307,6 +307,13 @@ DefaultConfig::DefaultConfig() :
/* repositories */
{
+ if ((local_config_dir / "repository_defaults.conf").exists())
+ {
+ KeyValueConfigFile defaults_file(local_config_dir / "repository_defaults.conf");
+ std::copy(defaults_file.begin(), defaults_file.end(),
+ conf_vars->inserter());
+ }
+
std::list<FSEntry> dirs;
dirs.push_back(local_config_dir / "repositories");
diff --git a/paludis/util/collection.hh b/paludis/util/collection.hh
index 718d066..db32678 100644
--- a/paludis/util/collection.hh
+++ b/paludis/util/collection.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -358,6 +358,21 @@ namespace paludis
virtual bool empty() const = 0;
///\}
+
+ ///\name Inserter
+ ///\{
+
+ /**
+ * Our insert iterator type.
+ */
+ typedef libwrapiter::OutputIterator<AssociativeCollection<K_, V_>, std::pair<K_, V_> > Inserter;
+
+ /**
+ * Fetch an inserter.
+ */
+ virtual Inserter inserter() = 0;
+
+ ///\}
};
}
diff --git a/paludis/util/collection_concrete.hh b/paludis/util/collection_concrete.hh
index 4fed4e5..07ad487 100644
--- a/paludis/util/collection_concrete.hh
+++ b/paludis/util/collection_concrete.hh
@@ -315,6 +315,11 @@ namespace paludis
{
return _items.empty();
}
+
+ virtual Inserter inserter()
+ {
+ return Inserter(std::inserter(_items, _items.begin()));
+ }
};
}