diff options
35 files changed, 375 insertions, 50 deletions
diff --git a/configure.ac b/configure.ac index f51ced422..fb80939d4 100644 --- a/configure.ac +++ b/configure.ac @@ -886,6 +886,17 @@ AC_SUBST([ALL_ENVIRONMENTS]) AC_SUBST([BUILD_ENVIRONMENTS]) dnl }}} +dnl {{{ distribution +AC_MSG_CHECKING([for default distribution]) +AC_ARG_WITH([default-distribution], + AS_HELP_STRING([--with-default-distribution=distro], [Specify default distribution name]), + DEFAULT_DISTRIBUTION=`eval echo $withval`, + DEFAULT_DISTRIBUTION=gentoo) +AC_MSG_RESULT([$DEFAULT_DISTRIBUTION]) +AC_SUBST([DEFAULT_DISTRIBUTION]) +AC_DEFINE_UNQUOTED([DEFAULT_DISTRIBUTION], "$DEFAULT_DISTRIBUTION", [Default distribution name]) +dnl }}} + dnl {{{ clients ALL_CLIENTS="adjutrix contrarius inquisitio paludis qualudis" DEFAULT_CLIENTS="adjutrix paludis" @@ -1065,6 +1076,7 @@ AC_OUTPUT( paludis/args/Makefile paludis/dep_list/Makefile paludis/digests/Makefile + paludis/distributions/Makefile paludis/eapis/Makefile paludis/environments/Makefile paludis/environments/adapted/Makefile diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4 index 5469b0ae1..79cd839e1 100644 --- a/paludis/Makefile.am.m4 +++ b/paludis/Makefile.am.m4 @@ -82,7 +82,7 @@ DEFS= \ EXTRA_DIST = about.hh.in Makefile.am.m4 paludis.hh.m4 files.m4 \ hashed_containers.hh.in testscriptlist srlist srcleanlist selist secleanlist \ repository_blacklist.txt hooker.bash -SUBDIRS = digests eapis fetchers syncers util selinux . dep_list merger repositories environments args qa tasks +SUBDIRS = digests distributions eapis fetchers syncers util selinux . dep_list merger repositories environments args qa tasks BUILT_SOURCES = srcleanlist secleanlist libpaludis_la_SOURCES = filelist @@ -157,6 +157,7 @@ built-sources : $(BUILT_SOURCES) TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/gentoo/ebuild/" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_HOOKER_DIR="$(top_srcdir)/paludis/" \ PALUDIS_OUTPUTWRAPPER_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \ PALUDIS_SKIP_CONFIG="yes" \ diff --git a/paludis/dep_list/Makefile.am b/paludis/dep_list/Makefile.am index fff1af5bf..47a9abda8 100644 --- a/paludis/dep_list/Makefile.am +++ b/paludis/dep_list/Makefile.am @@ -64,6 +64,7 @@ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \ PALUDIS_SKIP_CONFIG="yes" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ TEST_SCRIPT_DIR="$(srcdir)/" \ bash $(top_srcdir)/test/run_test.sh diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc index 8db1b9bfc..e91aa9325 100644 --- a/paludis/dep_list/dep_list.cc +++ b/paludis/dep_list/dep_list.cc @@ -25,6 +25,7 @@ #include <paludis/dep_list/range_rewriter.hh> #include <paludis/dep_list/query_visitor.hh> #include <paludis/dep_list/show_suggest_visitor.hh> +#include <paludis/distribution.hh> #include <paludis/match_package.hh> #include <paludis/query.hh> #include <paludis/hashed_containers.hh> @@ -1019,6 +1020,11 @@ DepList::add_package(const PackageDatabaseEntry & p, tr1::shared_ptr<const DepTa { DepSpecFlattener f(_imp->env, _imp->current_pde()); metadata->ebuild_interface->provide()->accept(f); + + if (f.begin() != f.end() && ! DistributionData::get_instance()->default_distribution()->support_old_style_virtuals) + throw DistributionConfigurationError("Package '" + stringify(p) + "' has PROVIDEs, but this distribution " + "does not support old style virtuals"); + for (DepSpecFlattener::Iterator i(f.begin()), i_end(f.end()) ; i != i_end ; ++i) { tr1::shared_ptr<VersionRequirements> v(new VersionRequirements::Concrete); diff --git a/paludis/distribution-fwd.hh b/paludis/distribution-fwd.hh new file mode 100644 index 000000000..cb454445c --- /dev/null +++ b/paludis/distribution-fwd.hh @@ -0,0 +1,30 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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_FWD_HH +#define PALUDIS_GUARD_PALUDIS_DISTRIBUTION_FWD_HH 1 + +namespace paludis +{ + class Distribution; + class DistributionData; + class DistributionConfigurationError; +} + +#endif diff --git a/paludis/distribution.cc b/paludis/distribution.cc new file mode 100644 index 000000000..8d7b62ba4 --- /dev/null +++ b/paludis/distribution.cc @@ -0,0 +1,108 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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/distribution.hh> +#include <paludis/hashed_containers.hh> +#include <paludis/config_file.hh> +#include <paludis/util/destringify.hh> +#include <paludis/util/dir_iterator.hh> +#include <paludis/util/is_file_with_extension.hh> +#include <paludis/util/system.hh> +#include <paludis/util/make_shared_ptr.hh> +#include <paludis/util/strip.hh> +#include "config.h" + +using namespace paludis; + +#include <paludis/distribution-sr.cc> + +DistributionConfigurationError::DistributionConfigurationError(const std::string & s) throw () : + ConfigurationError("Distribution configuration error: " + s) +{ +} + +namespace paludis +{ + template <> + struct Implementation<DistributionData> + { + MakeHashedMap<std::string, tr1::shared_ptr<const Distribution> >::Type values; + mutable tr1::shared_ptr<const Distribution> default_distribution; + + Implementation() + { + Context c("When loading distribution data:"); + + for (DirIterator d(getenv_with_default("PALUDIS_DISTRIBUTIONS_DIR", DATADIR "/paludis/distributions")), d_end ; + d != d_end ; ++d) + { + if (! is_file_with_extension(*d, ".conf", IsFileWithOptions())) + continue; + + Context cc("When loading distribution file '" + stringify(*d) + "':"); + + KeyValueConfigFile k(*d, KeyValueConfigFileOptions()); + + values.insert(std::make_pair(strip_trailing_string(d->basename(), ".conf"), + make_shared_ptr(new Distribution(Distribution::create() + .default_environment(k.get("default_environment")) + .fallback_environment(k.get("fallback_environment")) + .support_old_style_virtuals(destringify<bool>(k.get("support_old_style_virtuals"))) + .default_ebuild_distdir(k.get("default_ebuild_distdir")) + .default_ebuild_write_cache(k.get("default_ebuild_write_cache")) + .default_ebuild_names_cache(k.get("default_ebuild_names_cache")) + .default_ebuild_build_root(k.get("default_ebuild_build_root")) + .default_ebuild_layout(k.get("default_ebuild_layout")) + )))); + } + } + }; +} + +DistributionData::DistributionData() : + PrivateImplementationPattern<DistributionData>(new Implementation<DistributionData>) +{ +} + +DistributionData::~DistributionData() +{ +} + +tr1::shared_ptr<const Distribution> +DistributionData::distribution_from_string(const std::string & s) const +{ + MakeHashedMap<std::string, tr1::shared_ptr<const Distribution> >::Type::const_iterator i(_imp->values.find(s)); + if (i == _imp->values.end()) + return tr1::shared_ptr<const Distribution>(); + else + return i->second; +} + +tr1::shared_ptr<const Distribution> +DistributionData::default_distribution() const +{ + if (_imp->default_distribution) + return _imp->default_distribution; + + _imp->default_distribution = distribution_from_string(getenv_with_default("PALUDIS_DISTRIBUTION", DEFAULT_DISTRIBUTION)); + if (! _imp->default_distribution) + throw DistributionConfigurationError("No default distribution configuration available"); + return _imp->default_distribution; +} + diff --git a/paludis/distribution.hh b/paludis/distribution.hh new file mode 100644 index 000000000..b9bcfd5a3 --- /dev/null +++ b/paludis/distribution.hh @@ -0,0 +1,58 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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_HH +#define PALUDIS_GUARD_PALUDIS_DISTRIBUTION_HH 1 + +#include <paludis/distribution-fwd.hh> +#include <paludis/util/attributes.hh> +#include <paludis/util/exception.hh> +#include <paludis/util/sr.hh> +#include <paludis/util/private_implementation_pattern.hh> +#include <paludis/util/instantiation_policy.hh> + +namespace paludis +{ +#include <paludis/distribution-sr.hh> + + class PALUDIS_VISIBLE DistributionConfigurationError : + public ConfigurationError + { + public: + DistributionConfigurationError(const std::string &) throw (); + }; + + class PALUDIS_VISIBLE DistributionData : + private PrivateImplementationPattern<DistributionData>, + public InstantiationPolicy<DistributionData, instantiation_method::SingletonTag> + { + friend class InstantiationPolicy<DistributionData, instantiation_method::SingletonTag>; + + private: + DistributionData(); + ~DistributionData(); + + public: + tr1::shared_ptr<const Distribution> distribution_from_string(const std::string &) const; + + tr1::shared_ptr<const Distribution> default_distribution() const; + }; +} + +#endif diff --git a/paludis/distribution.sr b/paludis/distribution.sr new file mode 100644 index 000000000..215b357ce --- /dev/null +++ b/paludis/distribution.sr @@ -0,0 +1,27 @@ +make_class_Distribution() +{ + visible + + key default_environment std::string + key fallback_environment std::string + + key support_old_style_virtuals bool + + key default_ebuild_distdir std::string + key default_ebuild_write_cache std::string + key default_ebuild_names_cache std::string + key default_ebuild_build_root std::string + key default_ebuild_layout std::string + + allow_named_args + + doxygen_comment << "END" + /** + * Information about a distribution. + * + * \see DistributionData + * \nosubgrouping + */ +END +} + diff --git a/paludis/distributions/Makefile.am b/paludis/distributions/Makefile.am new file mode 100644 index 000000000..90da1a102 --- /dev/null +++ b/paludis/distributions/Makefile.am @@ -0,0 +1,17 @@ +MAINTAINERCLEANFILES = Makefile.in +CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda .keep +SUBDIRS = + +distributions = \ + gentoo.conf + +distributionsdir = $(datadir)/paludis/distributions/ + +distributions_DATA = $(distributions) + +EXTRA_DIST = $(distributions) + +built-sources : $(BUILT_SOURCES) + for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done + + diff --git a/paludis/distributions/gentoo.conf b/paludis/distributions/gentoo.conf new file mode 100644 index 000000000..211d60a6f --- /dev/null +++ b/paludis/distributions/gentoo.conf @@ -0,0 +1,12 @@ +# Configuration for Gentoo + +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_build_root = /var/tmp/paludis +default_ebuild_layout = traditional + diff --git a/paludis/environments/environment_maker.cc b/paludis/environments/environment_maker.cc index 28dc960ad..142a9ca04 100644 --- a/paludis/environments/environment_maker.cc +++ b/paludis/environments/environment_maker.cc @@ -23,6 +23,7 @@ #include <paludis/util/is_file_with_extension.hh> #include <paludis/util/system.hh> #include <paludis/util/virtual_constructor-impl.hh> +#include <paludis/distribution.hh> #include <paludis/about.hh> #include <list> #include <set> @@ -145,7 +146,7 @@ EnvironmentMaker::make_from_spec(const std::string & s) const } if (key.empty()) - key = "paludis"; + key = DistributionData::get_instance()->default_distribution()->default_environment; try { @@ -153,12 +154,13 @@ EnvironmentMaker::make_from_spec(const std::string & s) const } catch (const FallBackToAnotherMakerError &) { - if (s.empty()) + std::string f(DistributionData::get_instance()->default_distribution()->fallback_environment); + if (s.empty() && ! f.empty()) { std::set<std::string> keys; copy_keys(std::inserter(keys, keys.begin())); - if (keys.end() != keys.find("portage")) - return make_from_spec("portage"); + if (keys.end() != keys.find(f)) + return make_from_spec(f); else throw; } diff --git a/paludis/environments/no_config/Makefile.am b/paludis/environments/no_config/Makefile.am index cb852c82f..3fc49d99f 100644 --- a/paludis/environments/no_config/Makefile.am +++ b/paludis/environments/no_config/Makefile.am @@ -50,6 +50,8 @@ TESTS = no_config_environment_TEST TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \ + PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_SKIP_CONFIG="yes" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ TEST_SCRIPT_DIR="$(srcdir)/" \ diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc index f6fc31b16..6635cd041 100644 --- a/paludis/environments/no_config/no_config_environment.cc +++ b/paludis/environments/no_config/no_config_environment.cc @@ -24,6 +24,7 @@ #include <paludis/util/dir_iterator.hh> #include <paludis/repositories/repository_maker.hh> #include <paludis/config_file.hh> +#include <paludis/distribution.hh> #include <paludis/package_database.hh> #include <set> @@ -160,8 +161,10 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env) package_database->add_repository(2, ((main_repo = RepositoryMaker::get_instance()->find_maker("ebuild")(env, keys)))); - package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("virtuals")(env, - tr1::shared_ptr<AssociativeCollection<std::string, std::string> >())); + + if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals) + package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("virtuals")(env, + tr1::shared_ptr<AssociativeCollection<std::string, std::string> >())); } else { @@ -180,8 +183,10 @@ Implementation<NoConfigEnvironment>::initialise(NoConfigEnvironment * const env) tr1::shared_ptr<AssociativeCollection<std::string, std::string> > iv_keys( new AssociativeCollection<std::string, std::string>::Concrete); iv_keys->insert("root", "/"); - package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("installed_virtuals")(env, - iv_keys)); + + if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals) + package_database->add_repository(-2, RepositoryMaker::get_instance()->find_maker("installed_virtuals")(env, + iv_keys)); } } diff --git a/paludis/environments/paludis/Makefile.am b/paludis/environments/paludis/Makefile.am index 97bcce6be..8707a57d6 100644 --- a/paludis/environments/paludis/Makefile.am +++ b/paludis/environments/paludis/Makefile.am @@ -71,6 +71,8 @@ TESTS = paludis_environment_TEST TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \ + PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_SKIP_CONFIG="yes" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ TEST_SCRIPT_DIR="$(srcdir)/" \ diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc index 041c1d470..21e43c224 100644 --- a/paludis/environments/paludis/paludis_config.cc +++ b/paludis/environments/paludis/paludis_config.cc @@ -26,6 +26,7 @@ #include <paludis/environments/paludis/package_mask_conf.hh> #include <paludis/config_file.hh> +#include <paludis/distribution.hh> #include <paludis/util/collection_concrete.hh> #include <paludis/util/destringify.hh> #include <paludis/util/dir_iterator.hh> @@ -253,19 +254,23 @@ PaludisConfig::PaludisConfig(PaludisEnvironment * const e, const std::string & s { /* add virtuals repositories */ - tr1::shared_ptr<AssociativeCollection<std::string, std::string> > iv_keys( - new AssociativeCollection<std::string, std::string>::Concrete); - iv_keys->insert("root", root_prefix.empty() ? "/" : root_prefix); - _imp->repos.push_back(RepositoryConfigEntry("installed_virtuals", -1, iv_keys)); + if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals) + { + tr1::shared_ptr<AssociativeCollection<std::string, std::string> > iv_keys( + new AssociativeCollection<std::string, std::string>::Concrete); + iv_keys->insert("root", root_prefix.empty() ? "/" : root_prefix); + _imp->repos.push_back(RepositoryConfigEntry("installed_virtuals", -1, iv_keys)); - _imp->repos.push_back(RepositoryConfigEntry("virtuals", -2, - tr1::shared_ptr<AssociativeCollection<std::string, std::string> >())); + _imp->repos.push_back(RepositoryConfigEntry("virtuals", -2, + tr1::shared_ptr<AssociativeCollection<std::string, std::string> >())); + } /* add normal repositories */ if ((local_config_dir / "repository_defaults.conf").exists()) { - KeyValueConfigFile defaults_file(local_config_dir / "repository_defaults.conf", KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)); + KeyValueConfigFile defaults_file(local_config_dir / "repository_defaults.conf", KeyValueConfigFileOptions(), + KeyValueConfigFile::Defaults(conf_vars)); std::copy(defaults_file.begin(), defaults_file.end(), conf_vars->inserter()); } else if ((local_config_dir / "repository_defaults.bash").exists()) diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc index 18d6f9644..0b083e8d7 100644 --- a/paludis/environments/paludis/paludis_environment.cc +++ b/paludis/environments/paludis/paludis_environment.cc @@ -30,6 +30,7 @@ #include <paludis/config_file.hh> #include <paludis/hooker.hh> #include <paludis/set_file.hh> +#include <paludis/distribution.hh> #include <paludis/util/collection_concrete.hh> #include <paludis/util/log.hh> diff --git a/paludis/environments/portage/Makefile.am b/paludis/environments/portage/Makefile.am index 12af8916e..290cda50d 100644 --- a/paludis/environments/portage/Makefile.am +++ b/paludis/environments/portage/Makefile.am @@ -44,6 +44,8 @@ TESTS = portage_environment_TEST TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \ PALUDIS_SKIP_CONFIG="yes" \ + PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ TEST_SCRIPT_DIR="$(srcdir)/" \ SYSCONFDIR="$(sysconfdir)" \ diff --git a/paludis/files.m4 b/paludis/files.m4 index 4272ebbd6..f10a12520 100644 --- a/paludis/files.m4 +++ b/paludis/files.m4 @@ -15,6 +15,7 @@ add(`dep_spec', `hh', `cc', `se', `test', `fwd') add(`dep_spec_flattener', `hh', `cc') add(`dep_spec_pretty_printer', `hh', `cc', `test') add(`dep_tag', `hh', `cc', `sr') +add(`distribution', `hh', `cc', `fwd', `sr') add(`eapi', `hh', `cc', `fwd', `sr') add(`environment', `hh', `cc', `se') add(`environment_implementation', `hh', `cc', `test') diff --git a/paludis/merger/Makefile.am b/paludis/merger/Makefile.am index 53725d344..e279289e8 100644 --- a/paludis/merger/Makefile.am +++ b/paludis/merger/Makefile.am @@ -48,6 +48,7 @@ TESTS = \ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/gentoo/ebuild/" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_SKIP_CONFIG="yes" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ PALUDIS_HOOKER_DIR="$(top_srcdir)/paludis/" \ diff --git a/paludis/qa/Makefile.am.m4 b/paludis/qa/Makefile.am.m4 index 2bfd64419..00354cb41 100644 --- a/paludis/qa/Makefile.am.m4 +++ b/paludis/qa/Makefile.am.m4 @@ -81,6 +81,7 @@ TESTS = testlist TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/gentoo/ebuild/" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_SKIP_CONFIG="yes" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ TEST_SCRIPT_DIR="$(srcdir)/" \ diff --git a/paludis/repositories/cran/Makefile.am b/paludis/repositories/cran/Makefile.am index 65a1f4427..2df63107c 100644 --- a/paludis/repositories/cran/Makefile.am +++ b/paludis/repositories/cran/Makefile.am @@ -99,6 +99,7 @@ TESTS_ENVIRONMENT = env \ CRAN_BASH_DIR="$(top_srcdir)/paludis/repositories/cran/cran/" \ PALUDIS_SKIP_CONFIG="yes" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ TEST_SCRIPT_DIR="$(srcdir)/" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ bash $(top_srcdir)/test/run_test.sh diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc index cee51fa60..e9a42a6f7 100644 --- a/paludis/repositories/fake/fake_repository.cc +++ b/paludis/repositories/fake/fake_repository.cc @@ -20,6 +20,7 @@ #include "fake_repository.hh" #include <paludis/util/collection_concrete.hh> #include <paludis/portage_dep_parser.hh> +#include <paludis/distribution.hh> using namespace paludis; @@ -37,7 +38,7 @@ FakeRepository::FakeRepository(const Environment * const e, const RepositoryName .mirrors_interface(0) .environment_variable_interface(0) .provides_interface(0) - .virtuals_interface(this) + .virtuals_interface(DistributionData::get_instance()->default_distribution()->support_old_style_virtuals ? this : 0) .config_interface(0) .destination_interface(0) .licenses_interface(0) diff --git a/paludis/repositories/gentoo/Makefile.am b/paludis/repositories/gentoo/Makefile.am index 803a87256..97436bc4b 100644 --- a/paludis/repositories/gentoo/Makefile.am +++ b/paludis/repositories/gentoo/Makefile.am @@ -214,6 +214,7 @@ check_SCRIPTS = \ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_SKIP_CONFIG="yes" \ TEST_SCRIPT_DIR="$(srcdir)/" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ diff --git a/paludis/repositories/gentoo/ebuild/Makefile.am b/paludis/repositories/gentoo/ebuild/Makefile.am index 58630e551..64ea73078 100644 --- a/paludis/repositories/gentoo/ebuild/Makefile.am +++ b/paludis/repositories/gentoo/ebuild/Makefile.am @@ -51,6 +51,7 @@ libexecprog_SCRIPTS = \ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/gentoo/ebuild/" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_EBUILD_LOG_LEVEL="warning" \ TOP_BUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/`" \ TEST_SCRIPT_DIR="$(srcdir)/" \ diff --git a/paludis/repositories/gentoo/make_ebuild_repository.cc b/paludis/repositories/gentoo/make_ebuild_repository.cc index 44522ec9b..1e41c1882 100644 --- a/paludis/repositories/gentoo/make_ebuild_repository.cc +++ b/paludis/repositories/gentoo/make_ebuild_repository.cc @@ -23,6 +23,7 @@ #include <paludis/util/tokeniser.hh> #include <paludis/repositories/gentoo/portage_repository_exceptions.hh> #include <paludis/environment.hh> +#include <paludis/distribution.hh> using namespace paludis; @@ -99,7 +100,13 @@ paludis::make_ebuild_repository( if (master_repository) distdir = stringify(master_repository->params().distdir); else - distdir = location + "/distfiles"; + { + distdir = DistributionData::get_instance()->default_distribution()->default_ebuild_distdir; + if (distdir.empty()) + distdir = location + "/distfiles"; + else if ('/' != distdir.at(0)) + distdir = location + "/" + distdir; + } } std::string pkgdir; @@ -133,15 +140,19 @@ paludis::make_ebuild_repository( std::string write_cache; if (m->end() == m->find("write_cache") || ((write_cache = m->find("write_cache")->second)).empty()) - write_cache = "/var/empty"; + write_cache = DistributionData::get_instance()->default_distribution()->default_ebuild_write_cache; std::string names_cache; if (m->end() == m->find("names_cache") || ((names_cache = m->find("names_cache")->second)).empty()) { - Log::get_instance()->message(ll_warning, lc_no_context, "The names_cache key is not set in '" - + repo_file + "'. You should read http://paludis.pioto.org/cachefiles.html and select an " - "appropriate value."); - names_cache = "/var/empty"; + names_cache = DistributionData::get_instance()->default_distribution()->default_ebuild_names_cache; + if (names_cache.empty()) + { + Log::get_instance()->message(ll_warning, lc_no_context, "The names_cache key is not set in '" + + repo_file + "'. You should read http://paludis.pioto.org/cachefiles.html and select an " + "appropriate value."); + names_cache = "/var/empty"; + } } std::string sync; @@ -163,11 +174,11 @@ paludis::make_ebuild_repository( std::string buildroot; if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty()) - buildroot = "/var/tmp/paludis"; + buildroot = DistributionData::get_instance()->default_distribution()->default_ebuild_build_root; std::string layout; if (m->end() == m->find("layout") || ((layout = m->find("layout")->second)).empty()) - layout = "traditional"; + layout = DistributionData::get_instance()->default_distribution()->default_ebuild_layout; return tr1::shared_ptr<PortageRepository>(new PortageRepository(PortageRepositoryParams::create() .entry_format("ebuild") diff --git a/paludis/repositories/gentoo/portage_repository.cc b/paludis/repositories/gentoo/portage_repository.cc index c205f9fa8..df1965aa7 100644 --- a/paludis/repositories/gentoo/portage_repository.cc +++ b/paludis/repositories/gentoo/portage_repository.cc @@ -31,6 +31,7 @@ #include <paludis/repositories/gentoo/layout.hh> #include <paludis/config_file.hh> +#include <paludis/distribution.hh> #include <paludis/dep_spec.hh> #include <paludis/dep_spec_flattener.hh> #include <paludis/environment.hh> @@ -258,7 +259,7 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) : .world_interface(0) .environment_variable_interface(this) .mirrors_interface(this) - .virtuals_interface(this) + .virtuals_interface(DistributionData::get_instance()->default_distribution()->support_old_style_virtuals ? this : 0) .provides_interface(0) .contents_interface(0) .config_interface(0) @@ -916,9 +917,10 @@ PortageRepository::set_profile(const ProfilesIterator & iter) _imp->profile_ptr = iter->profile; - if (_imp->params.environment->package_database()->has_repository_named(RepositoryName("virtuals"))) - _imp->params.environment->package_database()->fetch_repository( - RepositoryName("virtuals"))->invalidate(); + if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals) + if (_imp->params.environment->package_database()->has_repository_named(RepositoryName("virtuals"))) + _imp->params.environment->package_database()->fetch_repository( + RepositoryName("virtuals"))->invalidate(); } void diff --git a/paludis/repositories/gentoo/portage_repository_profile.cc b/paludis/repositories/gentoo/portage_repository_profile.cc index a7ed04074..b0685f7d2 100644 --- a/paludis/repositories/gentoo/portage_repository_profile.cc +++ b/paludis/repositories/gentoo/portage_repository_profile.cc @@ -32,6 +32,7 @@ #include <paludis/match_package.hh> #include <paludis/hashed_containers.hh> #include <paludis/version_metadata.hh> +#include <paludis/distribution.hh> #include <list> #include <algorithm> @@ -215,7 +216,8 @@ Implementation<PortageRepositoryProfile>::load_profile_directory_recursively(con load_spec_use_file(dir / "package.use.force", stacked_values_list.back().package_use_force); packages_file.add_file(dir / "packages"); - virtuals_file.add_file(dir / "virtuals"); + if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals) + virtuals_file.add_file(dir / "virtuals"); package_mask_file.add_file(dir / "package.mask"); } @@ -396,27 +398,28 @@ Implementation<PortageRepositoryProfile>::make_vars_from_file_vars() " failed due to exception: " + e.message() + " (" + e.what() + ")"); } - try - { - for (ProfileFile::Iterator line(virtuals_file.begin()), line_end(virtuals_file.end()) ; - line != line_end ; ++line) + if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals) + try { - std::vector<std::string> tokens; - WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens)); - if (tokens.size() < 2) - continue; + for (ProfileFile::Iterator line(virtuals_file.begin()), line_end(virtuals_file.end()) ; + line != line_end ; ++line) + { + std::vector<std::string> tokens; + WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens)); + if (tokens.size() < 2) + continue; - QualifiedPackageName v(tokens[0]); - virtuals.erase(v); - virtuals.insert(std::make_pair(v, tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(tokens[1], - pds_pm_eapi_0)))); + QualifiedPackageName v(tokens[0]); + virtuals.erase(v); + virtuals.insert(std::make_pair(v, tr1::shared_ptr<PackageDepSpec>(new PackageDepSpec(tokens[1], + pds_pm_eapi_0)))); + } + } + catch (const Exception & e) + { + Log::get_instance()->message(ll_warning, lc_context, "Loading virtuals " + " failed due to exception: " + e.message() + " (" + e.what() + ")"); } - } - catch (const Exception & e) - { - Log::get_instance()->message(ll_warning, lc_context, "Loading virtuals " - " failed due to exception: " + e.message() + " (" + e.what() + ")"); - } for (ProfileFile::Iterator line(package_mask_file.begin()), line_end(package_mask_file.end()) ; line != line_end ; ++line) diff --git a/paludis/repositories/virtuals/registration.cc b/paludis/repositories/virtuals/registration.cc index 67d0f0e79..4012108e5 100644 --- a/paludis/repositories/virtuals/registration.cc +++ b/paludis/repositories/virtuals/registration.cc @@ -20,6 +20,7 @@ #include <paludis/repositories/repository_maker.hh> #include <paludis/repositories/virtuals/installed_virtuals_repository.hh> #include <paludis/repositories/virtuals/virtuals_repository.hh> +#include <paludis/distribution.hh> #include "config.h" using namespace paludis; @@ -33,8 +34,11 @@ extern "C" void register_repositories(RepositoryMaker * maker) { - maker->register_maker("virtuals", &VirtualsRepository::make_virtuals_repository); - maker->register_maker("installed_virtuals", &InstalledVirtualsRepository::make_installed_virtuals_repository); + if (DistributionData::get_instance()->default_distribution()->support_old_style_virtuals) + { + maker->register_maker("virtuals", &VirtualsRepository::make_virtuals_repository); + maker->register_maker("installed_virtuals", &InstalledVirtualsRepository::make_installed_virtuals_repository); + } } #endif diff --git a/python/Makefile.am b/python/Makefile.am index d0c975ecf..cf6bd22ba 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -76,6 +76,7 @@ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \ PALUDIS_ENVIRONMENT_SO_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/environments`" \ SYSCONFDIR="$(sysconfdir)" \ diff --git a/ruby/Makefile.am b/ruby/Makefile.am index d43926fc9..264934c1d 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -90,6 +90,7 @@ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \ PALUDIS_ENVIRONMENT_SO_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/environments`" \ SYSCONFDIR="$(sysconfdir)" \ diff --git a/ruby/demos/Makefile.am b/ruby/demos/Makefile.am index 0606dea15..d11904041 100644 --- a/ruby/demos/Makefile.am +++ b/ruby/demos/Makefile.am @@ -30,6 +30,7 @@ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="`$(top_srcdir)/ebuild/utils/canonicalise $(top_srcdir)/ebuild/`" \ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/ebuild/`" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \ SYSCONFDIR="$(sysconfdir)" \ LD_LIBRARY_PATH="`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/.libs`" \ diff --git a/src/clients/adjutrix/Makefile.am b/src/clients/adjutrix/Makefile.am index 87a3fcf1c..af114f676 100644 --- a/src/clients/adjutrix/Makefile.am +++ b/src/clients/adjutrix/Makefile.am @@ -68,6 +68,7 @@ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \ SYSCONFDIR="$(sysconfdir)" \ ADJUTRIX_OPTIONS="" \ diff --git a/src/clients/contrarius/Makefile.am b/src/clients/contrarius/Makefile.am index e60f3467a..bf1a316a0 100644 --- a/src/clients/contrarius/Makefile.am +++ b/src/clients/contrarius/Makefile.am @@ -54,6 +54,7 @@ TESTS_ENVIRONMENT = env \ TEST_SCRIPT_DIR="$(srcdir)/" \ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ CONTRARIUS_OPTIONS="" \ bash $(top_srcdir)/test/run_test.sh bash diff --git a/src/clients/inquisitio/Makefile.am b/src/clients/inquisitio/Makefile.am index 3c5e6f1cb..d2a543b07 100644 --- a/src/clients/inquisitio/Makefile.am +++ b/src/clients/inquisitio/Makefile.am @@ -64,6 +64,7 @@ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \ SYSCONFDIR="$(sysconfdir)" \ bash $(top_srcdir)/test/run_test.sh bash diff --git a/src/clients/paludis/Makefile.am b/src/clients/paludis/Makefile.am index 472425f56..723809c13 100644 --- a/src/clients/paludis/Makefile.am +++ b/src/clients/paludis/Makefile.am @@ -84,6 +84,7 @@ TESTS_ENVIRONMENT = env \ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/gentoo/ebuild/`" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \ + PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \ PALUDIS_ENVIRONMENT_SO_DIR="`$(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/environments`" \ PALUDIS_NO_CHOWN="yupyup" \ |