diff options
author | 2010-10-31 15:11:28 +0000 | |
---|---|---|
committer | 2010-10-31 15:11:28 +0000 | |
commit | fc026ef00a65518b590866ce4c06f6dfffbb2583 (patch) | |
tree | e291d7ea6a11233e50948f4fbc47b6f5cd3287bd | |
parent | 07a7abd7892f3e50e826fe05ccb27648e92c67ca (diff) | |
download | paludis-fc026ef00a65518b590866ce4c06f6dfffbb2583.tar.gz paludis-fc026ef00a65518b590866ce4c06f6dfffbb2583.tar.xz |
Don't assume slash is /
Fixes: ticket:995
-rw-r--r-- | paludis/resolver/collect_installed.cc | 3 | ||||
-rw-r--r-- | paludis/resolver/decider.cc | 10 | ||||
-rw-r--r-- | paludis/resolver/destination_utils-fwd.hh | 6 | ||||
-rw-r--r-- | paludis/resolver/destination_utils.cc | 9 | ||||
-rw-r--r-- | paludis/resolver/find_repository_for_helper.cc | 4 | ||||
-rw-r--r-- | paludis/resolver/get_initial_constraints_for_helper.cc | 22 | ||||
-rw-r--r-- | paludis/resolver/get_resolvents_for_helper.cc | 4 | ||||
-rw-r--r-- | paludis/resolver/interest_in_spec_helper.cc | 5 | ||||
-rw-r--r-- | paludis/resolver/make_destination_filtered_generator_helper.cc | 2 | ||||
-rw-r--r-- | src/clients/cave/select_format_for_spec.cc | 3 |
10 files changed, 30 insertions, 38 deletions
diff --git a/paludis/resolver/collect_installed.cc b/paludis/resolver/collect_installed.cc index 7980450c3..ea8d2a65c 100644 --- a/paludis/resolver/collect_installed.cc +++ b/paludis/resolver/collect_installed.cc @@ -25,6 +25,7 @@ #include <paludis/filtered_generator.hh> #include <paludis/filter.hh> #include <paludis/environment.hh> +#include <paludis/metadata_key.hh> #include <algorithm> using namespace paludis; @@ -36,7 +37,7 @@ paludis::resolver::collect_installed( ) { const std::shared_ptr<const PackageIDSequence> q((*env)[selection::AllVersionsUnsorted( - generator::All() | filter::InstalledAtSlash())]); + generator::All() | filter::InstalledAtRoot(env->system_root_key()->value()))]); const std::shared_ptr<PackageIDSet> result(std::make_shared<PackageIDSet>()); std::copy(q->begin(), q->end(), result->inserter()); diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc index d89f26935..2de8eb7df 100644 --- a/paludis/resolver/decider.cc +++ b/paludis/resolver/decider.cc @@ -397,7 +397,7 @@ const std::shared_ptr<const PackageIDSequence> Decider::_collect_staying(const std::shared_ptr<const ChangeByResolventSequence> & going_away) const { const std::shared_ptr<const PackageIDSequence> existing((*_imp->env)[selection::AllVersionsUnsorted( - generator::All() | filter::InstalledAtSlash())]); + generator::All() | filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); const std::shared_ptr<PackageIDSequence> result(std::make_shared<PackageIDSequence>()); for (PackageIDSequence::ConstIterator x(existing->begin()), x_end(existing->end()) ; @@ -1350,7 +1350,7 @@ Decider::find_any_score( { const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly( generator::Matches(spec, { }) | - filter::InstalledAtSlash())]); + filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (! installed_ids->empty() ^ is_block) return std::make_pair(acs_already_installed, operator_bias); } @@ -1360,7 +1360,7 @@ Decider::find_any_score( { const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly( generator::Matches(spec, { mpo_ignore_additional_requirements }) | - filter::InstalledAtSlash())]); + filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (! installed_ids->empty()) return std::make_pair(acs_wrong_options_installed, operator_bias); } @@ -1404,7 +1404,7 @@ Decider::find_any_score( { const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::BestVersionOnly( generator::Matches(spec, { }) | - filter::InstalledAtSlash())]); + filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (! installed_ids->empty()) return std::make_pair(acs_blocks_installed, operator_bias); } @@ -2115,7 +2115,7 @@ Decider::_already_met(const PackageOrBlockDepSpec & spec) const { const std::shared_ptr<const PackageIDSequence> installed_ids((*_imp->env)[selection::AllVersionsUnsorted( generator::Matches(spec.if_package() ? *spec.if_package() : spec.if_block()->blocking(), { }) | - filter::InstalledAtSlash())]); + filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (installed_ids->empty()) return bool(spec.if_block()); else diff --git a/paludis/resolver/destination_utils-fwd.hh b/paludis/resolver/destination_utils-fwd.hh index 4da6c2ef4..250083aee 100644 --- a/paludis/resolver/destination_utils-fwd.hh +++ b/paludis/resolver/destination_utils-fwd.hh @@ -25,6 +25,7 @@ #include <paludis/package_id-fwd.hh> #include <paludis/generator-fwd.hh> #include <paludis/filtered_generator-fwd.hh> +#include <paludis/environment-fwd.hh> namespace paludis { @@ -33,7 +34,10 @@ namespace paludis bool can_make_binary_for(const std::shared_ptr<const PackageID> & id) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE; bool can_chroot(const std::shared_ptr<const PackageID> & id) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE; - FilteredGenerator destination_filtered_generator(const DestinationType, const Generator &) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE; + FilteredGenerator destination_filtered_generator( + const Environment * const, + const DestinationType, + const Generator &) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE; } } diff --git a/paludis/resolver/destination_utils.cc b/paludis/resolver/destination_utils.cc index 3abba3426..7097e8784 100644 --- a/paludis/resolver/destination_utils.cc +++ b/paludis/resolver/destination_utils.cc @@ -83,15 +83,18 @@ namespace } FilteredGenerator -paludis::resolver::destination_filtered_generator(const DestinationType t, const Generator & g) +paludis::resolver::destination_filtered_generator( + const Environment * const env, + const DestinationType t, + const Generator & g) { switch (t) { case dt_install_to_slash: - return g | filter::InstalledAtSlash(); + return g | filter::InstalledAtRoot(env->system_root_key()->value()); case dt_install_to_chroot: - return g | filter::InstalledAtNotSlash(); + return g | filter::InstalledNotAtRoot(env->system_root_key()->value()); case dt_create_binary: return g & BinaryDestinationGenerator(); diff --git a/paludis/resolver/find_repository_for_helper.cc b/paludis/resolver/find_repository_for_helper.cc index b0b0221cc..3aaf4a6f9 100644 --- a/paludis/resolver/find_repository_for_helper.cc +++ b/paludis/resolver/find_repository_for_helper.cc @@ -81,12 +81,12 @@ FindRepositoryForHelper::operator() ( switch (resolution->resolvent().destination_type()) { case dt_install_to_slash: - if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() != FSPath("/"))) + if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() != _imp->env->system_root_key()->value())) continue; break; case dt_install_to_chroot: - if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() == FSPath("/"))) + if ((! (*r)->installed_root_key()) || ((*r)->installed_root_key()->value() == _imp->env->system_root_key()->value())) continue; break; diff --git a/paludis/resolver/get_initial_constraints_for_helper.cc b/paludis/resolver/get_initial_constraints_for_helper.cc index a82a3eedb..85b154072 100644 --- a/paludis/resolver/get_initial_constraints_for_helper.cc +++ b/paludis/resolver/get_initial_constraints_for_helper.cc @@ -143,26 +143,6 @@ GetInitialConstraintsForHelper::operator() (const Resolvent & resolvent) const namespace { - Filter make_destination_filter_fn(const Resolvent & resolvent) - { - switch (resolvent.destination_type()) - { - case dt_install_to_slash: - return filter::InstalledAtSlash(); - - case dt_install_to_chroot: - return filter::InstalledAtNotSlash(); - - case dt_create_binary: - throw InternalError(PALUDIS_HERE, "no dt_create_binary yet"); - - case last_dt: - break; - } - - throw InternalError(PALUDIS_HERE, "unhandled dt"); - } - bool is_scm_name(const QualifiedPackageName & n) { std::string pkg(stringify(n.package())); @@ -214,7 +194,7 @@ namespace Context context("When working out whether '" + stringify(q) + "' has installed SCM packages:"); const std::shared_ptr<const PackageIDSequence> ids((*env)[selection::AllVersionsUnsorted( - destination_filtered_generator(q.destination_type(), generator::Package(q.package())) | + destination_filtered_generator(env, q.destination_type(), generator::Package(q.package())) | make_slot_filter(q) )]); diff --git a/paludis/resolver/get_resolvents_for_helper.cc b/paludis/resolver/get_resolvents_for_helper.cc index daa85dc59..04d5f494a 100644 --- a/paludis/resolver/get_resolvents_for_helper.cc +++ b/paludis/resolver/get_resolvents_for_helper.cc @@ -36,6 +36,7 @@ #include <paludis/filter.hh> #include <paludis/selection.hh> #include <paludis/package_id.hh> +#include <paludis/metadata_key.hh> #include <algorithm> using namespace paludis; @@ -280,7 +281,8 @@ GetResolventsForHelper::operator() ( auto installed_ids((*_imp->env)[selection::BestVersionInEachSlot( generator::Matches(spec, { }) | (_imp->target_destination_type == dt_install_to_chroot ? - Filter(filter::InstalledAtNotSlash()) : Filter(filter::InstalledAtSlash())))]); + Filter(filter::InstalledNotAtRoot(_imp->env->system_root_key()->value())) : + Filter(filter::InstalledAtRoot(_imp->env->system_root_key()->value()))))]); auto target(is_target(reason)); auto want_installed(target ? _imp->want_installed_slots_for_targets : _imp->want_installed_slots_otherwise); diff --git a/paludis/resolver/interest_in_spec_helper.cc b/paludis/resolver/interest_in_spec_helper.cc index 0d29c7060..76d7192e2 100644 --- a/paludis/resolver/interest_in_spec_helper.cc +++ b/paludis/resolver/interest_in_spec_helper.cc @@ -35,6 +35,7 @@ #include <paludis/filtered_generator.hh> #include <paludis/environment.hh> #include <paludis/package_dep_spec_collection.hh> +#include <paludis/metadata_key.hh> #include <list> using namespace paludis; @@ -184,7 +185,7 @@ namespace const std::shared_ptr<const PackageIDSequence> installed_ids( (*env)[selection::SomeArbitraryVersion( generator::Matches(*dep.spec().if_package(), { }) | - filter::InstalledAtSlash())]); + filter::InstalledAtRoot(env->system_root_key()->value()))]); if (installed_ids->empty()) return false; } @@ -293,7 +294,7 @@ InterestInSpecHelper::operator() ( const std::shared_ptr<const PackageIDSequence> installed_ids( (*_imp->env)[selection::SomeArbitraryVersion( generator::Matches(*dep.spec().if_package(), { }) | - filter::InstalledAtSlash())]); + filter::InstalledAtRoot(_imp->env->system_root_key()->value()))]); if (! installed_ids->empty()) return si_take; } diff --git a/paludis/resolver/make_destination_filtered_generator_helper.cc b/paludis/resolver/make_destination_filtered_generator_helper.cc index 96a55b5c8..000508a10 100644 --- a/paludis/resolver/make_destination_filtered_generator_helper.cc +++ b/paludis/resolver/make_destination_filtered_generator_helper.cc @@ -64,7 +64,7 @@ MakeDestinationFilteredGeneratorHelper::operator() ( const Generator & g, const std::shared_ptr<const Resolution> & r) const { - return destination_filtered_generator(r->resolvent().destination_type(), g); + return destination_filtered_generator(_imp->env, r->resolvent().destination_type(), g); } template class Pimp<MakeDestinationFilteredGeneratorHelper>; diff --git a/src/clients/cave/select_format_for_spec.cc b/src/clients/cave/select_format_for_spec.cc index 62cbfa101..94be4a937 100644 --- a/src/clients/cave/select_format_for_spec.cc +++ b/src/clients/cave/select_format_for_spec.cc @@ -25,6 +25,7 @@ #include <paludis/filter.hh> #include <paludis/filtered_generator.hh> #include <paludis/generator.hh> +#include <paludis/metadata_key.hh> using namespace paludis; using namespace cave; @@ -39,7 +40,7 @@ paludis::cave::select_format_for_spec( const T_ & if_unavailable ) { - if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, { }) | filter::InstalledAtSlash())]->empty()) + if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, { }) | filter::InstalledAtRoot(env->system_root_key()->value()))]->empty()) return if_installed; if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(spec, { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty()) |