aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-10-31 14:10:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-10-31 14:10:49 +0000
commit2934739931964a1128ee74ef72699343506e9c49 (patch)
treeff7092e788ed460bcf668b914a6d94bf7f169b0c
parentffecab5cedad6ee5eaa70fbb03f1bf1637fc70ee (diff)
downloadpaludis-2934739931964a1128ee74ef72699343506e9c49.tar.gz
paludis-2934739931964a1128ee74ef72699343506e9c49.tar.xz
Environment::system_root_key
-rw-r--r--paludis/environment.hh9
-rw-r--r--paludis/environments/no_config/no_config_environment.cc10
-rw-r--r--paludis/environments/no_config/no_config_environment.hh1
-rw-r--r--paludis/environments/paludis/paludis_environment.cc12
-rw-r--r--paludis/environments/paludis/paludis_environment.hh1
-rw-r--r--paludis/environments/portage/portage_environment.cc9
-rw-r--r--paludis/environments/portage/portage_environment.hh1
-rw-r--r--paludis/environments/test/test_environment.cc12
-rw-r--r--paludis/environments/test/test_environment.hh1
-rw-r--r--python/environment.cc10
10 files changed, 64 insertions, 2 deletions
diff --git a/paludis/environment.hh b/paludis/environment.hh
index e31f457..141bd1f 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -464,6 +464,15 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > preferred_root_key() const = 0;
/**
+ * The system_root_key, which must not be null, specifies the
+ * filesystem root for dependencies etc. This is usually "/",
+ * unless something funky is going on.
+ *
+ * \since 0.55
+ */
+ virtual const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const = 0;
+
+ /**
* The format_key, if non-zero, holds our environment's format. Environment
* implementations should not return zero here, but clients should still
* check.
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index f0ceec4..837e0cf 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -80,6 +80,7 @@ namespace paludis
std::shared_ptr<LiteralMetadataValueKey<std::string> > format_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > repository_dir_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
+ std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
Imp(NoConfigEnvironment * const env, const no_config_environment::Params & params);
void initialise(NoConfigEnvironment * const env);
@@ -163,6 +164,8 @@ Imp<NoConfigEnvironment>::Imp(
repository_dir_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("repository_dir", "Repository dir",
mkt_normal, p.repository_dir())),
preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "Root",
+ mkt_normal, FSPath("/"))),
+ system_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("system_root", "System Root",
mkt_normal, FSPath("/")))
{
}
@@ -367,6 +370,7 @@ NoConfigEnvironment::NoConfigEnvironment(const no_config_environment::Params & p
add_metadata_key(_imp->format_key);
add_metadata_key(_imp->repository_dir_key);
add_metadata_key(_imp->preferred_root_key);
+ add_metadata_key(_imp->system_root_key);
}
NoConfigEnvironment::~NoConfigEnvironment()
@@ -573,6 +577,12 @@ NoConfigEnvironment::preferred_root_key() const
return _imp->preferred_root_key;
}
+const std::shared_ptr<const MetadataValueKey<FSPath> >
+NoConfigEnvironment::system_root_key() const
+{
+ return _imp->system_root_key;
+}
+
const Tribool
NoConfigEnvironment::want_choice_enabled(
const std::shared_ptr<const PackageID> &,
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index c240a34..5419375 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -215,6 +215,7 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > config_location_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > preferred_root_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const;
virtual const std::shared_ptr<OutputManager> create_output_manager(
const CreateOutputManagerInfo &) const;
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index c7ed4e7..f62454b 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -89,6 +89,7 @@ namespace paludis
std::shared_ptr<LiteralMetadataValueKey<FSPath> > config_location_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > world_file_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
+ std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
Imp(PaludisEnvironment * const e, std::shared_ptr<PaludisConfig> c) :
done_hooks(false),
@@ -102,7 +103,9 @@ namespace paludis
*config->world()->location_if_set())
: std::shared_ptr<LiteralMetadataValueKey<FSPath> >()),
preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "Root", mkt_normal,
- FSPath(config->root())))
+ FSPath(config->root()))),
+ system_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("system_root", "System Root", mkt_normal,
+ FSPath("/")))
{
}
@@ -162,6 +165,7 @@ PaludisEnvironment::PaludisEnvironment(const std::string & s) :
if (_imp->world_file_key)
add_metadata_key(_imp->world_file_key);
add_metadata_key(_imp->preferred_root_key);
+ add_metadata_key(_imp->system_root_key);
}
PaludisEnvironment::~PaludisEnvironment()
@@ -457,6 +461,12 @@ PaludisEnvironment::preferred_root_key() const
return _imp->preferred_root_key;
}
+const std::shared_ptr<const MetadataValueKey<FSPath> >
+PaludisEnvironment::system_root_key() const
+{
+ return _imp->system_root_key;
+}
+
const Tribool
PaludisEnvironment::want_choice_enabled(
const std::shared_ptr<const PackageID> & id,
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index 04eb5c6..84c8e25 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -142,6 +142,7 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > config_location_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > preferred_root_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const;
virtual const Tribool want_choice_enabled(
const std::shared_ptr<const PackageID> &,
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 04e74a8..0c0510a 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -118,6 +118,7 @@ namespace paludis
std::shared_ptr<LiteralMetadataValueKey<FSPath> > config_location_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > world_file_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
+ std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
Imp(Environment * const e, const std::string & s) :
conf_dir(FSPath(s.empty() ? "/" : s) / SYSCONFDIR),
@@ -262,6 +263,7 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
if (fixed_root_var.empty())
fixed_root_var = "/";
_imp->preferred_root_key = std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "Root", mkt_normal, FSPath(fixed_root_var));
+ _imp->system_root_key = std::make_shared<LiteralMetadataValueKey<FSPath>>("system_root", "System Root", mkt_normal, FSPath("/"));
}
/* TODO: load USE etc from env? */
@@ -358,6 +360,7 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
add_metadata_key(_imp->config_location_key);
add_metadata_key(_imp->world_file_key);
add_metadata_key(_imp->preferred_root_key);
+ add_metadata_key(_imp->system_root_key);
}
template<typename I_>
@@ -997,6 +1000,12 @@ PortageEnvironment::preferred_root_key() const
return _imp->preferred_root_key;
}
+const std::shared_ptr<const MetadataValueKey<FSPath> >
+PortageEnvironment::system_root_key() const
+{
+ return _imp->system_root_key;
+}
+
const std::shared_ptr<OutputManager>
PortageEnvironment::create_output_manager(const CreateOutputManagerInfo &) const
{
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index 43940e6..ef507e3 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -167,6 +167,7 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > config_location_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > preferred_root_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const;
virtual const std::shared_ptr<OutputManager> create_output_manager(
const CreateOutputManagerInfo &) const;
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index f263dff..fecb646 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -55,12 +55,14 @@ namespace paludis
FSPath root;
Sets sets;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
+ std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
Imp(Environment * const e, const FSPath & r) :
package_database(std::make_shared<PackageDatabase>(e)),
paludis_command(""),
root(r),
- preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "Root", mkt_normal, root))
+ preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "Root", mkt_normal, root)),
+ system_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("system_root", "System Root", mkt_normal, FSPath("/")))
{
}
};
@@ -71,6 +73,7 @@ TestEnvironment::TestEnvironment() :
_imp(Pimp<TestEnvironment>::_imp)
{
add_metadata_key(_imp->preferred_root_key);
+ add_metadata_key(_imp->system_root_key);
}
TestEnvironment::TestEnvironment(const FSPath & r) :
@@ -78,6 +81,7 @@ TestEnvironment::TestEnvironment(const FSPath & r) :
_imp(Pimp<TestEnvironment>::_imp)
{
add_metadata_key(_imp->preferred_root_key);
+ add_metadata_key(_imp->system_root_key);
}
TestEnvironment::~TestEnvironment()
@@ -239,6 +243,12 @@ TestEnvironment::preferred_root_key() const
return _imp->preferred_root_key;
}
+const std::shared_ptr<const MetadataValueKey<FSPath> >
+TestEnvironment::system_root_key() const
+{
+ return _imp->system_root_key;
+}
+
const Tribool
TestEnvironment::want_choice_enabled(
const std::shared_ptr<const PackageID> & id,
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index a31f035..79055af 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -119,6 +119,7 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > config_location_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSPath> > preferred_root_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const;
virtual const Tribool want_choice_enabled(
const std::shared_ptr<const PackageID> &,
diff --git a/python/environment.cc b/python/environment.cc
index 3491dce..f776ea6 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -406,6 +406,16 @@ class EnvironmentImplementationWrapper :
throw PythonMethodNotImplemented("EnvironmentImplementation", "preferred_root_key");
}
+ virtual const std::shared_ptr<const MetadataValueKey<FSPath> > system_root_key() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("system_root_key"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("EnvironmentImplementation", "system_root_key");
+ }
+
virtual const Tribool want_choice_enabled(
const std::shared_ptr<const PackageID> &,
const std::shared_ptr<const Choice> &,