aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-22 20:31:19 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-22 20:31:45 +0100
commit1b8bbb1a910d35e4e3da18d976ed96d965eb55aa (patch)
treed88ad63fa14ca154ed02ed0afe847f4a20fa7f22
parent343a7e259402dc193d8de4be6d189791b8234f47 (diff)
downloadpaludis-1b8bbb1a910d35e4e3da18d976ed96d965eb55aa.tar.gz
paludis-1b8bbb1a910d35e4e3da18d976ed96d965eb55aa.tar.xz
Split up distribution configs.
-rw-r--r--configure.ac2
-rw-r--r--paludis/distribution-fwd.hh2
-rw-r--r--paludis/distribution-impl.hh76
-rw-r--r--paludis/distribution.cc16
-rw-r--r--paludis/distribution.hh61
-rw-r--r--paludis/distributions/Makefile.am2
-rw-r--r--paludis/distributions/exherbo.conf25
-rw-r--r--paludis/distributions/exherbo/Makefile.am21
-rw-r--r--paludis/distributions/exherbo/e.conf10
-rw-r--r--paludis/distributions/exherbo/gems.conf2
-rw-r--r--paludis/distributions/gentoo.conf25
-rw-r--r--paludis/distributions/gentoo/Makefile.am21
-rw-r--r--paludis/distributions/gentoo/e.conf9
-rw-r--r--paludis/distributions/gentoo/gems.conf1
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/repositories/e/Makefile.am2
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc5
-rw-r--r--paludis/repositories/e/e_repository.cc102
-rw-r--r--paludis/repositories/e/exndbam_repository.cc5
-rw-r--r--paludis/repositories/e/extra_distribution_data.cc57
-rw-r--r--paludis/repositories/e/extra_distribution_data.hh61
-rw-r--r--paludis/repositories/e/vdb_repository.cc13
-rw-r--r--paludis/repositories/gems/Makefile.am4
-rw-r--r--paludis/repositories/gems/extra_distribution_data.cc50
-rw-r--r--paludis/repositories/gems/extra_distribution_data.hh45
-rw-r--r--paludis/repositories/gems/gems_repository.cc4
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc4
27 files changed, 487 insertions, 140 deletions
diff --git a/configure.ac b/configure.ac
index 2281b60..df2c906 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1400,6 +1400,8 @@ AC_OUTPUT(
paludis/about.hh
paludis/args/Makefile
paludis/distributions/Makefile
+ paludis/distributions/exherbo/Makefile
+ paludis/distributions/gentoo/Makefile
paludis/environments/Makefile
paludis/environments/adapted/Makefile
paludis/environments/no_config/Makefile
diff --git a/paludis/distribution-fwd.hh b/paludis/distribution-fwd.hh
index 7ffc9a5..ef8091b 100644
--- a/paludis/distribution-fwd.hh
+++ b/paludis/distribution-fwd.hh
@@ -32,6 +32,8 @@ namespace paludis
{
class DistributionData;
class DistributionConfigurationError;
+
+ template <typename T_> class ExtraDistributionData;
}
#endif
diff --git a/paludis/distribution-impl.hh b/paludis/distribution-impl.hh
new file mode 100644
index 0000000..372b787
--- /dev/null
+++ b/paludis/distribution-impl.hh
@@ -0,0 +1,76 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_DISTRIBUTION_IMPL_HH
+#define PALUDIS_GUARD_PALUDIS_DISTRIBUTION_IMPL_HH 1
+
+#include <paludis/distribution.hh>
+#include <paludis/util/mutex.hh>
+#include <paludis/util/hashes.hh>
+#include <paludis/util/config_file.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/instantiation_policy-impl.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <tr1/unordered_map>
+
+namespace paludis
+{
+#ifndef PALUDIS_NO_DOUBLE_TEMPLATE
+ template <>
+#endif
+ template <typename Data_>
+ struct Implementation<ExtraDistributionData<Data_> >
+ {
+ mutable Mutex mutex;
+ mutable std::tr1::unordered_map<std::string, std::tr1::shared_ptr<const Data_>, Hash<std::string> > values;
+ };
+
+ template <typename Data_>
+ ExtraDistributionData<Data_>::ExtraDistributionData() :
+ PrivateImplementationPattern<ExtraDistributionData<Data_> >(new Implementation<ExtraDistributionData<Data_> >)
+ {
+ }
+
+ template <typename Data_>
+ ExtraDistributionData<Data_>::~ExtraDistributionData()
+ {
+ }
+
+ template <typename T_>
+ struct ExtraDistributionDataData;
+
+ template <typename Data_>
+ const std::tr1::shared_ptr<const Data_>
+ ExtraDistributionData<Data_>::data_from_distribution(const Distribution & d) const
+ {
+ Lock lock(this->_imp->mutex);
+ typename std::tr1::unordered_map<std::string, std::tr1::shared_ptr<const Data_>, Hash<std::string> >::const_iterator v(
+ this->_imp->values.find(d.name()));
+ if (this->_imp->values.end() != v)
+ return v->second;
+
+ KeyValueConfigFile k(d.extra_data_dir() / ExtraDistributionDataData<Data_>::config_file_name(),
+ KeyValueConfigFileOptions(), &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
+ std::tr1::shared_ptr<const Data_> data(ExtraDistributionDataData<Data_>::make_data(k));
+ this->_imp->values.insert(std::make_pair(d.name(), data));
+ return data;
+ }
+}
+
+#endif
diff --git a/paludis/distribution.cc b/paludis/distribution.cc
index b6a7c2d..60f6b19 100644
--- a/paludis/distribution.cc
+++ b/paludis/distribution.cc
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/distribution.hh>
+#include <paludis/distribution-impl.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/dir_iterator.hh>
@@ -68,20 +68,10 @@ namespace paludis
make_shared_ptr(new Distribution(make_named_values<Distribution>(
value_for<n::concept_keyword>(k.get("concept_keyword")),
value_for<n::concept_use>(k.get("concept_use")),
- value_for<n::default_ebuild_builddir>(k.get("default_ebuild_builddir")),
- value_for<n::default_ebuild_distdir>(k.get("default_ebuild_distdir")),
- value_for<n::default_ebuild_eapi_when_unknown>(k.get("default_ebuild_eapi_when_unknown")),
- value_for<n::default_ebuild_eapi_when_unspecified>(k.get("default_ebuild_eapi_when_unspecified")),
- value_for<n::default_ebuild_layout>(k.get("default_ebuild_layout")),
- value_for<n::default_ebuild_names_cache>(k.get("default_ebuild_names_cache")),
- value_for<n::default_ebuild_profile_eapi>(k.get("default_ebuild_profile_eapi")),
- value_for<n::default_ebuild_write_cache>(k.get("default_ebuild_write_cache")),
value_for<n::default_environment>(k.get("default_environment")),
- value_for<n::default_vdb_names_cache>(k.get("default_vdb_names_cache")),
- value_for<n::default_vdb_provides_cache>(k.get("default_vdb_provides_cache")),
+ value_for<n::extra_data_dir>(FSEntry(strip_trailing_string(stringify(d->realpath()), ".conf"))),
value_for<n::fallback_environment>(k.get("fallback_environment")),
- value_for<n::paludis_environment_keywords_conf_filename>(k.get("paludis_environment_keywords_conf_filename")),
- value_for<n::paludis_environment_use_conf_filename>(k.get("paludis_environment_use_conf_filename")),
+ value_for<n::name>(strip_trailing_string(d->basename(), ".conf")),
value_for<n::paludis_package>(k.get("paludis_package")),
value_for<n::support_old_style_virtuals>(destringify<bool>(k.get("support_old_style_virtuals")))
)))));
diff --git a/paludis/distribution.hh b/paludis/distribution.hh
index e0e380e..946d41c 100644
--- a/paludis/distribution.hh
+++ b/paludis/distribution.hh
@@ -26,6 +26,7 @@
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/named_value.hh>
+#include <paludis/util/fs_entry.hh>
#include <tr1/memory>
/** \file
@@ -45,20 +46,10 @@ namespace paludis
{
struct concept_keyword;
struct concept_use;
- struct default_ebuild_builddir;
- struct default_ebuild_distdir;
- struct default_ebuild_eapi_when_unknown;
- struct default_ebuild_eapi_when_unspecified;
- struct default_ebuild_layout;
- struct default_ebuild_names_cache;
- struct default_ebuild_profile_eapi;
- struct default_ebuild_write_cache;
struct default_environment;
- struct default_vdb_names_cache;
- struct default_vdb_provides_cache;
+ struct extra_data_dir;
struct fallback_environment;
- struct paludis_environment_keywords_conf_filename;
- struct paludis_environment_use_conf_filename;
+ struct name;
struct paludis_package;
struct support_old_style_virtuals;
}
@@ -66,6 +57,9 @@ namespace paludis
/**
* Information about a distribution.
*
+ * The Distribution::config_dir key points to a directory that can be used
+ * by submodules to store their own configuration.
+ *
* \see DistributionData
* \ingroup g_distribution
* \since 0.30
@@ -75,20 +69,10 @@ namespace paludis
{
NamedValue<n::concept_keyword, std::string> concept_keyword;
NamedValue<n::concept_use, std::string> concept_use;
- NamedValue<n::default_ebuild_builddir, std::string> default_ebuild_builddir;
- NamedValue<n::default_ebuild_distdir, std::string> default_ebuild_distdir;
- NamedValue<n::default_ebuild_eapi_when_unknown, std::string> default_ebuild_eapi_when_unknown;
- NamedValue<n::default_ebuild_eapi_when_unspecified, std::string> default_ebuild_eapi_when_unspecified;
- NamedValue<n::default_ebuild_layout, std::string> default_ebuild_layout;
- NamedValue<n::default_ebuild_names_cache, std::string> default_ebuild_names_cache;
- NamedValue<n::default_ebuild_profile_eapi, std::string> default_ebuild_profile_eapi;
- NamedValue<n::default_ebuild_write_cache, std::string> default_ebuild_write_cache;
NamedValue<n::default_environment, std::string> default_environment;
- NamedValue<n::default_vdb_names_cache, std::string> default_vdb_names_cache;
- NamedValue<n::default_vdb_provides_cache, std::string> default_vdb_provides_cache;
+ NamedValue<n::extra_data_dir, FSEntry> extra_data_dir;
NamedValue<n::fallback_environment, std::string> fallback_environment;
- NamedValue<n::paludis_environment_keywords_conf_filename, std::string> paludis_environment_keywords_conf_filename;
- NamedValue<n::paludis_environment_use_conf_filename, std::string> paludis_environment_use_conf_filename;
+ NamedValue<n::name, std::string> name;
NamedValue<n::paludis_package, std::string> paludis_package;
NamedValue<n::support_old_style_virtuals, bool> support_old_style_virtuals;
};
@@ -142,6 +126,35 @@ namespace paludis
*/
std::tr1::shared_ptr<const Distribution> distribution_from_string(const std::string &) const;
};
+
+ /**
+ * Fetch module-specific information about a distribution.
+ *
+ * Various modules provide typedefs for instantiations of this template,
+ * allowing access to additional information abotu a distribution.
+ *
+ * \ingroup g_distribution
+ * \since 0.30
+ */
+ template <typename Data_>
+ class PALUDIS_VISIBLE ExtraDistributionData :
+ private PrivateImplementationPattern<ExtraDistributionData<Data_> >,
+ public InstantiationPolicy<ExtraDistributionData<Data_>, instantiation_method::SingletonTag>
+ {
+ friend class InstantiationPolicy<ExtraDistributionData<Data_>, instantiation_method::SingletonTag>;
+
+ private:
+ ExtraDistributionData();
+ ~ExtraDistributionData();
+
+ public:
+ /**
+ * Fetch our data from a given distribution.
+ */
+ const std::tr1::shared_ptr<const Data_> data_from_distribution(
+ const Distribution &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
#endif
diff --git a/paludis/distributions/Makefile.am b/paludis/distributions/Makefile.am
index 7a53db8..28d3a28 100644
--- a/paludis/distributions/Makefile.am
+++ b/paludis/distributions/Makefile.am
@@ -1,6 +1,6 @@
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT .keep
-SUBDIRS =
+SUBDIRS = . exherbo gentoo
distributions = \
exherbo.conf \
diff --git a/paludis/distributions/exherbo.conf b/paludis/distributions/exherbo.conf
index 3f2ccda..6344a7f 100644
--- a/paludis/distributions/exherbo.conf
+++ b/paludis/distributions/exherbo.conf
@@ -1,26 +1,9 @@
-# Configuration for Exherbo
+# Basic configuration for Exherbo
+concept_keyword = platform
+concept_use = Option flag
default_environment = paludis
fallback_environment =
-support_old_style_virtuals = false
-
-default_ebuild_distdir = /var/cache/paludis/distfiles
-default_ebuild_write_cache = /var/cache/paludis/metadata
-default_ebuild_names_cache = /var/cache/paludis/names
-default_ebuild_builddir = /var/tmp/paludis/build
-default_ebuild_layout = exheres
-default_ebuild_eapi_when_unknown = exheres-0
-default_ebuild_eapi_when_unspecified = exheres-0
-default_ebuild_profile_eapi = exheres-0
-
-default_vdb_names_cache = /var/cache/paludis/names
-default_vdb_provides_cache = /var/empty
-
-paludis_environment_use_conf_filename = options.conf
-paludis_environment_keywords_conf_filename = platforms.conf
-
-concept_use = Option flag
-concept_keyword = platform
-
paludis_package = sys-apps/paludis
+support_old_style_virtuals = false
diff --git a/paludis/distributions/exherbo/Makefile.am b/paludis/distributions/exherbo/Makefile.am
new file mode 100644
index 0000000..c82a21c
--- /dev/null
+++ b/paludis/distributions/exherbo/Makefile.am
@@ -0,0 +1,21 @@
+MAINTAINERCLEANFILES = Makefile.in
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT .keep
+SUBDIRS =
+
+distributiondir = $(datadir)/paludis/distributions/exherbo/
+
+distribution_DATA = e.conf gems.conf
+
+EXTRA_DIST = $(distribution_DATA)
+
+built-sources : $(BUILT_SOURCES)
+ for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
+
+distcheck-deps-local : $(DISTCHECK_DEPS)
+
+distcheck-deps : distcheck-deps-subdirs
+
+distcheck-deps-subdirs :
+ for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
+ else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
+
diff --git a/paludis/distributions/exherbo/e.conf b/paludis/distributions/exherbo/e.conf
new file mode 100644
index 0000000..9824638
--- /dev/null
+++ b/paludis/distributions/exherbo/e.conf
@@ -0,0 +1,10 @@
+default_buildroot = /var/tmp/paludis/build
+default_distdir = /var/cache/paludis/distfiles
+default_eapi_when_unknown = exheres-0
+default_eapi_when_unspecified = exheres-0
+default_layout = exheres
+default_names_cache = /var/cache/paludis/names
+default_profile_eapi = exheres-0
+default_provides_cache = /var/empty
+default_write_cache = /var/cache/paludis/metadata
+
diff --git a/paludis/distributions/exherbo/gems.conf b/paludis/distributions/exherbo/gems.conf
new file mode 100644
index 0000000..0132b6e
--- /dev/null
+++ b/paludis/distributions/exherbo/gems.conf
@@ -0,0 +1,2 @@
+default_buildroot = /var/tmp/paludis/build
+
diff --git a/paludis/distributions/gentoo.conf b/paludis/distributions/gentoo.conf
index 25c9655..63f1234 100644
--- a/paludis/distributions/gentoo.conf
+++ b/paludis/distributions/gentoo.conf
@@ -1,26 +1,9 @@
-# Configuration for Gentoo
+# Basic configuration for Gentoo
+concept_keyword = keyword
+concept_use = USE flag
default_environment = paludis
fallback_environment = portage
-support_old_style_virtuals = true
-
-default_ebuild_distdir = distfiles
-default_ebuild_write_cache = /var/empty
-default_ebuild_names_cache =
-default_ebuild_builddir = /var/tmp/paludis
-default_ebuild_layout = traditional
-default_ebuild_eapi_when_unknown = 0
-default_ebuild_eapi_when_unspecified = 0
-default_ebuild_profile_eapi = 0
-
-default_vdb_provides_cache =
-default_vdb_names_cache =
-
-paludis_environment_use_conf_filename = use.conf
-paludis_environment_keywords_conf_filename = keywords.conf
-
-concept_use = USE flag
-concept_keyword = keyword
-
paludis_package = sys-apps/paludis
+support_old_style_virtuals = true
diff --git a/paludis/distributions/gentoo/Makefile.am b/paludis/distributions/gentoo/Makefile.am
new file mode 100644
index 0000000..90ecf18
--- /dev/null
+++ b/paludis/distributions/gentoo/Makefile.am
@@ -0,0 +1,21 @@
+MAINTAINERCLEANFILES = Makefile.in
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT .keep
+SUBDIRS =
+
+distributiondir = $(datadir)/paludis/distributions/gentoo/
+
+distribution_DATA = e.conf gems.conf
+
+EXTRA_DIST = $(distribution_DATA)
+
+built-sources : $(BUILT_SOURCES)
+ for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
+
+distcheck-deps-local : $(DISTCHECK_DEPS)
+
+distcheck-deps : distcheck-deps-subdirs
+
+distcheck-deps-subdirs :
+ for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
+ else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
+
diff --git a/paludis/distributions/gentoo/e.conf b/paludis/distributions/gentoo/e.conf
new file mode 100644
index 0000000..f4ddaed
--- /dev/null
+++ b/paludis/distributions/gentoo/e.conf
@@ -0,0 +1,9 @@
+default_buildroot = /var/tmp/paludis
+default_distdir = distfiles
+default_eapi_when_unknown = 0
+default_eapi_when_unspecified = 0
+default_layout = traditional
+default_names_cache =
+default_profile_eapi = 0
+default_provides_cache =
+default_write_cache = /var/empty
diff --git a/paludis/distributions/gentoo/gems.conf b/paludis/distributions/gentoo/gems.conf
new file mode 100644
index 0000000..bcb46fa
--- /dev/null
+++ b/paludis/distributions/gentoo/gems.conf
@@ -0,0 +1 @@
+default_buildroot = /var/tmp/paludis
diff --git a/paludis/files.m4 b/paludis/files.m4
index c349656..8b91738 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -21,7 +21,7 @@ add(`dep_spec', `hh', `cc', `test', `fwd')
add(`dep_spec_flattener', `hh', `cc')
add(`dep_tree', `hh', `cc', `fwd')
add(`dep_tag', `hh', `cc', `fwd', `sr')
-add(`distribution', `hh', `cc', `fwd')
+add(`distribution', `hh', `cc', `impl', `fwd')
add(`elike_dep_parser', `hh', `cc', `fwd', `test')
add(`elike_conditional_dep_spec', `hh', `cc', `fwd')
add(`elike_package_dep_spec', `hh', `cc', `fwd', `se')
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index fb4a944..654ef0e 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -68,6 +68,7 @@ paludis_repositories_e_include_HEADERS = \
exndbam_id.hh \
exndbam_repository.hh \
exndbam_repository-sr.hh \
+ extra_distribution_data.hh \
fetch_visitor.hh \
info_metadata_key.hh \
pretend_fetch_visitor.hh \
@@ -119,6 +120,7 @@ libpaludiserepository_@PALUDIS_PC_SLOT@_la_SOURCES = \
exndbam_id.cc \
exndbam_repository.cc \
exheres_layout.cc \
+ extra_distribution_data.cc \
fetch_visitor.cc \
info_metadata_key.cc \
pretend_fetch_visitor.cc \
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index dd8d579..1833871 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -19,6 +19,7 @@
#include <paludis/repositories/e/e_installed_repository_id.hh>
#include <paludis/repositories/e/e_key.hh>
+#include <paludis/repositories/e/extra_distribution_data.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/dep_parser.hh>
@@ -547,8 +548,8 @@ EInstalledRepositoryID::eapi() const
Log::get_instance()->message("e.no_eapi", ll_debug, lc_context) << "No EAPI entry in '" << _imp->dir << "', pretending '"
<< _imp->environment->distribution() << "'";
_imp->eapi = EAPIData::get_instance()->eapi_from_string(
- (*DistributionData::get_instance()->distribution_from_string(
- _imp->environment->distribution())).default_ebuild_eapi_when_unspecified());
+ EExtraDistributionData::get_instance()->data_from_distribution(*DistributionData::get_instance()->distribution_from_string(
+ _imp->environment->distribution()))->default_eapi_when_unspecified());
}
return _imp->eapi;
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 3431792..837c76c 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -31,9 +31,11 @@
#include <paludis/repositories/e/e_repository_exceptions.hh>
#include <paludis/repositories/e/e_repository_entries.hh>
#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/extra_distribution_data.hh>
#include <paludis/repositories/e/use_desc.hh>
#include <paludis/repositories/e/layout.hh>
#include <paludis/repositories/e/info_metadata_key.hh>
+#include <paludis/repositories/e/extra_distribution_data.hh>
#ifdef ENABLE_QA
# include <paludis/repositories/e/qa/qa_controller.hh>
@@ -104,6 +106,7 @@
*/
using namespace paludis;
+using namespace paludis::erepository;
typedef std::tr1::unordered_map<QualifiedPackageName,
std::list<std::pair<std::tr1::shared_ptr<const PackageDepSpec>, std::tr1::shared_ptr<const RepositoryMaskInfo> > >,
@@ -195,8 +198,8 @@ namespace paludis
mutable std::tr1::shared_ptr<ERepositoryNews> news_ptr;
mutable std::tr1::shared_ptr<ERepositorySets> sets_ptr;
- mutable std::tr1::shared_ptr<erepository::ERepositoryEntries> entries_ptr;
- mutable std::tr1::shared_ptr<erepository::Layout> layout;
+ mutable std::tr1::shared_ptr<ERepositoryEntries> entries_ptr;
+ mutable std::tr1::shared_ptr<Layout> layout;
Implementation(ERepository * const, const ERepositoryParams &, std::tr1::shared_ptr<Mutexes> = make_shared_ptr(new Mutexes));
~Implementation();
@@ -243,8 +246,8 @@ namespace paludis
has_mirrors(false),
has_profiles_desc(false),
sets_ptr(new ERepositorySets(params.environment, r, p)),
- entries_ptr(erepository::ERepositoryEntriesFactory::get_instance()->create(params.entry_format, params.environment, r, p)),
- layout(erepository::LayoutFactory::get_instance()->create(params.layout, r, params.location, entries_ptr, get_master_locations(
+ entries_ptr(ERepositoryEntriesFactory::get_instance()->create(params.entry_format, params.environment, r, p)),
+ layout(LayoutFactory::get_instance()->create(params.layout, r, params.location, entries_ptr, get_master_locations(
params.master_repositories))),
format_key(new LiteralMetadataValueKey<std::string> ("format", "format",
mkt_significant, params.entry_format)),
@@ -298,16 +301,16 @@ namespace paludis
layout->info_packages_files()->end(),
std::tr1::bind(std::tr1::mem_fn(&FSEntry::is_regular_file_or_symlink_to_regular_file),
std::tr1::placeholders::_1)) ?
- make_shared_ptr(new erepository::InfoPkgsMetadataKey(params.environment, layout->info_packages_files(),
+ make_shared_ptr(new InfoPkgsMetadataKey(params.environment, layout->info_packages_files(),
params.profile_eapi)) :
- std::tr1::shared_ptr<erepository::InfoPkgsMetadataKey>()
+ std::tr1::shared_ptr<InfoPkgsMetadataKey>()
),
info_vars_key(layout->info_variables_files()->end() != std::find_if(layout->info_variables_files()->begin(),
layout->info_variables_files()->end(),
std::tr1::bind(std::tr1::mem_fn(&FSEntry::is_regular_file_or_symlink_to_regular_file),
std::tr1::placeholders::_1)) ?
- make_shared_ptr(new erepository::InfoVarsMetadataKey(layout->info_variables_files())) :
- std::tr1::shared_ptr<erepository::InfoVarsMetadataKey>()
+ make_shared_ptr(new InfoVarsMetadataKey(layout->info_variables_files())) :
+ std::tr1::shared_ptr<InfoVarsMetadataKey>()
),
binary_destination_key(new LiteralMetadataValueKey<std::string> (
"binary_destination", "binary_destination", mkt_normal, stringify(params.binary_destination))),
@@ -332,7 +335,7 @@ namespace paludis
profile_ptr.reset(new ERepositoryProfile(
params.environment, repo, repo->name(), *params.profiles,
- erepository::EAPIData::get_instance()->eapi_from_string(
+ EAPIData::get_instance()->eapi_from_string(
params.eapi_when_unknown)->supported()->ebuild_environment_variables()->env_arch()));
}
@@ -376,7 +379,7 @@ namespace paludis
value_for<n::path>(*profiles.begin()),
value_for<n::profile>(std::tr1::shared_ptr<ERepositoryProfile>(new ERepositoryProfile(
params.environment, repo, repo->name(), profiles,
- erepository::EAPIData::get_instance()->eapi_from_string(
+ EAPIData::get_instance()->eapi_from_string(
params.eapi_when_unknown)->supported()->ebuild_environment_variables()->env_arch()))),
value_for<n::status>(tokens.at(2))
));
@@ -557,11 +560,11 @@ ERepository::repository_masked(const PackageID & id) const
using namespace std::tr1::placeholders;
std::tr1::shared_ptr<const FSEntrySequence> repository_mask_files(_imp->layout->repository_mask_files());
- erepository::ProfileFile<erepository::MaskFile> repository_mask_file;
+ ProfileFile<MaskFile> repository_mask_file;
std::for_each(repository_mask_files->begin(), repository_mask_files->end(),
- std::tr1::bind(&erepository::ProfileFile<erepository::MaskFile>::add_file, std::tr1::ref(repository_mask_file), _1));
+ std::tr1::bind(&ProfileFile<MaskFile>::add_file, std::tr1::ref(repository_mask_file), _1));
- for (erepository::ProfileFile<erepository::MaskFile>::ConstIterator
+ for (ProfileFile<MaskFile>::ConstIterator
line(repository_mask_file.begin()), line_end(repository_mask_file.end()) ;
line != line_end ; ++line)
{
@@ -569,7 +572,7 @@ ERepository::repository_masked(const PackageID & id) const
{
std::tr1::shared_ptr<const PackageDepSpec> a(new PackageDepSpec(parse_elike_package_dep_spec(
line->first,
- erepository::EAPIData::get_instance()->eapi_from_string(
+ EAPIData::get_instance()->eapi_from_string(
_imp->params.profile_eapi)->supported()->package_dep_spec_parse_options(),
std::tr1::shared_ptr<const PackageID>())));
if (a->package_ptr())
@@ -612,7 +615,7 @@ ERepository::query_use(const UseFlagName & f, const PackageID & e) const
if (this != e.repository().get())
return use_unspecified;
- const erepository::ERepositoryID & id(static_cast<const erepository::ERepositoryID &>(e));
+ const ERepositoryID & id(static_cast<const ERepositoryID &>(e));
if (! id.eapi()->supported())
{
@@ -692,7 +695,7 @@ ERepository::query_use_mask(const UseFlagName & u, const PackageID & e) const
if (this != e.repository().get())
return use_unspecified;
- const erepository::ERepositoryID & id(static_cast<const erepository::ERepositoryID &>(e));
+ const ERepositoryID & id(static_cast<const ERepositoryID &>(e));
if (id.use_key())
{
return (id.use_key()->value()->end() == id.use_key()->value()->find(u));
@@ -710,7 +713,7 @@ ERepository::query_use_force(const UseFlagName & u, const PackageID & e) const
if (this != e.repository().get())
return use_unspecified;
- const erepository::ERepositoryID & id(static_cast<const erepository::ERepositoryID &>(e));
+ const ERepositoryID & id(static_cast<const ERepositoryID &>(e));
if (id.use_key())
{
return (id.use_key()->value()->end() != id.use_key()->value()->find(u));
@@ -893,7 +896,7 @@ ERepository::update_news() const
_imp->news_ptr->update_news();
}
-const std::tr1::shared_ptr<const erepository::Layout>
+const std::tr1::shared_ptr<const Layout>
ERepository::layout() const
{
return _imp->layout;
@@ -906,7 +909,7 @@ ERepository::profile() const
return _imp->profile_ptr;
}
-const std::tr1::shared_ptr<const erepository::ERepositoryEntries>
+const std::tr1::shared_ptr<const ERepositoryEntries>
ERepository::entries() const
{
return _imp->entries_ptr;
@@ -922,7 +925,7 @@ ERepository::get_environment_variable(
_imp->need_profiles();
- return _imp->entries_ptr->get_environment_variable(std::tr1::static_pointer_cast<const erepository::ERepositoryID>(for_package),
+ return _imp->entries_ptr->get_environment_variable(std::tr1::static_pointer_cast<const ERepositoryID>(for_package),
var, _imp->profile_ptr);
}
@@ -973,7 +976,7 @@ ERepository::use_expand_flags() const
{
_imp->need_profiles();
- std::string expand_sep(stringify(erepository::EAPIData::get_instance()->eapi_from_string(
+ std::string expand_sep(stringify(EAPIData::get_instance()->eapi_from_string(
_imp->params.profile_eapi)->supported()->ebuild_options()->use_expand_separator()));
std::tr1::shared_ptr<UseFlagNameSet> result(new UseFlagNameSet);
for (ERepositoryProfile::UseExpandConstIterator i(_imp->profile_ptr->begin_use_expand()),
@@ -1033,7 +1036,7 @@ ERepository::use_expand_separator(const PackageID & id) const
{
if (this != id.repository().get())
return '\0';
- const std::tr1::shared_ptr<const erepository::EAPI> & eapi(static_cast<const erepository::ERepositoryID &>(id).eapi());
+ const std::tr1::shared_ptr<const EAPI> & eapi(static_cast<const ERepositoryID &>(id).eapi());
return eapi->supported() ? eapi->supported()->ebuild_options()->use_expand_separator() : '\0';
}
@@ -1128,7 +1131,7 @@ ERepository::describe_use_flag(const UseFlagName & f,
if (_imp->use_desc.empty())
{
- std::string expand_sep(stringify(erepository::EAPIData::get_instance()->eapi_from_string(
+ std::string expand_sep(stringify(EAPIData::get_instance()->eapi_from_string(
_imp->params.profile_eapi)->supported()->ebuild_options()->use_expand_separator()));
std::tr1::shared_ptr<const UseDescFileInfoSequence> use_desc_info(_imp->layout->use_desc_files());
_imp->use_desc.push_back(std::tr1::shared_ptr<UseDesc>(new UseDesc(use_desc_info, expand_sep)));
@@ -1156,7 +1159,7 @@ ERepository::is_suitable_destination_for(const PackageID & e) const
{
std::string f(e.repository()->format_key() ? e.repository()->format_key()->value() : "");
if (f == "ebuild")
- return static_cast<const erepository::ERepositoryID &>(e).eapi()->supported()->can_be_pbin();
+ return static_cast<const ERepositoryID &>(e).eapi()->supported()->can_be_pbin();
else
return false;
}
@@ -1398,10 +1401,10 @@ ERepository::make_manifest(const QualifiedPackageName & qpn)
std::tr1::shared_ptr<const PackageID> id = (*v);
if (! id->fetches_key())
continue;
- paludis::erepository::AAVisitor aa;
+ AAVisitor aa;
id->fetches_key()->value()->accept(aa);
- for (paludis::erepository::AAVisitor::ConstIterator d(aa.begin()) ;
+ for (AAVisitor::ConstIterator d(aa.begin()) ;
d != aa.end() ; ++d)
{
if (done_files.count(*d))
@@ -1437,14 +1440,14 @@ ERepository::make_manifest(const QualifiedPackageName & qpn)
std::string
ERepository::accept_keywords_variable() const
{
- return erepository::EAPIData::get_instance()->eapi_from_string(params().profile_eapi)->supported()
+ return EAPIData::get_instance()->eapi_from_string(params().profile_eapi)->supported()
->ebuild_environment_variables()->env_accept_keywords();
}
std::string
ERepository::arch_variable() const
{
- return erepository::EAPIData::get_instance()->eapi_from_string(params().profile_eapi)->supported()
+ return EAPIData::get_instance()->eapi_from_string(params().profile_eapi)->supported()
->ebuild_environment_variables()->env_arch();
}
@@ -1602,8 +1605,9 @@ ERepository::repository_factory_create(
distdir = stringify((*master_repositories->begin())->params().distdir);
else
{
- distdir = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_distdir();
+ distdir = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_distdir();
if (distdir.empty())
distdir = location + "/distfiles";
else if ('/' != distdir.at(0))
@@ -1633,8 +1637,8 @@ ERepository::repository_factory_create(
std::string write_cache(f("write_cache"));
if (write_cache.empty())
- write_cache = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_write_cache();
+ write_cache = EExtraDistributionData::get_instance()->data_from_distribution(*DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_write_cache();
bool append_repository_name_to_write_cache(true);
if (! f("append_repository_name_to_write_cache").empty())
@@ -1655,8 +1659,9 @@ ERepository::repository_factory_create(
{
if (! layout_conf
|| (eapi_when_unknown = layout_conf->get("eapi_when_unknown")).empty())
- eapi_when_unknown = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_eapi_when_unknown();
+ eapi_when_unknown = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_eapi_when_unknown();
}
std::string eapi_when_unspecified(f("eapi_when_unspecified"));
@@ -1664,8 +1669,9 @@ ERepository::repository_factory_create(
{
if (! layout_conf
|| (eapi_when_unspecified = layout_conf->get("eapi_when_unspecified")).empty())
- eapi_when_unspecified = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_eapi_when_unspecified();
+ eapi_when_unspecified = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_eapi_when_unspecified();
}
std::string profile_eapi(f("profile_eapi"));
@@ -1673,15 +1679,17 @@ ERepository::repository_factory_create(
{
if (! layout_conf
|| (profile_eapi = layout_conf->get("eapi_when_unspecified")).empty())
- profile_eapi = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_profile_eapi();
+ profile_eapi = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_profile_eapi();
}
std::string names_cache(f("names_cache"));
if (names_cache.empty())
{
- names_cache = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_names_cache();
+ names_cache = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_names_cache();
if (names_cache.empty())
{
Log::get_instance()->message("e.ebuild.configuration.no_names_cache", ll_warning, lc_no_context)
@@ -1713,8 +1721,9 @@ ERepository::repository_factory_create(
if (master_repositories)
builddir = stringify((*master_repositories->begin())->params().builddir);
else
- builddir = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_builddir();
+ builddir = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_buildroot();
}
else
Log::get_instance()->message("e.ebuild.configuration.deprecated", ll_warning, lc_context)
@@ -1726,15 +1735,16 @@ ERepository::repository_factory_create(
{
if (! layout_conf
|| (layout = layout_conf->get("layout")).empty())
- layout = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_layout();
+ layout = EExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_layout();
}
- erepository::UseManifest use_manifest(erepository::manifest_use);
+ UseManifest use_manifest(manifest_use);
if (! f("use_manifest").empty())
{
Context item_context("When handling use_manifest key:");
- use_manifest = destringify<erepository::UseManifest>(f("use_manifest"));
+ use_manifest = destringify<UseManifest>(f("use_manifest"));
}
bool binary_destination(false);
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 4ef5b22..7789f7e 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -22,6 +22,7 @@
#include <paludis/repositories/e/ebuild.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/eapi_phase.hh>
+#include <paludis/repositories/e/extra_distribution_data.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/log.hh>
@@ -151,8 +152,8 @@ ExndbamRepository::repository_factory_create(
{
builddir = f("buildroot");
if (builddir.empty())
- builddir = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_builddir();
+ builddir = EExtraDistributionData::get_instance()->data_from_distribution(*DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_buildroot();
else
Log::get_instance()->message("e.exndbam.configuration.deprecated", ll_warning, lc_context)
<< "Key 'buildroot' is deprecated, use 'builddir' instead";
diff --git a/paludis/repositories/e/extra_distribution_data.cc b/paludis/repositories/e/extra_distribution_data.cc
new file mode 100644
index 0000000..6e2e086
--- /dev/null
+++ b/paludis/repositories/e/extra_distribution_data.cc
@@ -0,0 +1,57 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/extra_distribution_data.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/distribution-impl.hh>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace paludis
+{
+ template <>
+ struct ExtraDistributionDataData<EDistribution>
+ {
+ static std::string config_file_name()
+ {
+ return "e.conf";
+ }
+
+ static std::tr1::shared_ptr<EDistribution> make_data(const KeyValueConfigFile & k)
+ {
+ return make_shared_ptr(new EDistribution(make_named_values<EDistribution>(
+ value_for<n::default_buildroot>(k.get("default_buildroot")),
+ value_for<n::default_distdir>(k.get("default_distdir")),
+ value_for<n::default_eapi_when_unknown>(k.get("default_eapi_when_unknown")),
+ value_for<n::default_eapi_when_unspecified>(k.get("default_eapi_when_unspecified")),
+ value_for<n::default_layout>(k.get("default_layout")),
+ value_for<n::default_names_cache>(k.get("default_names_cache")),
+ value_for<n::default_profile_eapi>(k.get("default_profile_eapi")),
+ value_for<n::default_provides_cache>(k.get("default_provides_cache")),
+ value_for<n::default_write_cache>(k.get("default_write_cache"))
+ )));
+ }
+ };
+}
+
+template class ExtraDistributionData<EDistribution>;
+template class InstantiationPolicy<ExtraDistributionData<EDistribution>, instantiation_method::SingletonTag>;
+
diff --git a/paludis/repositories/e/extra_distribution_data.hh b/paludis/repositories/e/extra_distribution_data.hh
new file mode 100644
index 0000000..6071d43
--- /dev/null
+++ b/paludis/repositories/e/extra_distribution_data.hh
@@ -0,0 +1,61 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_EXTRA_DISTRIBUTION_DATA_HH
+#define PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_EXTRA_DISTRIBUTION_DATA_HH 1
+
+#include <paludis/distribution-fwd.hh>
+#include <paludis/util/named_value.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace n
+ {
+ struct default_buildroot;
+ struct default_distdir;
+ struct default_eapi_when_unknown;
+ struct default_eapi_when_unspecified;
+ struct default_layout;
+ struct default_names_cache;
+ struct default_profile_eapi;
+ struct default_provides_cache;
+ struct default_write_cache;
+ }
+
+ namespace erepository
+ {
+ struct EDistribution
+ {
+ NamedValue<n::default_buildroot, std::string> default_buildroot;
+ NamedValue<n::default_distdir, std::string> default_distdir;
+ NamedValue<n::default_eapi_when_unknown, std::string> default_eapi_when_unknown;
+ NamedValue<n::default_eapi_when_unspecified, std::string> default_eapi_when_unspecified;
+ NamedValue<n::default_layout, std::string> default_layout;
+ NamedValue<n::default_names_cache, std::string> default_names_cache;
+ NamedValue<n::default_profile_eapi, std::string> default_profile_eapi;
+ NamedValue<n::default_provides_cache, std::string> default_provides_cache;
+ NamedValue<n::default_write_cache, std::string> default_write_cache;
+ };
+
+ typedef ExtraDistributionData<EDistribution> EExtraDistributionData;
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 1c1d4b5..be7f276 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -27,6 +27,7 @@
#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/e_repository_params.hh>
#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/extra_distribution_data.hh>
#include <paludis/action.hh>
#include <paludis/util/config_file.hh>
@@ -305,8 +306,8 @@ VDBRepository::repository_factory_create(
std::string provides_cache(f("provides_cache"));
if (provides_cache.empty())
{
- provides_cache = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_vdb_provides_cache();
+ provides_cache = EExtraDistributionData::get_instance()->data_from_distribution(*DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_provides_cache();
if (provides_cache.empty())
{
Log::get_instance()->message("e.vdb.configuration.no_provides_cache", ll_warning, lc_no_context)
@@ -319,8 +320,8 @@ VDBRepository::repository_factory_create(
std::string names_cache(f("names_cache"));
if (names_cache.empty())
{
- names_cache = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_vdb_names_cache();
+ names_cache = EExtraDistributionData::get_instance()->data_from_distribution(*DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_names_cache();
if (names_cache.empty())
{
Log::get_instance()->message("e.vdb.configuration.no_names_cache", ll_warning, lc_no_context)
@@ -335,8 +336,8 @@ VDBRepository::repository_factory_create(
{
builddir = f("buildroot");
if (builddir.empty())
- builddir = (*DistributionData::get_instance()->distribution_from_string(
- env->distribution())).default_ebuild_builddir();
+ builddir = EExtraDistributionData::get_instance()->data_from_distribution(*DistributionData::get_instance()->distribution_from_string(
+ env->distribution()))->default_buildroot();
else
Log::get_instance()->message("e.vdb.configuration.deprecated", ll_warning, lc_context)
<< "Key 'buildroot' is deprecated, use 'builddir' instead";
diff --git a/paludis/repositories/gems/Makefile.am b/paludis/repositories/gems/Makefile.am
index 0793818..0f8a606 100644
--- a/paludis/repositories/gems/Makefile.am
+++ b/paludis/repositories/gems/Makefile.am
@@ -25,7 +25,8 @@ paludis_repositories_gems_include_HEADERS = \
yaml.hh yaml-fwd.hh \
gem_specification.hh gem_specification-fwd.hh \
gem_specifications.hh \
- params-fwd.hh params.hh params-sr.hh
+ params-fwd.hh params.hh params-sr.hh \
+ extra_distribution_data.hh
libpaludisgemsrepository_@PALUDIS_PC_SLOT@_la_SOURCES = \
gems_repository.cc \
@@ -35,6 +36,7 @@ libpaludisgemsrepository_@PALUDIS_PC_SLOT@_la_SOURCES = \
yaml.cc \
gem_specification.cc \
gem_specifications.cc \
+ extra_distribution_data.cc \
registration.cc \
$(paludis_repositories_gems_include_HEADERS)
diff --git a/paludis/repositories/gems/extra_distribution_data.cc b/paludis/repositories/gems/extra_distribution_data.cc
new file mode 100644
index 0000000..5d8de49
--- /dev/null
+++ b/paludis/repositories/gems/extra_distribution_data.cc
@@ -0,0 +1,50 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/gems/extra_distribution_data.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/distribution-impl.hh>
+
+using namespace paludis;
+using namespace paludis::gems;
+
+namespace paludis
+{
+ template <>
+ struct ExtraDistributionDataData<GemsDistribution>
+ {
+ static std::string config_file_name()
+ {
+ return "gems.conf";
+ }
+
+ static std::tr1::shared_ptr<GemsDistribution> make_data(const KeyValueConfigFile & k)
+ {
+ return make_shared_ptr(new GemsDistribution(make_named_values<GemsDistribution>(
+ value_for<n::default_buildroot>(k.get("default_buildroot"))
+ )));
+ }
+ };
+}
+
+template class ExtraDistributionData<GemsDistribution>;
+template class InstantiationPolicy<ExtraDistributionData<GemsDistribution>, instantiation_method::SingletonTag>;
+
+
diff --git a/paludis/repositories/gems/extra_distribution_data.hh b/paludis/repositories/gems/extra_distribution_data.hh
new file mode 100644
index 0000000..5f8c211
--- /dev/null
+++ b/paludis/repositories/gems/extra_distribution_data.hh
@@ -0,0 +1,45 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008 Ciaran McCreesh
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_EXTRA_DISTRIBUTION_DATA_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_EXTRA_DISTRIBUTION_DATA_HH 1
+
+#include <paludis/distribution-fwd.hh>
+#include <paludis/util/named_value.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace n
+ {
+ struct default_buildroot;
+ }
+
+ namespace gems
+ {
+ struct GemsDistribution
+ {
+ NamedValue<n::default_buildroot, std::string> default_buildroot;
+ };
+
+ typedef ExtraDistributionData<GemsDistribution> GemsExtraDistributionData;
+ }
+}
+
+#endif
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index 6ec4c24..6ab1d3c 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -23,6 +23,7 @@
#include <paludis/repositories/gems/gem_specification.hh>
#include <paludis/repositories/gems/gem_specifications.hh>
#include <paludis/repositories/gems/exceptions.hh>
+#include <paludis/repositories/gems/extra_distribution_data.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
@@ -382,7 +383,8 @@ GemsRepository::repository_factory_create(
std::string builddir(f("builddir"));
if (builddir.empty())
- builddir = (*DistributionData::get_instance()->distribution_from_string(env->distribution())).default_ebuild_builddir();
+ builddir = gems::GemsExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(env->distribution()))->default_buildroot();
return make_shared_ptr(new GemsRepository(gems::RepositoryParams::create()
.location(location)
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index fda9d7d..d24b0df 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -22,6 +22,7 @@
#include <paludis/repositories/gems/gem_specification.hh>
#include <paludis/repositories/gems/yaml.hh>
#include <paludis/repositories/gems/exceptions.hh>
+#include <paludis/repositories/gems/extra_distribution_data.hh>
#include <paludis/package_database.hh>
#include <paludis/environment.hh>
#include <paludis/util/stringify.hh>
@@ -406,7 +407,8 @@ InstalledGemsRepository::repository_factory_create(
std::string builddir(f("builddir"));
if (builddir.empty())
- builddir = (*DistributionData::get_instance()->distribution_from_string(env->distribution())).default_ebuild_builddir();
+ builddir = gems::GemsExtraDistributionData::get_instance()->data_from_distribution(
+ *DistributionData::get_instance()->distribution_from_string(env->distribution()))->default_buildroot();
std::string root(f("root"));
if (root.empty())