aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-31 18:33:46 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-31 18:33:46 +0100
commit5a4904445ac9f34909491fd4c10192d9b6b0262f (patch)
tree96c930ec6b38a6bcbb628f08152b37968926b0ab
parent96580059b9fc73afcd1b7fbf7d67221c28403fae (diff)
downloadpaludis-5a4904445ac9f34909491fd4c10192d9b6b0262f.tar.gz
paludis-5a4904445ac9f34909491fd4c10192d9b6b0262f.tar.xz
Make --without imply nothing_is_fine_too
-rw-r--r--paludis/resolver/decider.cc12
-rw-r--r--paludis/resolver/resolver_TEST_continue_on_failure.cc6
-rw-r--r--paludis/resolver/resolver_TEST_cycles.cc10
-rw-r--r--paludis/resolver/resolver_TEST_purges.cc10
-rw-r--r--paludis/resolver/resolver_functions.hh8
-rw-r--r--paludis/resolver/resolver_test.cc8
-rw-r--r--paludis/resolver/resolver_test.hh2
-rw-r--r--src/clients/cave/resolve_common.cc42
8 files changed, 51 insertions, 47 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index b6bf420..eab4493 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -730,14 +730,16 @@ Decider::_make_constraints_from_target(
{
if (spec.if_package())
{
+ auto existing(_imp->fns.get_use_existing_nothing_fn()(resolution, *spec.if_package(), reason));
+
const std::shared_ptr<ConstraintSequence> result(std::make_shared<ConstraintSequence>());
result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = resolution->resolvent().destination_type(),
- n::nothing_is_fine_too() = false,
+ n::nothing_is_fine_too() = existing.second,
n::reason() = reason,
n::spec() = spec,
n::untaken() = false,
- n::use_existing() = _imp->fns.get_use_existing_fn()(resolution, *spec.if_package(), reason)
+ n::use_existing() = existing.first
)));
return result;
}
@@ -756,14 +758,16 @@ Decider::_make_constraints_from_dependency(
{
if (dep.spec().if_package())
{
+ auto existing(_imp->fns.get_use_existing_nothing_fn()(resolution, *dep.spec().if_package(), reason));
+
const std::shared_ptr<ConstraintSequence> result(std::make_shared<ConstraintSequence>());
result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = resolution->resolvent().destination_type(),
- n::nothing_is_fine_too() = false,
+ n::nothing_is_fine_too() = existing.second,
n::reason() = reason,
n::spec() = *dep.spec().if_package(),
n::untaken() = si_untaken == interest,
- n::use_existing() = _imp->fns.get_use_existing_fn()(resolution, *dep.spec().if_package(), reason)
+ n::use_existing() = existing.first
)));
return result;
}
diff --git a/paludis/resolver/resolver_TEST_continue_on_failure.cc b/paludis/resolver/resolver_TEST_continue_on_failure.cc
index a9e867d..610c199 100644
--- a/paludis/resolver/resolver_TEST_continue_on_failure.cc
+++ b/paludis/resolver/resolver_TEST_continue_on_failure.cc
@@ -67,13 +67,13 @@ namespace
}
};
- UseExisting
+ std::pair<UseExisting, bool>
use_existing_if_same(
const std::shared_ptr<const Resolution> &,
const PackageDepSpec &,
const std::shared_ptr<const Reason> &)
{
- return ue_if_same;
+ return std::make_pair(ue_if_same, false);
}
std::string
@@ -109,7 +109,7 @@ namespace test_cases
virtual ResolverFunctions get_resolver_functions(InitialConstraints & initial_constraints)
{
ResolverFunctions result(ResolverContinueOnFailureTestCase::get_resolver_functions(initial_constraints));
- result.get_use_existing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
+ result.get_use_existing_nothing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
return result;
}
diff --git a/paludis/resolver/resolver_TEST_cycles.cc b/paludis/resolver/resolver_TEST_cycles.cc
index ebba3cc..8744040 100644
--- a/paludis/resolver/resolver_TEST_cycles.cc
+++ b/paludis/resolver/resolver_TEST_cycles.cc
@@ -61,13 +61,13 @@ namespace
}
};
- UseExisting
+ std::pair<UseExisting, bool>
use_existing_if_same(
const std::shared_ptr<const Resolution> &,
const PackageDepSpec &,
const std::shared_ptr<const Reason> &)
{
- return ue_if_same;
+ return std::make_pair(ue_if_same, false);
}
}
@@ -85,7 +85,7 @@ namespace test_cases
virtual ResolverFunctions get_resolver_functions(InitialConstraints & initial_constraints)
{
ResolverFunctions result(ResolverCyclesTestCase::get_resolver_functions(initial_constraints));
- result.get_use_existing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
+ result.get_use_existing_nothing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
return result;
}
@@ -290,7 +290,7 @@ namespace test_cases
virtual ResolverFunctions get_resolver_functions(InitialConstraints & initial_constraints)
{
ResolverFunctions result(ResolverCyclesTestCase::get_resolver_functions(initial_constraints));
- result.get_use_existing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
+ result.get_use_existing_nothing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
return result;
}
@@ -359,7 +359,7 @@ namespace test_cases
virtual ResolverFunctions get_resolver_functions(InitialConstraints & initial_constraints)
{
ResolverFunctions result(ResolverCyclesTestCase::get_resolver_functions(initial_constraints));
- result.get_use_existing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
+ result.get_use_existing_nothing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
return result;
}
diff --git a/paludis/resolver/resolver_TEST_purges.cc b/paludis/resolver/resolver_TEST_purges.cc
index 7cb87cc..9611dac 100644
--- a/paludis/resolver/resolver_TEST_purges.cc
+++ b/paludis/resolver/resolver_TEST_purges.cc
@@ -62,16 +62,16 @@ namespace
}
};
- UseExisting
+ std::pair<UseExisting, bool>
use_existing_if_possible_except_target(
const std::shared_ptr<const Resolution> &,
const PackageDepSpec & s,
const std::shared_ptr<const Reason> &)
{
if (s.package_ptr() && s.package_ptr()->package() == PackageNamePart("target"))
- return ue_never;
+ return std::make_pair(ue_never, false);
else
- return ue_if_possible;
+ return std::make_pair(ue_if_possible, false);
}
}
@@ -96,7 +96,7 @@ namespace test_cases
virtual ResolverFunctions get_resolver_functions(InitialConstraints & initial_constraints)
{
ResolverFunctions result(ResolverPurgesTestCase::get_resolver_functions(initial_constraints));
- result.get_use_existing_fn() = std::bind(&use_existing_if_possible_except_target, std::placeholders::_1,
+ result.get_use_existing_nothing_fn() = std::bind(&use_existing_if_possible_except_target, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
return result;
}
@@ -140,7 +140,7 @@ namespace test_cases
virtual ResolverFunctions get_resolver_functions(InitialConstraints & initial_constraints)
{
ResolverFunctions result(ResolverPurgesTestCase::get_resolver_functions(initial_constraints));
- result.get_use_existing_fn() = std::bind(&use_existing_if_possible_except_target, std::placeholders::_1,
+ result.get_use_existing_nothing_fn() = std::bind(&use_existing_if_possible_except_target, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3);
result.confirm_fn() = std::bind(return_literal_function(false));
return result;
diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh
index 9891eb5..f8a0fe2 100644
--- a/paludis/resolver/resolver_functions.hh
+++ b/paludis/resolver/resolver_functions.hh
@@ -57,7 +57,7 @@ namespace paludis
typedef Name<struct get_destination_types_for_fn_name> get_destination_types_for_fn;
typedef Name<struct get_initial_constraints_for_fn_name> get_initial_constraints_for_fn;
typedef Name<struct get_resolvents_for_fn_name> get_resolvents_for_fn;
- typedef Name<struct get_use_existing_fn_name> get_use_existing_fn;
+ typedef Name<struct get_use_existing_nothing_fn_name> get_use_existing_nothing_fn;
typedef Name<struct interest_in_spec_fn_name> interest_in_spec_fn;
typedef Name<struct make_destination_filtered_generator_fn_name> make_destination_filtered_generator_fn;
typedef Name<struct make_origin_filtered_generator_fn_name> make_origin_filtered_generator_fn;
@@ -125,11 +125,11 @@ namespace paludis
const std::shared_ptr<const Reason> &
)> GetResolventsForFunction;
- typedef std::function<UseExisting (
+ typedef std::function<std::pair<UseExisting, bool> (
const std::shared_ptr<const Resolution> &,
const PackageDepSpec &,
const std::shared_ptr<const Reason> &
- )> GetUseExistingFunction;
+ )> GetUseExistingNothingFunction;
typedef std::function<SpecInterest (
const std::shared_ptr<const Resolution> &,
@@ -175,7 +175,7 @@ namespace paludis
NamedValue<n::get_destination_types_for_fn, GetDestinationTypesForFunction> get_destination_types_for_fn;
NamedValue<n::get_initial_constraints_for_fn, GetInitialConstraintsFunction> get_initial_constraints_for_fn;
NamedValue<n::get_resolvents_for_fn, GetResolventsForFunction> get_resolvents_for_fn;
- NamedValue<n::get_use_existing_fn, GetUseExistingFunction> get_use_existing_fn;
+ NamedValue<n::get_use_existing_nothing_fn, GetUseExistingNothingFunction> get_use_existing_nothing_fn;
NamedValue<n::interest_in_spec_fn, InterestInSpecFunction> interest_in_spec_fn;
NamedValue<n::make_destination_filtered_generator_fn,
MakeDestinationFilteredGeneratorFunction> make_destination_filtered_generator_fn;
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 4821f8f..bc83b52 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -183,13 +183,13 @@ paludis::resolver::resolver_test::interest_in_spec_fn(
return si_take;
}
-UseExisting
-paludis::resolver::resolver_test::get_use_existing_fn(
+std::pair<UseExisting, bool>
+paludis::resolver::resolver_test::get_use_existing_nothing_fn(
const std::shared_ptr<const Resolution> &,
const PackageDepSpec &,
const std::shared_ptr<const Reason> &)
{
- return ue_never;
+ return std::make_pair(ue_never, false);
}
const std::shared_ptr<const Repository>
@@ -410,7 +410,7 @@ ResolverTestCase::get_resolver_functions(InitialConstraints & initial_constraint
std::placeholders::_1),
n::get_resolvents_for_fn() = std::bind(&get_resolvents_for_fn, &env, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3),
- n::get_use_existing_fn() = &get_use_existing_fn,
+ n::get_use_existing_nothing_fn() = &get_use_existing_nothing_fn,
n::interest_in_spec_fn() = &interest_in_spec_fn,
n::make_destination_filtered_generator_fn() = &make_destination_filtered_generator_fn,
n::make_origin_filtered_generator_fn() = &make_origin_filtered_generator_fn,
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index 5522b74..ec6af11 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -89,7 +89,7 @@ namespace paludis
const std::shared_ptr<const SlotName> &,
const std::shared_ptr<const Reason> &);
- UseExisting get_use_existing_fn(
+ std::pair<UseExisting, bool> get_use_existing_nothing_fn(
const std::shared_ptr<const Resolution> &,
const PackageDepSpec &,
const std::shared_ptr<const Reason> &);
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index 9b1ff03..ee3ef71 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -398,46 +398,46 @@ namespace
{
}
- UseExisting visit(const DependencyReason &) const
+ std::pair<UseExisting, bool> visit(const DependencyReason &) const
{
- return use_existing_from_cmdline(resolution_options.a_keep, false);
+ return std::make_pair(use_existing_from_cmdline(resolution_options.a_keep, false), false);
}
- UseExisting visit(const TargetReason &) const
+ std::pair<UseExisting, bool> visit(const TargetReason &) const
{
- return use_existing_from_cmdline(resolution_options.a_keep_targets, from_set);
+ return std::make_pair(use_existing_from_cmdline(resolution_options.a_keep_targets, from_set), false);
}
- UseExisting visit(const DependentReason &) const
+ std::pair<UseExisting, bool> visit(const DependentReason &) const
{
- return ue_if_possible;
+ return std::make_pair(ue_if_possible, false);
}
- UseExisting visit(const WasUsedByReason &) const
+ std::pair<UseExisting, bool> visit(const WasUsedByReason &) const
{
- return ue_if_possible;
+ return std::make_pair(ue_if_possible, false);
}
- UseExisting visit(const PresetReason &) const
+ std::pair<UseExisting, bool> visit(const PresetReason &) const
{
- return ue_if_possible;
+ return std::make_pair(ue_if_possible, false);
}
- UseExisting visit(const ViaBinaryReason &) const
+ std::pair<UseExisting, bool> visit(const ViaBinaryReason &) const
{
- return ue_if_possible;
+ return std::make_pair(ue_if_possible, false);
}
- UseExisting visit(const SetReason & r) const
+ std::pair<UseExisting, bool> visit(const SetReason & r) const
{
UseExistingVisitor v(resolution_options, true);
- return r.reason_for_set()->accept_returning<UseExisting>(v);
+ return r.reason_for_set()->accept_returning<std::pair<UseExisting, bool> >(v);
}
- UseExisting visit(const LikeOtherDestinationTypeReason & r) const
+ std::pair<UseExisting, bool> visit(const LikeOtherDestinationTypeReason & r) const
{
UseExistingVisitor v(resolution_options, true);
- return r.reason_for_other()->accept_returning<UseExisting>(v);
+ return r.reason_for_other()->accept_returning<std::pair<UseExisting, bool> >(v);
}
};
@@ -472,7 +472,7 @@ namespace
return false;
}
- UseExisting use_existing_fn(
+ std::pair<UseExisting, bool> use_existing_nothing_fn(
const Environment * const env,
const ResolveCommandLineResolutionOptions & resolution_options,
const PackageDepSpecList & without,
@@ -484,13 +484,13 @@ namespace
if (spec.package_ptr())
{
if (use_existing_from_withish(env, *spec.package_ptr(), without))
- return ue_if_possible;
+ return std::make_pair(ue_if_possible, true);
if (use_existing_from_withish(env, *spec.package_ptr(), with))
- return ue_never;
+ return std::make_pair(ue_never, false);
}
UseExistingVisitor v(resolution_options, false);
- return reason->accept_returning<UseExisting>(v);
+ return reason->accept_returning<std::pair<UseExisting, bool> >(v);
}
int reinstall_scm_days(const ResolveCommandLineResolutionOptions & resolution_options)
@@ -1906,7 +1906,7 @@ paludis::cave::resolve_common(
std::cref(initial_constraints), all_binary_repos_generator, _1),
n::get_resolvents_for_fn() = std::bind(&get_resolvents_for_fn,
env.get(), std::cref(resolution_options), _1, _2, _3, DestinationTypes()),
- n::get_use_existing_fn() = std::bind(&use_existing_fn,
+ n::get_use_existing_nothing_fn() = std::bind(&use_existing_nothing_fn,
env.get(), std::cref(resolution_options), std::cref(without), std::cref(with), _1, _2, _3),
n::interest_in_spec_fn() = std::bind(&interest_in_spec_fn,
env.get(), std::cref(resolution_options), std::cref(take), std::cref(take_from),