aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-28 20:58:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-28 20:58:20 +0000
commitc52338eefbb54ab15490f65fa9207da2f96448b6 (patch)
tree4258c3fab4af9e4d2ec28a9f80690a9680af839f /paludis/environments
parentb8cc1f18652e2c39f4c7cad5e322e13f4686ed21 (diff)
downloadpaludis-c52338eefbb54ab15490f65fa9207da2f96448b6.tar.gz
paludis-c52338eefbb54ab15490f65fa9207da2f96448b6.tar.xz
Distribution definable defaults. Fixes: ticket:263
Diffstat (limited to 'paludis/environments')
-rw-r--r--paludis/environments/environment_maker.cc10
-rw-r--r--paludis/environments/no_config/Makefile.am2
-rw-r--r--paludis/environments/no_config/no_config_environment.cc13
-rw-r--r--paludis/environments/paludis/Makefile.am2
-rw-r--r--paludis/environments/paludis/paludis_config.cc19
-rw-r--r--paludis/environments/paludis/paludis_environment.cc1
-rw-r--r--paludis/environments/portage/Makefile.am2
7 files changed, 34 insertions, 15 deletions
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)" \