aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-06-12 16:53:59 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-06-12 16:53:59 +0100
commitdefd17a66b3af79ca09d00510c7265993b1728e1 (patch)
tree44b8f75a11ca5aeaf94247ae9d0b19f43368bc3e
parentc675681c1693abf297ba839c40663f02335094a3 (diff)
downloadpaludis-defd17a66b3af79ca09d00510c7265993b1728e1.tar.gz
paludis-defd17a66b3af79ca09d00510c7265993b1728e1.tar.xz
Make resolve --hide affect resolvent selection
Fixes: ticket:1164
-rw-r--r--paludis/resolver/get_resolvents_for_helper.cc28
-rw-r--r--paludis/resolver/get_resolvents_for_helper.hh3
-rw-r--r--paludis/resolver/resolver_test.cc4
-rw-r--r--paludis/resolver/resolver_test.hh2
-rw-r--r--src/clients/cave/resolve_common.cc14
5 files changed, 27 insertions, 24 deletions
diff --git a/paludis/resolver/get_resolvents_for_helper.cc b/paludis/resolver/get_resolvents_for_helper.cc
index d3e89a9..990b260 100644
--- a/paludis/resolver/get_resolvents_for_helper.cc
+++ b/paludis/resolver/get_resolvents_for_helper.cc
@@ -62,6 +62,7 @@ namespace paludis
struct Imp<GetResolventsForHelper>
{
const Environment * const env;
+ const RemoveHiddenFunction remove_hidden;
DestinationType target_destination_type;
@@ -85,8 +86,9 @@ namespace paludis
std::pair<std::shared_ptr<const Resolvents>, bool>,
Hash<CacheKey> > cache;
- Imp(const Environment * const e) :
+ Imp(const Environment * const e, const RemoveHiddenFunction & h) :
env(e),
+ remove_hidden(h),
target_destination_type(dt_install_to_slash),
want_target_dependencies(true),
want_target_runtime_dependencies(true),
@@ -103,8 +105,8 @@ namespace paludis
};
}
-GetResolventsForHelper::GetResolventsForHelper(const Environment * const e) :
- _imp(e)
+GetResolventsForHelper::GetResolventsForHelper(const Environment * const e, const RemoveHiddenFunction & h) :
+ _imp(e, h)
{
}
@@ -327,20 +329,20 @@ GetResolventsForHelper::operator() (
auto result_ids(std::make_shared<PackageIDSequence>());
std::shared_ptr<const PackageID> best;
- auto ids((*_imp->env)[selection::BestVersionOnly(
- generator::Matches(spec, from_id, { mpo_ignore_additional_requirements }) |
- filter::SupportsAction<InstallAction>() |
- filter::NotMasked() |
- (maybe_slot ? Filter(filter::Slot(*maybe_slot)) : Filter(filter::All())))]);
+ auto ids(_imp->remove_hidden((*_imp->env)[selection::BestVersionOnly(
+ generator::Matches(spec, from_id, { mpo_ignore_additional_requirements }) |
+ filter::SupportsAction<InstallAction>() |
+ filter::NotMasked() |
+ (maybe_slot ? Filter(filter::Slot(*maybe_slot)) : Filter(filter::All())))]));
if (! ids->empty())
best = *ids->begin();
- auto installed_ids((*_imp->env)[selection::BestVersionInEachSlot(
- generator::Matches(spec, from_id, { }) |
- (_imp->target_destination_type == dt_install_to_chroot ?
- Filter(filter::InstalledNotAtRoot(_imp->env->system_root_key()->parse_value())) :
- Filter(filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))))]);
+ auto installed_ids(_imp->remove_hidden((*_imp->env)[selection::BestVersionInEachSlot(
+ generator::Matches(spec, from_id, { }) |
+ (_imp->target_destination_type == dt_install_to_chroot ?
+ Filter(filter::InstalledNotAtRoot(_imp->env->system_root_key()->parse_value())) :
+ Filter(filter::InstalledAtRoot(_imp->env->system_root_key()->parse_value()))))]));
if (! best)
std::copy(installed_ids->begin(), installed_ids->end(), result_ids->back_inserter());
diff --git a/paludis/resolver/get_resolvents_for_helper.hh b/paludis/resolver/get_resolvents_for_helper.hh
index 2c6c578..0786a94 100644
--- a/paludis/resolver/get_resolvents_for_helper.hh
+++ b/paludis/resolver/get_resolvents_for_helper.hh
@@ -25,6 +25,7 @@
#include <paludis/resolver/reason-fwd.hh>
#include <paludis/resolver/destination_types-fwd.hh>
#include <paludis/resolver/resolvent-fwd.hh>
+#include <paludis/resolver/resolver_functions.hh>
#include <paludis/util/pimp.hh>
#include <paludis/util/attributes.hh>
#include <paludis/package_id-fwd.hh>
@@ -43,7 +44,7 @@ namespace paludis
Pimp<GetResolventsForHelper> _imp;
public:
- explicit GetResolventsForHelper(const Environment * const);
+ explicit GetResolventsForHelper(const Environment * const, const RemoveHiddenFunction &);
~GetResolventsForHelper();
void set_target_destination_type(const DestinationType);
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 8bb6b34..81151a1 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -90,7 +90,6 @@ ResolverTestData::ResolverTestData(const std::string & t, const std::string & e,
get_destination_types_for_blocker_helper(&env),
get_destination_types_for_error_helper(&env),
get_initial_constraints_for_helper(&env),
- get_resolvents_for_helper(&env),
get_use_existing_nothing_helper(&env),
interest_in_spec_helper(&env),
make_destination_filtered_generator_helper(&env),
@@ -99,7 +98,8 @@ ResolverTestData::ResolverTestData(const std::string & t, const std::string & e,
order_early_helper(&env),
prefer_or_avoid_helper(&env),
remove_hidden_helper(&env),
- remove_if_dependent_helper(&env)
+ remove_if_dependent_helper(&env),
+ get_resolvents_for_helper(&env, std::cref(remove_hidden_helper))
{
std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
keys->insert("format", "e");
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index 84e7c27..fae6b67 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -107,7 +107,6 @@ namespace paludis
GetDestinationTypesForBlockerHelper get_destination_types_for_blocker_helper;
GetDestinationTypesForErrorHelper get_destination_types_for_error_helper;
GetInitialConstraintsForHelper get_initial_constraints_for_helper;
- GetResolventsForHelper get_resolvents_for_helper;
GetUseExistingNothingHelper get_use_existing_nothing_helper;
InterestInSpecHelper interest_in_spec_helper;
MakeDestinationFilteredGeneratorHelper make_destination_filtered_generator_helper;
@@ -117,6 +116,7 @@ namespace paludis
PreferOrAvoidHelper prefer_or_avoid_helper;
RemoveHiddenHelper remove_hidden_helper;
RemoveIfDependentHelper remove_if_dependent_helper;
+ GetResolventsForHelper get_resolvents_for_helper;
ResolverTestData(const std::string & group, const std::string & eapi, const std::string & layout);
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index f448587..63087b1 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -835,7 +835,13 @@ paludis::cave::resolve_common(
get_initial_constraints_for_helper.set_reinstall_scm_days(reinstall_scm_days(resolution_options));
- GetResolventsForHelper get_resolvents_for_helper(env.get());
+ RemoveHiddenHelper remove_hidden_helper(env.get());
+ for (args::StringSetArg::ConstIterator i(resolution_options.a_hide.begin_args()),
+ i_end(resolution_options.a_hide.end_args()) ;
+ i != i_end ; ++i)
+ remove_hidden_helper.add_hide_spec(parse_spec_with_nice_error(*i, env.get(), { updso_allow_wildcards }, filter::All()));
+
+ GetResolventsForHelper get_resolvents_for_helper(env.get(), std::cref(remove_hidden_helper));
get_resolvents_for_helper.set_target_destination_type(destination_type_from_arg(env.get(), resolution_options.a_make));
if (resolution_options.a_make_dependencies.argument() == "auto")
@@ -963,12 +969,6 @@ paludis::cave::resolve_common(
i != i_end ; ++i)
prefer_or_avoid_helper.add_avoid_name(disambiguate_if_necessary(env.get(), *i));
- RemoveHiddenHelper remove_hidden_helper(env.get());
- for (args::StringSetArg::ConstIterator i(resolution_options.a_hide.begin_args()),
- i_end(resolution_options.a_hide.end_args()) ;
- i != i_end ; ++i)
- remove_hidden_helper.add_hide_spec(parse_spec_with_nice_error(*i, env.get(), { updso_allow_wildcards }, filter::All()));
-
RemoveIfDependentHelper remove_if_dependent_helper(env.get());
for (args::StringSetArg::ConstIterator i(resolution_options.a_remove_if_dependent.begin_args()),
i_end(resolution_options.a_remove_if_dependent.end_args()) ;