aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-13 13:53:06 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-13 13:53:06 +0100
commitd4ae54b97e6fc3218443b389618ee1c71674c097 (patch)
tree9ad5879ac7cb7ffa0511cd0e1a804006b0c5e50f
parent7db9b623aa303e9c16bb113444e9fcceb0e0cddf (diff)
downloadpaludis-d4ae54b97e6fc3218443b389618ee1c71674c097.tar.gz
paludis-d4ae54b97e6fc3218443b389618ee1c71674c097.tar.xz
env->root() -> env->preferred_root_key()
-rw-r--r--paludis/broken_linkage_finder.cc26
-rw-r--r--paludis/comma_separated_dep_printer.cc3
-rw-r--r--paludis/environment.hh13
-rw-r--r--paludis/environments/no_config/no_config_environment.cc18
-rw-r--r--paludis/environments/no_config/no_config_environment.hh3
-rw-r--r--paludis/environments/paludis/paludis_environment.cc18
-rw-r--r--paludis/environments/paludis/paludis_environment.hh4
-rw-r--r--paludis/environments/portage/portage_environment.cc32
-rw-r--r--paludis/environments/portage/portage_environment.hh4
-rw-r--r--paludis/environments/test/test_environment.cc19
-rw-r--r--paludis/environments/test/test_environment.hh3
-rw-r--r--paludis/hooker.cc10
-rw-r--r--paludis/legacy/dep_list.cc10
-rw-r--r--paludis/legacy/install_task.cc4
-rw-r--r--paludis/legacy/query_visitor.cc3
-rw-r--r--paludis/legacy/show_suggest_visitor.cc3
-rw-r--r--paludis/legacy/uninstall_task.cc3
-rw-r--r--paludis/package_database.cc4
-rw-r--r--paludis/repositories/accounts/accounts_dep_key.cc2
-rw-r--r--paludis/repositories/accounts/accounts_repository.cc2
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc4
-rw-r--r--paludis/repositories/cran/dep_spec_pretty_printer.cc3
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc2
-rw-r--r--paludis/repositories/e/e_installed_repository.cc2
-rw-r--r--paludis/repositories/e/e_repository.cc10
-rw-r--r--paludis/repositories/e/e_repository_TEST_replacing.cc2
-rw-r--r--paludis/repositories/e/e_repository_news.cc7
-rw-r--r--paludis/repositories/e/e_repository_sets.cc2
-rw-r--r--paludis/repositories/e/info_metadata_key.cc2
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc6
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc2
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc2
-rw-r--r--paludis/repositories/virtuals/package_id.cc2
-rw-r--r--paludis/set_file.cc7
-rw-r--r--paludis/uninstall_list.cc4
-rw-r--r--python/additional_tests.cc2
-rw-r--r--python/environment.cc30
-rwxr-xr-xpython/environment_TEST.py7
-rwxr-xr-xruby/demos/find_unmanaged_files.rb2
-rw-r--r--ruby/environment.cc15
-rw-r--r--ruby/environment_TEST.rb18
-rw-r--r--src/clients/cave/cmd_contents.cc6
-rw-r--r--src/clients/cave/cmd_info.cc4
-rw-r--r--src/clients/cave/cmd_print_id_contents.cc4
-rw-r--r--src/clients/cave/cmd_verify.cc6
-rw-r--r--src/clients/cave/executables_common.cc4
-rw-r--r--src/clients/cave/owner_common.cc2
-rw-r--r--src/clients/paludis/applets.cc8
-rw-r--r--src/clients/paludis/do_config.cc4
-rw-r--r--src/clients/paludis/do_contents.cc6
-rw-r--r--src/clients/paludis/do_executables.cc6
-rw-r--r--src/clients/paludis/info.cc2
-rw-r--r--src/clients/paludis/uninstall.cc3
-rw-r--r--src/output/console_install_task.cc11
-rw-r--r--src/output/console_query_task.cc2
55 files changed, 184 insertions, 199 deletions
diff --git a/paludis/broken_linkage_finder.cc b/paludis/broken_linkage_finder.cc
index 92e48ce..0c21739 100644
--- a/paludis/broken_linkage_finder.cc
+++ b/paludis/broken_linkage_finder.cc
@@ -90,7 +90,7 @@ namespace paludis
Imp(const Environment * the_env, const std::shared_ptr<const Sequence<std::string>> & the_libraries) :
env(the_env),
- config(the_env->root()),
+ config(the_env->preferred_root_key()->value()),
libraries(the_libraries),
has_files(false)
{
@@ -144,17 +144,17 @@ BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::sha
{
using namespace std::placeholders;
- Context ctx("When checking for broken linkage in '" + stringify(env->root()) + "':");
+ Context ctx("When checking for broken linkage in '" + stringify(env->preferred_root_key()->value()) + "':");
for (auto i(libraries->begin()), i_end(libraries->end()) ; i != i_end ; ++i)
- _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<ElfLinkageChecker>(env->root(), *i)));
+ _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<ElfLinkageChecker>(env->preferred_root_key()->value(), *i)));
if (libraries->empty())
- _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<LibtoolLinkageChecker>(env->root())));
+ _imp->checkers.push_back(std::shared_ptr<LinkageChecker>(std::make_shared<LibtoolLinkageChecker>(env->preferred_root_key()->value())));
std::vector<FSEntry> search_dirs_nosyms, search_dirs_pruned;
std::transform(_imp->config.begin_search_dirs(), _imp->config.end_search_dirs(),
std::back_inserter(search_dirs_nosyms),
- std::bind(realpath_with_current_and_root, _1, FSEntry("/"), env->root()));
+ std::bind(realpath_with_current_and_root, _1, FSEntry("/"), env->preferred_root_key()->value()));
std::sort(search_dirs_nosyms.begin(), search_dirs_nosyms.end());
for (std::vector<FSEntry>::const_iterator it(search_dirs_nosyms.begin()),
@@ -169,7 +169,7 @@ BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::sha
std::transform(_imp->config.begin_ld_so_conf(), _imp->config.end_ld_so_conf(),
std::inserter(_imp->extra_lib_dirs, _imp->extra_lib_dirs.begin()),
- std::bind(realpath_with_current_and_root, _1, FSEntry("/"), env->root()));
+ std::bind(realpath_with_current_and_root, _1, FSEntry("/"), env->preferred_root_key()->value()));
std::for_each(search_dirs_pruned.begin(), search_dirs_pruned.end(),
std::bind(&Imp<BrokenLinkageFinder>::search_directory, _imp.get(), _1));
@@ -178,9 +178,9 @@ BrokenLinkageFinder::BrokenLinkageFinder(const Environment * env, const std::sha
it_end(_imp->extra_lib_dirs.end()); it_end != it; ++it)
{
Log::get_instance()->message("reconcilio.broken_linkage_finder.config", ll_debug, lc_context)
- << "Need to check for extra libraries in '" << (env->root() / *it) << "'";
+ << "Need to check for extra libraries in '" << (env->preferred_root_key()->value() / *it) << "'";
std::for_each(indirect_iterator(_imp->checkers.begin()), indirect_iterator(_imp->checkers.end()),
- std::bind(&LinkageChecker::add_extra_lib_dir, _1, env->root() / *it));
+ std::bind(&LinkageChecker::add_extra_lib_dir, _1, env->preferred_root_key()->value() / *it));
}
std::function<void (const FSEntry &, const std::string &)> callback(
@@ -213,7 +213,7 @@ Imp<BrokenLinkageFinder>::search_directory(const FSEntry & directory)
}
while (FSEntry("/") != dir);
- FSEntry with_root(env->root() / directory);
+ FSEntry with_root(env->preferred_root_key()->value() / directory);
if (with_root.is_directory())
walk_directory(with_root);
else
@@ -226,7 +226,7 @@ Imp<BrokenLinkageFinder>::walk_directory(const FSEntry & directory)
{
using namespace std::placeholders;
- FSEntry without_root(directory.strip_leading(env->root()));
+ FSEntry without_root(directory.strip_leading(env->preferred_root_key()->value()));
if (config.dir_is_masked(without_root))
{
Log::get_instance()->message("reconcilio.broken_linkage_finder.masked", ll_debug, lc_context)
@@ -261,7 +261,7 @@ Imp<BrokenLinkageFinder>::check_file(const FSEntry & file)
{
if (file.is_symbolic_link())
{
- FSEntry target(dereference_with_root(file, env->root()));
+ FSEntry target(dereference_with_root(file, env->preferred_root_key()->value()));
if (target.is_regular_file())
{
std::for_each(indirect_iterator(checkers.begin()), indirect_iterator(checkers.end()),
@@ -304,13 +304,13 @@ Imp<BrokenLinkageFinder>::add_breakage(const FSEntry & file, const std::string &
Context ctx("When building map from files to packages:");
std::shared_ptr<const PackageIDSequence> pkgs((*env)[selection::AllVersionsUnsorted(
- generator::All() | filter::InstalledAtRoot(env->root()))]);
+ generator::All() | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
std::for_each(pkgs->begin(), pkgs->end(),
std::bind(&Imp<BrokenLinkageFinder>::gather_package, this, _1));
}
- FSEntry without_root(file.strip_leading(env->root()));
+ FSEntry without_root(file.strip_leading(env->preferred_root_key()->value()));
std::pair<Files::const_iterator, Files::const_iterator> range(files.equal_range(without_root));
if (range.first == range.second)
orphan_breakage[without_root].insert(req);
diff --git a/paludis/comma_separated_dep_printer.cc b/paludis/comma_separated_dep_printer.cc
index b8a483b..b66d562 100644
--- a/paludis/comma_separated_dep_printer.cc
+++ b/paludis/comma_separated_dep_printer.cc
@@ -29,6 +29,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/action.hh>
+#include <paludis/metadata_key.hh>
#include <algorithm>
#include <sstream>
@@ -84,7 +85,7 @@ CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpe
if (_imp->env)
{
if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::InstalledAtRoot(_imp->env->root()))]->empty())
+ filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
_imp->s << _imp->formatter.format(*node.spec(), format::Installed());
else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
diff --git a/paludis/environment.hh b/paludis/environment.hh
index e776b4d..9eea424 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -302,11 +302,6 @@ namespace paludis
virtual void set_paludis_command(const std::string &) = 0;
/**
- * Our root location for installs.
- */
- virtual const FSEntry root() const = 0;
-
- /**
* User id to use when reduced privs are permissible.
*/
virtual uid_t reduced_uid() const = 0;
@@ -462,6 +457,14 @@ namespace paludis
///\{
/**
+ * The preferred_root_key, which must not be null, specifies the
+ * preferred filesystem root for actions.
+ *
+ * \since 0.54
+ */
+ virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > preferred_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 509d63f..8e3aaf5 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -77,6 +77,7 @@ namespace paludis
std::shared_ptr<LiteralMetadataValueKey<std::string> > format_key;
std::shared_ptr<LiteralMetadataValueKey<FSEntry> > repository_dir_key;
+ std::shared_ptr<LiteralMetadataValueKey<FSEntry> > preferred_root_key;
Imp(NoConfigEnvironment * const env, const no_config_environment::Params & params);
void initialise(NoConfigEnvironment * const env);
@@ -164,7 +165,9 @@ Imp<NoConfigEnvironment>::Imp(
package_database(std::make_shared<PackageDatabase>(env)),
format_key(std::make_shared<LiteralMetadataValueKey<std::string>>("format", "Format", mkt_significant, "no_config")),
repository_dir_key(std::make_shared<LiteralMetadataValueKey<FSEntry>>("repository_dir", "Repository dir",
- mkt_normal, p.repository_dir()))
+ mkt_normal, p.repository_dir())),
+ preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSEntry>>("root", "Root",
+ mkt_normal, FSEntry("/")))
{
}
@@ -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);
}
NoConfigEnvironment::~NoConfigEnvironment()
@@ -535,12 +539,6 @@ NoConfigEnvironment::accept_license(const std::string &, const PackageID &) cons
return true;
}
-const FSEntry
-NoConfigEnvironment::root() const
-{
- return FSEntry("/");
-}
-
HookResult
NoConfigEnvironment::perform_hook(
const Hook &,
@@ -573,6 +571,12 @@ NoConfigEnvironment::config_location_key() const
return std::shared_ptr<const MetadataValueKey<FSEntry> >();
}
+const std::shared_ptr<const MetadataValueKey<FSEntry> >
+NoConfigEnvironment::preferred_root_key() const
+{
+ return _imp->preferred_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 d4afc6b..a2b1a31 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -193,8 +193,6 @@ namespace paludis
virtual std::shared_ptr<const FSEntrySequence> hook_dirs() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual const FSEntry root() const;
-
virtual uid_t reduced_uid() const;
virtual gid_t reduced_gid() const;
@@ -217,6 +215,7 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > preferred_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 1ceed9d..cde353f 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -86,6 +86,7 @@ namespace paludis
std::shared_ptr<LiteralMetadataValueKey<std::string> > format_key;
std::shared_ptr<LiteralMetadataValueKey<FSEntry> > config_location_key;
std::shared_ptr<LiteralMetadataValueKey<FSEntry> > world_file_key;
+ std::shared_ptr<LiteralMetadataValueKey<FSEntry> > preferred_root_key;
Imp(PaludisEnvironment * const e, std::shared_ptr<PaludisConfig> c) :
done_hooks(false),
@@ -97,7 +98,9 @@ namespace paludis
config->config_dir())),
world_file_key(config->world()->location_if_set() ? std::make_shared<LiteralMetadataValueKey<FSEntry>>("world_file", "World file", mkt_normal,
*config->world()->location_if_set())
- : std::shared_ptr<LiteralMetadataValueKey<FSEntry> >())
+ : std::shared_ptr<LiteralMetadataValueKey<FSEntry> >()),
+ preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSEntry>>("root", "Root", mkt_normal,
+ config->root()))
{
}
@@ -156,6 +159,7 @@ PaludisEnvironment::PaludisEnvironment(const std::string & s) :
add_metadata_key(_imp->config_location_key);
if (_imp->world_file_key)
add_metadata_key(_imp->world_file_key);
+ add_metadata_key(_imp->preferred_root_key);
}
PaludisEnvironment::~PaludisEnvironment()
@@ -301,12 +305,6 @@ PaludisEnvironment::mirrors(const std::string & m) const
return _imp->config->mirrors_conf()->query(m);
}
-const FSEntry
-PaludisEnvironment::root() const
-{
- return _imp->config->root();
-}
-
uid_t
PaludisEnvironment::reduced_uid() const
{
@@ -451,6 +449,12 @@ PaludisEnvironment::config_location_key() const
return _imp->config_location_key;
}
+const std::shared_ptr<const MetadataValueKey<FSEntry> >
+PaludisEnvironment::preferred_root_key() const
+{
+ return _imp->preferred_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 dbedf31..c582923 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -88,9 +88,6 @@ namespace paludis
virtual std::shared_ptr<const FSEntrySequence> hook_dirs() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual const FSEntry root() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual uid_t reduced_uid() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -144,6 +141,7 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > preferred_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 f3cfb86..e11281d 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -111,6 +111,7 @@ namespace paludis
std::shared_ptr<LiteralMetadataValueKey<std::string> > format_key;
std::shared_ptr<LiteralMetadataValueKey<FSEntry> > config_location_key;
std::shared_ptr<LiteralMetadataValueKey<FSEntry> > world_file_key;
+ std::shared_ptr<LiteralMetadataValueKey<FSEntry> > preferred_root_key;
Imp(Environment * const e, const std::string & s) :
conf_dir(FSEntry(s.empty() ? "/" : s) / SYSCONFDIR),
@@ -250,6 +251,13 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
std::bind(&predefined, _imp->vars, std::placeholders::_1, std::placeholders::_2),
&do_incremental);
+ {
+ std::string fixed_root_var(_imp->vars->get("ROOT"));
+ if (fixed_root_var.empty())
+ fixed_root_var = "/";
+ _imp->preferred_root_key = std::make_shared<LiteralMetadataValueKey<FSEntry>>("root", "Root", mkt_normal, FSEntry(fixed_root_var));
+ }
+
/* TODO: load USE etc from env? */
/* repositories */
@@ -343,6 +351,7 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
add_metadata_key(_imp->format_key);
add_metadata_key(_imp->config_location_key);
add_metadata_key(_imp->world_file_key);
+ add_metadata_key(_imp->preferred_root_key);
}
template<typename I_>
@@ -464,7 +473,7 @@ PortageEnvironment::_add_installed_virtuals_repository()
{
#ifdef ENABLE_VIRTUALS_REPOSITORY
std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
- keys->insert("root", stringify(root()));
+ keys->insert("root", stringify(preferred_root_key()->value()));
keys->insert("format", "installed_virtuals");
package_database()->add_repository(-1,
RepositoryFactory::get_instance()->create(this, std::bind(from_keys, keys, std::placeholders::_1)));
@@ -483,7 +492,7 @@ PortageEnvironment::_add_ebuild_repository(const FSEntry & portdir, const std::s
const std::string & sync, int importance)
{
std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
- keys->insert("root", stringify(root()));
+ keys->insert("root", stringify(preferred_root_key()->value()));
keys->insert("location", stringify(portdir));
keys->insert("profiles", stringify((_imp->conf_dir / "make.profile").realpath()) + " " +
((_imp->conf_dir / "portage" / "profile").is_directory() ?
@@ -515,8 +524,8 @@ PortageEnvironment::_add_vdb_repository()
Context context("When creating vdb repository:");
std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
- keys->insert("root", stringify(root()));
- keys->insert("location", stringify(root() / "/var/db/pkg"));
+ keys->insert("root", stringify(preferred_root_key()->value()));
+ keys->insert("location", stringify(preferred_root_key()->value() / "/var/db/pkg"));
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
@@ -654,15 +663,6 @@ PortageEnvironment::accept_keywords(const std::shared_ptr <const KeywordNameSet>
return false;
}
-const FSEntry
-PortageEnvironment::root() const
-{
- if (_imp->vars->get("ROOT").empty())
- return FSEntry("/");
- else
- return FSEntry(_imp->vars->get("ROOT"));
-}
-
bool
PortageEnvironment::unmasked_by_user(const PackageID & e) const
{
@@ -985,6 +985,12 @@ PortageEnvironment::config_location_key() const
return _imp->config_location_key;
}
+const std::shared_ptr<const MetadataValueKey<FSEntry> >
+PortageEnvironment::preferred_root_key() const
+{
+ return _imp->preferred_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 c38e67c..09c6fc1 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -118,9 +118,6 @@ namespace paludis
virtual std::shared_ptr<const FSEntrySequence> hook_dirs() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual const FSEntry root() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual std::shared_ptr<const MirrorsSequence> mirrors(const std::string &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -169,6 +166,7 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > preferred_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 01fadbb..f962171 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -34,6 +34,7 @@
#include <paludis/hook.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/choice.hh>
+#include <paludis/literal_metadata_key.hh>
#include <functional>
#include <unordered_map>
#include <string>
@@ -53,11 +54,13 @@ namespace paludis
std::unordered_map<std::string, Tribool> override_want_choice_enabled;
FSEntry root;
Sets sets;
+ std::shared_ptr<LiteralMetadataValueKey<FSEntry> > preferred_root_key;
Imp(Environment * const e, const FSEntry & r) :
package_database(std::make_shared<PackageDatabase>(e)),
paludis_command(""),
- root(r)
+ root(r),
+ preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSEntry>>("root", "Root", mkt_normal, root))
{
}
};
@@ -67,12 +70,14 @@ TestEnvironment::TestEnvironment() :
Pimp<TestEnvironment>(this, FSEntry("/")),
_imp(Pimp<TestEnvironment>::_imp)
{
+ add_metadata_key(_imp->preferred_root_key);
}
TestEnvironment::TestEnvironment(const FSEntry & r) :
Pimp<TestEnvironment>(this, r),
_imp(Pimp<TestEnvironment>::_imp)
{
+ add_metadata_key(_imp->preferred_root_key);
}
TestEnvironment::~TestEnvironment()
@@ -141,12 +146,6 @@ TestEnvironment::reduced_gid() const
return destringify<int>(getenv_with_default("PALUDIS_REDUCED_GID", stringify(getgid())));
}
-const FSEntry
-TestEnvironment::root() const
-{
- return _imp->root;
-}
-
std::shared_ptr<const MirrorsSequence>
TestEnvironment::mirrors(const std::string & s) const
{
@@ -234,6 +233,12 @@ TestEnvironment::config_location_key() const
return std::shared_ptr<const MetadataValueKey<FSEntry> >();
}
+const std::shared_ptr<const MetadataValueKey<FSEntry> >
+TestEnvironment::preferred_root_key() const
+{
+ return _imp->preferred_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 909b2b8..6db83f0 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -96,8 +96,6 @@ namespace paludis
virtual std::shared_ptr<const FSEntrySequence> hook_dirs() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual const FSEntry root() const;
-
virtual uid_t reduced_uid() const;
virtual gid_t reduced_gid() const;
@@ -120,6 +118,7 @@ namespace paludis
virtual const std::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
+ virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > preferred_root_key() const;
virtual const Tribool want_choice_enabled(
const std::shared_ptr<const PackageID> &,
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index 6eacba4..c19ccdf 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -39,6 +39,8 @@
#include <paludis/util/singleton-impl.hh>
#include <paludis/about.hh>
#include <paludis/output_manager.hh>
+#include <paludis/metadata_key.hh>
+
#include <list>
#include <iterator>
#include <dlfcn.h>
@@ -165,7 +167,7 @@ BashHookFile::run(
file_name() << "' for '" << hook.name() << "'";
Command cmd(Command("bash '" + stringify(file_name()) + "'")
- .with_setenv("ROOT", stringify(_env->root()))
+ .with_setenv("ROOT", stringify(_env->preferred_root_key()->value()))
.with_setenv("HOOK", hook.name())
.with_setenv("HOOK_FILE", stringify(file_name()))
.with_setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
@@ -227,7 +229,7 @@ FancyHookFile::run(const Hook & hook,
"/hooker.bash '" + stringify(file_name()) + "' 'hook_run_" + stringify(hook.name()) + "'");
cmd
- .with_setenv("ROOT", stringify(_env->root()))
+ .with_setenv("ROOT", stringify(_env->preferred_root_key()->value()))
.with_setenv("HOOK", hook.name())
.with_setenv("HOOK_FILE", stringify(file_name()))
.with_setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
@@ -288,7 +290,7 @@ FancyHookFile::auto_hook_names() const
"/hooker.bash '" + stringify(file_name()) + "' 'hook_auto_names'");
cmd
- .with_setenv("ROOT", stringify(_env->root()))
+ .with_setenv("ROOT", stringify(_env->preferred_root_key()->value()))
.with_setenv("HOOK_FILE", stringify(file_name()))
.with_setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
.with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
@@ -345,7 +347,7 @@ FancyHookFile::_add_dependency_class(const Hook & hook, DirectedGraph<std::strin
stringify(hook.name()) + "'");
cmd
- .with_setenv("ROOT", stringify(_env->root()))
+ .with_setenv("ROOT", stringify(_env->preferred_root_key()->value()))
.with_setenv("HOOK", hook.name())
.with_setenv("HOOK_FILE", stringify(file_name()))
.with_setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
diff --git a/paludis/legacy/dep_list.cc b/paludis/legacy/dep_list.cc
index f945bb0..6dfc0c5 100644
--- a/paludis/legacy/dep_list.cc
+++ b/paludis/legacy/dep_list.cc
@@ -301,7 +301,7 @@ namespace
{
return ! env[selection::SomeArbitraryVersion(
generator::Package(*u->spec()->package_ptr()) |
- filter::InstalledAtRoot(env.root()))]->empty();
+ filter::InstalledAtRoot(env.preferred_root_key()->value()))]->empty();
}
else
return false;
@@ -426,7 +426,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
// TODO: check destinations
std::shared_ptr<const PackageIDSequence> already_installed((*d->_imp->env)[selection::AllVersionsSorted(
generator::Matches(*node.spec(), d->_imp->opts->match_package_options()) |
- filter::InstalledAtRoot(d->_imp->env->root()))]);
+ filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()))]);
/* are we already on the merge list? */
std::pair<MergeListIndex::iterator, MergeListIndex::iterator> q;
@@ -661,7 +661,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::T
std::shared_ptr<const PackageIDSequence> are_we_downgrading(
(*d->_imp->env)[selection::AllVersionsSorted(
generator::Package(best_visible_candidate->name()) |
- filter::InstalledAtRoot(d->_imp->env->root()) |
+ filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()) |
filter::SameSlot(best_visible_candidate))]);
if (are_we_downgrading->empty())
@@ -868,7 +868,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
*node.spec()->blocking().package_ptr()));
already_installed = (*d->_imp->env)[selection::AllVersionsUnsorted(
generator::Matches(just_package, d->_imp->opts->match_package_options()) |
- filter::InstalledAtRoot(d->_imp->env->root()))];
+ filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()))];
MatchDepListEntryAgainstPackageDepSpec m(d->_imp->env, just_package, d->_imp->opts->match_package_options());
for (std::pair<MergeListIndex::const_iterator, MergeListIndex::const_iterator> p(
@@ -894,7 +894,7 @@ DepList::AddVisitor::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Typ
/* TODO: InstalledAtRoot? */
already_installed = (*d->_imp->env)[selection::AllVersionsUnsorted(
generator::All() |
- filter::InstalledAtRoot(d->_imp->env->root()))];
+ filter::InstalledAtRoot(d->_imp->env->preferred_root_key()->value()))];
}
if (already_installed->empty() && will_be_installed.empty() && ! check_whole_list)
diff --git a/paludis/legacy/install_task.cc b/paludis/legacy/install_task.cc
index 6749f69..f6bc660 100644
--- a/paludis/legacy/install_task.cc
+++ b/paludis/legacy/install_task.cc
@@ -1526,7 +1526,7 @@ namespace
{
if (! failure)
if ((*env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { })
- | filter::InstalledAtRoot(env->root()))]->empty())
+ | filter::InstalledAtRoot(env->preferred_root_key()->value()))]->empty())
failure = node.spec();
}
@@ -1731,7 +1731,7 @@ namespace
* there are no matches here it's not a problem because of or-deps. */
std::shared_ptr<const PackageIDSequence> installed((*env)[selection::AllVersionsUnsorted(
generator::Matches(*node.spec(), { }) |
- filter::InstalledAtRoot(env->root()))]);
+ filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
for (PackageIDSequence::ConstIterator i(installed->begin()), i_end(installed->end()) ;
i != i_end ; ++i)
diff --git a/paludis/legacy/query_visitor.cc b/paludis/legacy/query_visitor.cc
index d089b70..655a86c 100644
--- a/paludis/legacy/query_visitor.cc
+++ b/paludis/legacy/query_visitor.cc
@@ -25,6 +25,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/metadata_key.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/log.hh>
@@ -91,7 +92,7 @@ QueryVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & n
// TODO: check destinations
std::shared_ptr<const PackageIDSequence> matches((*_imp->environment)[selection::AllVersionsUnsorted(
generator::Matches(*node.spec(), _imp->dep_list->options()->match_package_options()) |
- filter::InstalledAtRoot(_imp->environment->root()))]);
+ filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]);
if (indirect_iterator(matches->end()) != std::find_if(indirect_iterator(matches->begin()), indirect_iterator(matches->end()),
std::bind(std::logical_not<bool>(), std::bind(std::mem_fn(&DepList::replaced), _imp->dep_list, _1))))
diff --git a/paludis/legacy/show_suggest_visitor.cc b/paludis/legacy/show_suggest_visitor.cc
index 9266135..14ad042 100644
--- a/paludis/legacy/show_suggest_visitor.cc
+++ b/paludis/legacy/show_suggest_visitor.cc
@@ -27,6 +27,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/metadata_key.hh>
#include <paludis/util/log.hh>
#include <paludis/util/save.hh>
#include <paludis/util/pimp-impl.hh>
@@ -191,7 +192,7 @@ ShowSuggestVisitor::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Ty
std::shared_ptr<const PackageIDSequence> installed_matches((*_imp->environment)[selection::AllVersionsSorted(
generator::Matches(*node.spec(), _imp->dep_list->options()->match_package_options())
- | filter::InstalledAtRoot(_imp->environment->root()))]);
+ | filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]);
if (! installed_matches->empty())
{
Log::get_instance()->message("dep_list.show_suggest_visitor.already_installed", ll_debug, lc_context)
diff --git a/paludis/legacy/uninstall_task.cc b/paludis/legacy/uninstall_task.cc
index 888f056..148bd4f 100644
--- a/paludis/legacy/uninstall_task.cc
+++ b/paludis/legacy/uninstall_task.cc
@@ -28,6 +28,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/metadata_key.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/iterator_funcs.hh>
@@ -331,7 +332,7 @@ UninstallTask::execute()
bool remove(true);
std::shared_ptr<const PackageIDSequence> installed((*_imp->env)[selection::AllVersionsUnsorted(
generator::Matches(make_package_dep_spec({ }).package(i->first), { }) |
- filter::InstalledAtRoot(_imp->env->root())
+ filter::InstalledAtRoot(_imp->env->preferred_root_key()->value())
)]);
for (PackageIDSequence::ConstIterator r(installed->begin()), r_end(installed->end()) ;
r != r_end && remove ; ++r)
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 262e369..f6cdabd 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -27,6 +27,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/metadata_key.hh>
#include <paludis/util/log.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/stringify.hh>
@@ -223,7 +224,8 @@ namespace
bool operator() (const QualifiedPackageName & qpn) const
{
- return ! (*_env)[selection::SomeArbitraryVersion(generator::Package(qpn) | filter::InstalledAtRoot(_env->root()))]->empty();
+ return ! (*_env)[selection::SomeArbitraryVersion(generator::Package(qpn) |
+ filter::InstalledAtRoot(_env->preferred_root_key()->value()))]->empty();
}
};
diff --git a/paludis/repositories/accounts/accounts_dep_key.cc b/paludis/repositories/accounts/accounts_dep_key.cc
index 24c879b..a5f11d9 100644
--- a/paludis/repositories/accounts/accounts_dep_key.cc
+++ b/paludis/repositories/accounts/accounts_dep_key.cc
@@ -127,7 +127,7 @@ AccountsDepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) c
if (_imp->env)
{
if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(**i, { }) |
- filter::InstalledAtRoot(_imp->env->root()))]->empty())
+ filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
s << f.format(**i, format::Installed());
else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(**i, { }) |
filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc
index b72072e..dca2427 100644
--- a/paludis/repositories/accounts/accounts_repository.cc
+++ b/paludis/repositories/accounts/accounts_repository.cc
@@ -411,7 +411,7 @@ bool
AccountsRepository::is_default_destination() const
{
return _imp->handler_if_installed &&
- _imp->params_if_installed->environment()->root() == installed_root_key()->value();
+ _imp->params_if_installed->environment()->preferred_root_key()->value() == installed_root_key()->value();
}
bool
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 0d2a764..646df75 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -388,7 +388,7 @@ CRANInstalledRepository::repository_factory_create(
std::string root(f("root"));
if (root.empty())
- root = stringify(env->root());
+ root = stringify(env->preferred_root_key()->value());
if (! f("world").empty())
throw CRANInstalledRepositoryConfigurationError("Key 'world' is no longer supported.");
@@ -470,7 +470,7 @@ CRANInstalledRepository::is_suitable_destination_for(const PackageID & e) const
bool
CRANInstalledRepository::is_default_destination() const
{
- return _imp->params.environment()->root() == installed_root_key()->value();
+ return _imp->params.environment()->preferred_root_key()->value() == installed_root_key()->value();
}
bool
diff --git a/paludis/repositories/cran/dep_spec_pretty_printer.cc b/paludis/repositories/cran/dep_spec_pretty_printer.cc
index de4b349..1a365fa 100644
--- a/paludis/repositories/cran/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/cran/dep_spec_pretty_printer.cc
@@ -30,6 +30,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/action-fwd.hh>
+#include <paludis/metadata_key.hh>
#include <algorithm>
#include <ostream>
#include <sstream>
@@ -87,7 +88,7 @@ DepSpecPrettyPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::
if (_imp->env)
{
if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::InstalledAtRoot(_imp->env->root()))]->empty())
+ filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
_imp->s << _imp->formatter.format(*node.spec(), format::Installed());
else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
index f4fe2cf..2803125 100644
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ b/paludis/repositories/e/dep_spec_pretty_printer.cc
@@ -320,7 +320,7 @@ DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<PackageDepSpec>::Typ
if (_imp->env && _imp->check_conditions)
{
if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::InstalledAtRoot(_imp->env->root()))]->empty())
+ filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
_imp->s << _imp->formatter.format(*node.spec(), format::Installed());
else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index 3d37455..81915e9 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -146,7 +146,7 @@ EInstalledRepository::is_suitable_destination_for(const PackageID & e) const
bool
EInstalledRepository::is_default_destination() const
{
- return _imp->params.environment()->root() == installed_root_key()->value();
+ return _imp->params.environment()->preferred_root_key()->value() == installed_root_key()->value();
}
bool
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index f8880b1..30e52fe 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -2651,7 +2651,7 @@ ERepository::info(const std::shared_ptr<const ERepositoryID> & id,
n::portdir() =
(_imp->params.master_repositories() && ! _imp->params.master_repositories()->empty()) ?
(*_imp->params.master_repositories()->begin())->params().location() : _imp->params.location(),
- n::root() = stringify(_imp->params.environment()->root()),
+ n::root() = stringify(_imp->params.environment()->preferred_root_key()->value()),
n::sandbox() = phase->option("sandbox"),
n::sydbox() = phase->option("sydbox"),
n::userpriv() = phase->option("userpriv") && userpriv_ok
@@ -2969,7 +2969,9 @@ ERepository::pretend(
n::portdir() =
(_imp->params.master_repositories() && ! _imp->params.master_repositories()->empty()) ?
(*_imp->params.master_repositories()->begin())->params().location() : _imp->params.location(),
- n::root() = stringify(_imp->params.environment()->root()),
+ n::root() = a.options.destination()->installed_root_key() ?
+ stringify(a.options.destination()->installed_root_key()->value()) :
+ "/",
n::sandbox() = phase->option("sandbox"),
n::sydbox() = phase->option("sydbox"),
n::userpriv() = phase->option("userpriv") && userpriv_ok
@@ -3024,7 +3026,9 @@ ERepository::pretend(
n::portdir() =
(_imp->params.master_repositories() && ! _imp->params.master_repositories()->empty()) ?
(*_imp->params.master_repositories()->begin())->params().location() : _imp->params.location(),
- n::root() = stringify(_imp->params.environment()->root()),
+ n::root() = a.options.destination()->installed_root_key() ?
+ stringify(a.options.destination()->installed_root_key()->value()) :
+ "/",
n::sandbox() = phase->option("sandbox"),
n::sydbox() = phase->option("sydbox"),
n::userpriv() = phase->option("userpriv") && userpriv_ok
diff --git a/paludis/repositories/e/e_repository_TEST_replacing.cc b/paludis/repositories/e/e_repository_TEST_replacing.cc
index 406303d..b68234a 100644
--- a/paludis/repositories/e/e_repository_TEST_replacing.cc
+++ b/paludis/repositories/e/e_repository_TEST_replacing.cc
@@ -144,7 +144,7 @@ namespace
const std::shared_ptr<const PackageIDSequence> rlist(env[selection::AllVersionsSorted(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec(replacing, &env, { })),
{ }) |
- filter::InstalledAtRoot(env.root()))]);
+ filter::InstalledAtRoot(env.preferred_root_key()->value()))]);
InstallAction action(make_named_values<InstallActionOptions>(
n::destination() = installed_repo,
diff --git a/paludis/repositories/e/e_repository_news.cc b/paludis/repositories/e/e_repository_news.cc
index aa07b19..e098825 100644
--- a/paludis/repositories/e/e_repository_news.cc
+++ b/paludis/repositories/e/e_repository_news.cc
@@ -39,6 +39,7 @@
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/metadata_key.hh>
#include <sys/types.h>
#include <sys/stat.h>
@@ -78,9 +79,9 @@ namespace paludis
news_directory(EExtraDistributionData::get_instance()->data_from_distribution(
*DistributionData::get_instance()->distribution_from_string(
e->distribution()))->news_directory()),
- skip_file(e->root() / news_directory /
+ skip_file(e->preferred_root_key()->value() / news_directory /
("news-" + stringify(e_repository->name()) + ".skip")),
- unread_file(e->root() / news_directory /
+ unread_file(e->preferred_root_key()->value() / news_directory /
("news-" + stringify(e_repository->name()) + ".unread"))
{
}
@@ -175,7 +176,7 @@ ERepositoryNews::update_news() const
eapi.supported()->package_dep_spec_parse_options(),
eapi.supported()->version_spec_options(),
std::shared_ptr<const PackageID>())), { }) |
- filter::InstalledAtRoot(_imp->environment->root()))]->empty())
+ filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))]->empty())
local_show = true;
show &= local_show;
}
diff --git a/paludis/repositories/e/e_repository_sets.cc b/paludis/repositories/e/e_repository_sets.cc
index 9c678ea..c380d68 100644
--- a/paludis/repositories/e/e_repository_sets.cc
+++ b/paludis/repositories/e/e_repository_sets.cc
@@ -296,7 +296,7 @@ ERepositorySets::security_set(bool insecurity) const
else
candidates = (*_imp->environment)[selection::AllVersionsSorted(
generator::Package(glsa_pkg->name()) |
- filter::InstalledAtRoot(_imp->environment->root()))];
+ filter::InstalledAtRoot(_imp->environment->preferred_root_key()->value()))];
for (PackageIDSequence::ConstIterator c(candidates->begin()), c_end(candidates->end()) ;
c != c_end ; ++c)
diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc
index 2b1eb88..46984b1 100644
--- a/paludis/repositories/e/info_metadata_key.cc
+++ b/paludis/repositories/e/info_metadata_key.cc
@@ -186,7 +186,7 @@ InfoPkgsMetadataKey::need_keys_added() const
eapi->supported()->package_dep_spec_parse_options(),
eapi->supported()->version_spec_options(),
std::shared_ptr<const PackageID>()), { }) |
- filter::InstalledAtRoot(_imp->env->root()))]);
+ filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]);
if (q->empty())
key = std::make_shared<LiteralMetadataValueKey<std::string>>(i->first, i->first, mkt_normal, "(none)");
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index 500623f..3ba78a5 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -264,7 +264,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
eapi->supported()->package_dep_spec_parse_options(),
eapi->supported()->version_spec_options(), package_id));
std::shared_ptr<const PackageIDSequence> entries((*environment)[selection::AllVersionsSorted(
- generator::Matches(spec, { }) | filter::InstalledAtRoot(environment->root()))]);
+ generator::Matches(spec, { }) | filter::InstalledAtRoot(environment->preferred_root_key()->value()))]);
if (eapi->supported()->pipe_commands()->rewrite_virtuals() && (! entries->empty()) &&
(*entries->last())->virtual_for_key())
{
@@ -305,7 +305,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
eapi->supported()->package_dep_spec_parse_options(),
eapi->supported()->version_spec_options(), package_id));
std::shared_ptr<const PackageIDSequence> entries((*environment)[selection::SomeArbitraryVersion(
- generator::Matches(spec, { }) | filter::InstalledAtRoot(environment->root()))]);
+ generator::Matches(spec, { }) | filter::InstalledAtRoot(environment->preferred_root_key()->value()))]);
if (entries->empty())
return "O1;";
else
@@ -329,7 +329,7 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
eapi->supported()->package_dep_spec_parse_options(),
eapi->supported()->version_spec_options(), package_id));
std::shared_ptr<const PackageIDSequence> entries((*environment)[selection::AllVersionsSorted(
- generator::Matches(spec, { }) | filter::InstalledAtRoot(environment->root()))]);
+ generator::Matches(spec, { }) | filter::InstalledAtRoot(environment->preferred_root_key()->value()))]);
if (eapi->supported()->pipe_commands()->rewrite_virtuals() && (! entries->empty()))
{
std::shared_ptr<PackageIDSequence> new_entries(std::make_shared<PackageIDSequence>());
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 04feae2..831043c 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -122,7 +122,7 @@ FakeInstalledRepository::provided_packages() const
bool
FakeInstalledRepository::is_default_destination() const
{
- return environment()->root() == installed_root_key()->value();
+ return environment()->preferred_root_key()->value() == installed_root_key()->value();
}
bool
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 57ae138..9c91775 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -400,7 +400,7 @@ InstalledUnpackagedRepository::is_suitable_destination_for(const PackageID & e)
bool
InstalledUnpackagedRepository::is_default_destination() const
{
- return _imp->params.environment()->root() == installed_root_key()->value();
+ return _imp->params.environment()->preferred_root_key()->value() == installed_root_key()->value();
}
bool
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 093d8b0..0b6900f 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -134,7 +134,7 @@ VirtualsDepKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
if (_imp->env)
{
if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*_imp->spec, { }) |
- filter::InstalledAtRoot(_imp->env->root()))]->empty())
+ filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
return f.format(*_imp->spec, format::Installed());
else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*_imp->spec, { }) |
filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
diff --git a/paludis/set_file.cc b/paludis/set_file.cc
index ca37994..2ed7c83 100644
--- a/paludis/set_file.cc
+++ b/paludis/set_file.cc
@@ -35,6 +35,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/partially_made_package_dep_spec.hh>
+#include <paludis/metadata_key.hh>
#include <list>
#include <vector>
#include <algorithm>
@@ -245,7 +246,7 @@ namespace
<< "Line '" << line << "' uses ? operator but no environment is available";
else if (! (*params.environment())[selection::SomeArbitraryVersion(
generator::Package(*spec->package_ptr()) |
- filter::InstalledAtRoot(params.environment()->root()))]->empty())
+ filter::InstalledAtRoot(params.environment()->preferred_root_key()->value()))]->empty())
result->top()->append(spec);
}
else
@@ -275,7 +276,7 @@ namespace
.package(*spec->package_ptr())
.slot_requirement(spec->slot_requirement_ptr()),
{ }) |
- filter::InstalledAtRoot(params.environment()->root()))]->empty())
+ filter::InstalledAtRoot(params.environment()->preferred_root_key()->value()))]->empty())
result->top()->append(spec);
}
else
@@ -535,7 +536,7 @@ PaludisBashHandler::PaludisBashHandler(const SetFileParams & p) :
std::stringstream s;
Command cmd(Command("bash '" + stringify(_p.file_name()) + "'")
- .with_setenv("ROOT", _p.environment() ? stringify(_p.environment()->root()) : "/")
+ .with_setenv("ROOT", _p.environment() ? stringify(_p.environment()->preferred_root_key()->value()) : "/")
.with_setenv("SET", stringify(_p.file_name()))
.with_setenv("SET_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
.with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
diff --git a/paludis/uninstall_list.cc b/paludis/uninstall_list.cc
index d8129bf..8736854 100644
--- a/paludis/uninstall_list.cc
+++ b/paludis/uninstall_list.cc
@@ -330,8 +330,8 @@ namespace
std::shared_ptr<const PackageIDSequence> m(
best_only ?
- (*env)[selection::BestVersionOnly(generator::Matches(*node.spec(), { }) | filter::InstalledAtRoot(env->root()))] :
- (*env)[selection::AllVersionsSorted(generator::Matches(*node.spec(), { }) | filter::InstalledAtRoot(env->root()))]);
+ (*env)[selection::BestVersionOnly(generator::Matches(*node.spec(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))] :
+ (*env)[selection::AllVersionsSorted(generator::Matches(*node.spec(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
for (PackageIDSequence::ConstIterator it = m->begin(), it_end = m->end();
it_end != it; ++it)
matches->insert(make_named_values<DepTagEntry>(
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index cd9d774..23e7b54 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -80,8 +80,6 @@ namespace environment
e.set_paludis_command("paludis");
- e.root();
-
e.reduced_uid();
e.reduced_gid();
diff --git a/python/environment.cc b/python/environment.cc
index f8030a0..dc5c834 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -211,16 +211,6 @@ class EnvironmentImplementationWrapper :
throw PythonMethodNotImplemented("EnvironmentImplementation", "set_paludis_command");
}
- virtual const FSEntry root() const
- {
- Lock l(get_mutex());
-
- if (bp::override f = get_override("root"))
- return f();
- else
- throw PythonMethodNotImplemented("EnvironmentImplementation", "root");
- }
-
virtual uid_t reduced_uid() const
{
Lock l(get_mutex());
@@ -406,6 +396,16 @@ class EnvironmentImplementationWrapper :
throw PythonMethodNotImplemented("EnvironmentImplementation", "config_location_key");
}
+ virtual const std::shared_ptr<const MetadataValueKey<FSEntry> > preferred_root_key() const
+ {
+ Lock l(get_mutex());
+
+ if (bp::override f = get_override("preferred_root_key"))
+ return f();
+ else
+ throw PythonMethodNotImplemented("EnvironmentImplementation", "preferred_root_key");
+ }
+
virtual const Tribool want_choice_enabled(
const std::shared_ptr<const PackageID> &,
const std::shared_ptr<const Choice> &,
@@ -543,11 +543,6 @@ void expose_environment()
"Fetch a named set."
)
- .add_property("root", &Environment::root,
- "[ro] string\n"
- "Our root location for installs."
- )
-
.add_property("set_names", &Environment::set_names,
"[ro] SetNamesIterable\n"
"All known named sets."
@@ -636,11 +631,6 @@ void expose_environment()
"Change the command used to launch paludis (the client)."
)
- .def("root", bp::pure_virtual(&EnvImp::root),
- "root() -> path\n"
- "Our root location for installs."
- )
-
.def("reduced_uid", bp::pure_virtual(&EnvImp::reduced_uid),
"reduced_uid() -> int\n"
"User id to use when reduced privs are permissible."
diff --git a/python/environment_TEST.py b/python/environment_TEST.py
index 8155302..6b02ba0 100755
--- a/python/environment_TEST.py
+++ b/python/environment_TEST.py
@@ -70,10 +70,6 @@ class TestCase_01_Environments(unittest.TestCase):
self.assert_(isinstance(nce2.main_repository, Repository))
self.assert_(isinstance(nce2.master_repository, Repository))
- def test_09_root(self):
- self.assert_(isinstance(self.e.root, str))
- self.assert_(isinstance(self.nce.root, str))
-
def test_10_default_destinations(self):
self.assert_(isinstance(self.e.default_destinations, DestinationsIterable))
self.assert_(isinstance(self.nce.default_destinations, DestinationsIterable))
@@ -127,9 +123,6 @@ class TestCase_04_Environment_subclassingd(unittest.TestCase):
def set_paludis_command(self, s):
pass
- def root(self):
- return "/"
-
def reduced_uid(self):
return 0
diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb
index ee4c452..c15f5a7 100755
--- a/ruby/demos/find_unmanaged_files.rb
+++ b/ruby/demos/find_unmanaged_files.rb
@@ -73,7 +73,7 @@ end
env = Paludis::EnvironmentFactory.instance.create env_spec
db = env.package_database
-root = env.root[-1] == ?/ ? env.root.chop : env.root
+root = env.preferred_root_key.value[-1] == ?/ ? env.preferred_root_key.value.chop : env.preferred_root_key.value
directories = []
diff --git a/ruby/environment.cc b/ruby/environment.cc
index 75c92ee..f348018 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -189,18 +189,6 @@ namespace
/*
* call-seq:
- * root -> String
- *
- * Default root location, default is /.
- */
- VALUE
- environment_root(VALUE self)
- {
- return rb_str_new2(stringify(value_to_environment(self)->root()).c_str());
- }
-
- /*
- * call-seq:
* default_destinations -> Array
*
* Default: All repositories that provide RepositoryDestinationInterface and mark themselves
@@ -497,7 +485,6 @@ namespace
rb_funcall(c_environment, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_environment, "package_database", RUBY_FUNC_CAST(&environment_package_database), 0);
rb_define_method(c_environment, "set", RUBY_FUNC_CAST(&environment_set), 1);
- rb_define_method(c_environment, "root", RUBY_FUNC_CAST(&environment_root), 0);
rb_define_method(c_environment, "default_destinations", RUBY_FUNC_CAST(&environment_default_destinations), 0);
rb_define_method(c_environment, "distribution", RUBY_FUNC_CAST(&environment_distribution), 0);
rb_define_method(c_environment, "accept_license", RUBY_FUNC_CAST(&environment_accept_license), 2);
@@ -508,6 +495,8 @@ namespace
RUBY_FUNC_CAST((&EnvironmentKey<MetadataValueKey<std::string> , &Environment::format_key>::fetch)), 0);
rb_define_method(c_environment, "config_location_key",
RUBY_FUNC_CAST((&EnvironmentKey<MetadataValueKey<FSEntry>, &Environment::config_location_key>::fetch)), 0);
+ rb_define_method(c_environment, "preferred_root_key",
+ RUBY_FUNC_CAST((&EnvironmentKey<MetadataValueKey<FSEntry>, &Environment::preferred_root_key>::fetch)), 0);
/*
* Document-class: Paludis::PaludisEnvironment
diff --git a/ruby/environment_TEST.rb b/ruby/environment_TEST.rb
index a050d4f..fd068b8 100644
--- a/ruby/environment_TEST.rb
+++ b/ruby/environment_TEST.rb
@@ -2,7 +2,7 @@
# vim: set sw=4 sts=4 et tw=80 :
#
-# Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+# Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
# Copyright (c) 2007, 2008 Richard Brown
#
# This file is part of the Paludis package manager. Paludis is free software;
@@ -219,28 +219,12 @@ module Paludis
end
end
- class TestCase_EnvironmentRoot < Test::Unit::TestCase
- def test_root
- assert_kind_of String, env.root
- end
- end
-
class TestCase_EnvironmentDefaultDestinations < Test::Unit::TestCase
def test_default_destinations
assert_kind_of Array, env.default_destinations
end
end
- class TestCase_EnvironmentRoot < Test::Unit::TestCase
- def env
- NoConfigEnvironment.new(Dir.getwd().to_s + "/environment_TEST_dir/testrepo")
- end
-
- def test_root
- assert_kind_of String, env.root
- end
- end
-
class TestCase_EnvironmentDistribution < Test::Unit::TestCase
def env
NoConfigEnvironment.new(Dir.getwd().to_s + "/environment_TEST_dir/testrepo")
diff --git a/src/clients/cave/cmd_contents.cc b/src/clients/cave/cmd_contents.cc
index 0af6e25..9ff5f32 100644
--- a/src/clients/cave/cmd_contents.cc
+++ b/src/clients/cave/cmd_contents.cc
@@ -124,13 +124,13 @@ ContentsCommand::run(
throw args::DoHelp("contents takes exactly one parameter");
PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(),
- { }, filter::InstalledAtRoot(env->root())));
+ { }, filter::InstalledAtRoot(env->preferred_root_key()->value())));
std::shared_ptr<const PackageIDSequence> entries(
- (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
- nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->root()));
+ nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->value()));
const std::shared_ptr<const PackageID> id(*entries->last());
if (! id->contents_key())
diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc
index 3114932..2caab8e 100644
--- a/src/clients/cave/cmd_info.cc
+++ b/src/clients/cave/cmd_info.cc
@@ -363,12 +363,12 @@ namespace
PackageDepSpec spec(parse_user_package_dep_spec(param, env.get(), { }));
const std::shared_ptr<const PackageIDSequence> installed_ids((*env)[selection::AllVersionsSorted(generator::Matches(
- spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
const std::shared_ptr<const PackageIDSequence> installable_ids((*env)[selection::BestVersionOnly(generator::Matches(
spec, { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]);
if (installed_ids->empty() && installable_ids->empty())
- nothing_matching_error(env.get(), param, filter::InstalledAtRoot(env->root()));
+ nothing_matching_error(env.get(), param, filter::InstalledAtRoot(env->preferred_root_key()->value()));
for (PackageIDSequence::ConstIterator i(installed_ids->begin()), i_end(installed_ids->end()) ;
i != i_end ; ++i)
diff --git a/src/clients/cave/cmd_print_id_contents.cc b/src/clients/cave/cmd_print_id_contents.cc
index b67269e..aeeb789 100644
--- a/src/clients/cave/cmd_print_id_contents.cc
+++ b/src/clients/cave/cmd_print_id_contents.cc
@@ -158,10 +158,10 @@ PrintIDContentsCommand::run(
throw args::DoHelp("print-id-contents takes exactly one parameter");
PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(),
- { updso_allow_wildcards }, filter::InstalledAtRoot(env->root())));
+ { updso_allow_wildcards }, filter::InstalledAtRoot(env->preferred_root_key()->value())));
std::shared_ptr<const PackageIDSequence> entries(
- (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
throw NothingMatching(spec);
diff --git a/src/clients/cave/cmd_verify.cc b/src/clients/cave/cmd_verify.cc
index b808165..b1ed122 100644
--- a/src/clients/cave/cmd_verify.cc
+++ b/src/clients/cave/cmd_verify.cc
@@ -203,13 +203,13 @@ VerifyCommand::run(
throw args::DoHelp("verify takes exactly one parameter");
PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(),
- { updso_allow_wildcards }, filter::InstalledAtRoot(env->root())));
+ { updso_allow_wildcards }, filter::InstalledAtRoot(env->preferred_root_key()->value())));
std::shared_ptr<const PackageIDSequence> entries(
- (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ (*env)[selection::AllVersionsSorted(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
- nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->root()));
+ nothing_matching_error(env.get(), *cmdline.begin_parameters(), filter::InstalledAtRoot(env->preferred_root_key()->value()));
int exit_status(0);
for (PackageIDSequence::ConstIterator i(entries->begin()), i_end(entries->end()) ;
diff --git a/src/clients/cave/executables_common.cc b/src/clients/cave/executables_common.cc
index b3ce920..f54a7d3 100644
--- a/src/clients/cave/executables_common.cc
+++ b/src/clients/cave/executables_common.cc
@@ -112,8 +112,8 @@ paludis::cave::executables_common(
PackageDepSpec(parse_user_package_dep_spec(
param, env.get(),
{ updso_allow_wildcards },
- filter::InstalledAtRoot(env->root()))),
- { }) | filter::InstalledAtRoot(env->root()))]);
+ filter::InstalledAtRoot(env->preferred_root_key()->value()))),
+ { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
throw NoSuchPackageError(param);
diff --git a/src/clients/cave/owner_common.cc b/src/clients/cave/owner_common.cc
index 4c75444..9d1b030 100644
--- a/src/clients/cave/owner_common.cc
+++ b/src/clients/cave/owner_common.cc
@@ -83,7 +83,7 @@ paludis::cave::owner_common(
}
std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsSorted(generator::All() |
- filter::InstalledAtRoot(env->root()))]);
+ filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
for (PackageIDSequence::ConstIterator p(ids->begin()), p_end(ids->end()); p != p_end; ++p)
{
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 52091c0..7ce8eb4 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -188,7 +188,7 @@ int do_has_version(const std::shared_ptr<Environment> & env)
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
parse_user_package_dep_spec(query, env.get(), { })));
std::shared_ptr<const PackageIDSequence> entries((*env)[selection::SomeArbitraryVersion(
- generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
return_code = 1;
@@ -206,7 +206,7 @@ int do_best_version(const std::shared_ptr<Environment> & env)
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
parse_user_package_dep_spec(query, env.get(), { })));
std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(
- generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
/* make built_with_use work for virtuals... icky... */
while (! entries->empty())
@@ -247,7 +247,7 @@ int do_match(const std::shared_ptr<Environment> & env)
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
parse_user_package_dep_spec(query, env.get(), { })));
std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(
- generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
while (! entries->empty())
{
@@ -292,7 +292,7 @@ int do_environment_variable(const std::shared_ptr<Environment> & env)
parse_user_package_dep_spec(spec_str, env.get(), { })));
std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted(
- generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
entries = (*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }))];
diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc
index 3bc40c0..c1d14ee 100644
--- a/src/clients/paludis/do_config.cc
+++ b/src/clients/paludis/do_config.cc
@@ -78,10 +78,10 @@ namespace
std::shared_ptr<PackageDepSpec> spec(
std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(target, env.get(), { },
- filter::InstalledAtRoot(env->root()))));
+ filter::InstalledAtRoot(env->preferred_root_key()->value()))));
std::shared_ptr<const PackageIDSequence> entries(
- (*env)[selection::AllVersionsUnsorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ (*env)[selection::AllVersionsUnsorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
throw NoSuchPackageError(target);
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index d713e2b..e15189e 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -84,10 +84,10 @@ do_one_contents(
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions() + updso_allow_wildcards,
- filter::InstalledAtRoot(env->root()))));
+ filter::InstalledAtRoot(env->preferred_root_key()->value()))));
std::shared_ptr<const PackageIDSequence> entries(
- (*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ (*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
throw NoSuchPackageError(q);
@@ -143,7 +143,7 @@ do_contents(const std::shared_ptr<Environment> & env)
{
cerr << " Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->root()));
+ FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->preferred_root_key()->value()));
if (f.begin() == f.end())
cerr << "No suggestions found." << endl;
diff --git a/src/clients/paludis/do_executables.cc b/src/clients/paludis/do_executables.cc
index 406decb..5a24242 100644
--- a/src/clients/paludis/do_executables.cc
+++ b/src/clients/paludis/do_executables.cc
@@ -136,10 +136,10 @@ do_one_executables(
std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>(
parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions() + updso_allow_wildcards,
- filter::InstalledAtRoot(env->root()))));
+ filter::InstalledAtRoot(env->preferred_root_key()->value()))));
std::shared_ptr<const PackageIDSequence> entries(
- (*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->root()))]);
+ (*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]);
if (entries->empty())
throw NoSuchPackageError(q);
@@ -195,7 +195,7 @@ do_executables(const std::shared_ptr<Environment> & env)
{
cerr << " Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->root()));
+ FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->preferred_root_key()->value()));
if (f.begin() == f.end())
cerr << "No suggestions found." << endl;
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index fbbdc57..5a6b502 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -225,7 +225,7 @@ int do_one_info(
std::shared_ptr<const PackageIDSequence>
entries((*env)[selection::AllVersionsSorted(generator::Matches(*spec, { }))]),
installed_entries((*env)[selection::AllVersionsSorted(
- generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->root()))]),
+ generator::Matches(*spec, { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]),
installable_entries((*env)[selection::AllVersionsSorted(
generator::Matches(*spec, { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]);
diff --git a/src/clients/paludis/uninstall.cc b/src/clients/paludis/uninstall.cc
index ae63b93..45fa168 100644
--- a/src/clients/paludis/uninstall.cc
+++ b/src/clients/paludis/uninstall.cc
@@ -30,6 +30,7 @@
#include <paludis/generator.hh>
#include <paludis/selection.hh>
#include <paludis/filter.hh>
+#include <paludis/metadata_key.hh>
#include <iostream>
#include <limits>
@@ -306,7 +307,7 @@ namespace
try
{
- FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->root()));
+ FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->preferred_root_key()->value()));
if (f.begin() == f.end())
cerr << "No suggestions found." << endl;
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index ec5f227..b08399b 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -514,14 +514,14 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
generator::Matches(make_package_dep_spec({ })
.package(d.package_id()->name()).in_repository(*repo), { }) :
generator::Matches(make_package_dep_spec({ })
- .package(d.package_id()->name()), { }) | filter::InstalledAtRoot(environment()->root())
+ .package(d.package_id()->name()), { }) | filter::InstalledAtRoot(environment()->preferred_root_key()->value())
)]);;
std::shared_ptr<const PackageIDSequence> existing_slot_repo((*environment())[selection::AllVersionsSorted((repo ?
generator::Matches(make_package_dep_spec({ })
.package(d.package_id()->name()).in_repository(*repo), { }) :
generator::Matches(make_package_dep_spec({ })
- .package(d.package_id()->name()), { }) | filter::InstalledAtRoot(environment()->root()))
+ .package(d.package_id()->name()), { }) | filter::InstalledAtRoot(environment()->preferred_root_key()->value()))
| filter::SameSlot(d.package_id()))]);
display_merge_list_entry_start(d, m);
@@ -973,11 +973,10 @@ ConsoleInstallTask::display_merge_list_entry_for(const PackageID & d, const Disp
void
ConsoleInstallTask::display_merge_list_entry_repository(const DepListEntry & d, const DisplayMode m)
{
- // XXX fix this once the new resolver's in
std::shared_ptr<const PackageIDSequence> inst((*environment())[selection::BestVersionOnly(
generator::Package(d.package_id()->name()) |
filter::SameSlot(d.package_id()) |
- filter::InstalledAtRoot(environment()->root()))]);
+ filter::InstalledAtRoot(environment()->preferred_root_key()->value()))]);
bool changed(normal_entry == m &&
! inst->empty() && (*inst->begin())->from_repositories_key() &&
(*inst->begin())->from_repositories_key()->value()->end() ==
@@ -1446,7 +1445,7 @@ ConsoleInstallTask::display_merge_list_entry_package_tags(const DepListEntry & d
std::static_pointer_cast<const DependencyDepTag>(tag->tag())->dependency());
if (d.kind() != dlk_masked && d.kind() != dlk_block && (*environment())[selection::SomeArbitraryVersion(
generator::Matches(*spec, { }) |
- filter::InstalledAtRoot(environment()->root()))]->empty())
+ filter::InstalledAtRoot(environment()->preferred_root_key()->value()))]->empty())
unsatisfied_dependents.insert(tag->tag()->short_text());
else
dependents.insert(tag->tag()->short_text());
@@ -1948,7 +1947,7 @@ ConsoleInstallTask::show_resume_command(const std::string & resume_command_templ
void
ConsoleInstallTask::on_installed_paludis()
{
- std::string r(stringify(environment()->root()));
+ std::string r(stringify(environment()->preferred_root_key()->value()));
std::string exec_mode(getenv_with_default("PALUDIS_EXEC_PALUDIS", ""));
if ("always" != exec_mode)
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 27c1999..5b89ea9 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -119,7 +119,7 @@ ConsoleQueryTask::show_one(const PackageDepSpec & a, const std::shared_ptr<const
std::shared_ptr<const PackageIDSequence>
entries((*_imp->env)[selection::AllVersionsSorted(generator::Matches(a, { }))]),
preferred_entries((*_imp->env)[selection::AllVersionsSorted(
- generator::Matches(a, { }) | filter::InstalledAtRoot(_imp->env->root()))]);
+ generator::Matches(a, { }) | filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]);
if (entries->empty())
throw NoSuchPackageError(stringify(a));
if (preferred_entries->empty())