aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-09-05 10:58:37 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-09-05 13:06:40 +0100
commit388ffabd070db3c41be152980fe2bec09cd39512 (patch)
tree34ca2f6db7bf1818d92032df0b88f3c628254036
parentf0b3612deba75050ce4ffee7d66488f544f48547 (diff)
downloadpaludis-388ffabd070db3c41be152980fe2bec09cd39512.tar.gz
paludis-388ffabd070db3c41be152980fe2bec09cd39512.tar.xz
Constraint::force_unable
-rw-r--r--paludis/resolver/constraint.cc13
-rw-r--r--paludis/resolver/constraint.hh3
-rw-r--r--paludis/resolver/decider.cc13
-rw-r--r--paludis/resolver/get_constraints_for_dependent_helper.cc1
-rw-r--r--paludis/resolver/get_constraints_for_purge_helper.cc1
-rw-r--r--paludis/resolver/get_constraints_for_via_binary_helper.cc1
-rw-r--r--paludis/resolver/get_initial_constraints_for_helper.cc2
7 files changed, 33 insertions, 1 deletions
diff --git a/paludis/resolver/constraint.cc b/paludis/resolver/constraint.cc
index c9a35e9..f23e187 100644
--- a/paludis/resolver/constraint.cc
+++ b/paludis/resolver/constraint.cc
@@ -41,13 +41,15 @@ namespace paludis
UseExisting strictest_use_existing;
bool nothing_is_fine_too;
bool all_untaken;
+ bool any_force_unable;
Sequence<std::shared_ptr<const Constraint> > constraints;
Imp() :
strictest_use_existing(static_cast<UseExisting>(last_ue - 1)),
nothing_is_fine_too(true),
- all_untaken(true)
+ all_untaken(true),
+ any_force_unable(false)
{
}
};
@@ -75,6 +77,12 @@ Constraints::all_untaken() const
}
bool
+Constraints::any_force_unable() const
+{
+ return _imp->any_force_unable;
+}
+
+bool
Constraints::nothing_is_fine_too() const
{
return _imp->nothing_is_fine_too;
@@ -105,6 +113,7 @@ Constraints::add(const std::shared_ptr<const Constraint> & c)
_imp->strictest_use_existing = std::min(_imp->strictest_use_existing, c->use_existing());
_imp->nothing_is_fine_too = _imp->nothing_is_fine_too && c->nothing_is_fine_too();
_imp->all_untaken = _imp->all_untaken && c->untaken();
+ _imp->any_force_unable = _imp->any_force_unable || c->force_unable();
}
bool
@@ -137,6 +146,7 @@ Constraint::serialise(Serialiser & s) const
{
s.object("Constraint")
.member(SerialiserFlags<>(), "destination_type", stringify(destination_type()))
+ .member(SerialiserFlags<>(), "force_unable", stringify(force_unable()))
.member(SerialiserFlags<>(), "nothing_is_fine_too", nothing_is_fine_too())
.member(SerialiserFlags<serialise::might_be_null>(), "reason", reason())
.member(SerialiserFlags<>(), "spec", spec())
@@ -203,6 +213,7 @@ Constraint::deserialise(Deserialisation & d)
return std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = destringify<DestinationType>(v.member<std::string>("destination_type")),
+ n::force_unable() = v.member<bool>("force_unable"),
n::nothing_is_fine_too() = v.member<bool>("nothing_is_fine_too"),
n::reason() = reason,
n::spec() = PackageOrBlockDepSpec::deserialise(*v.find_remove_member("spec"),
diff --git a/paludis/resolver/constraint.hh b/paludis/resolver/constraint.hh
index e1d4fa8..e7a97e4 100644
--- a/paludis/resolver/constraint.hh
+++ b/paludis/resolver/constraint.hh
@@ -36,6 +36,7 @@ namespace paludis
namespace n
{
typedef Name<struct destination_type_name> destination_type;
+ typedef Name<struct force_unable_name> force_unable;
typedef Name<struct nothing_is_fine_too_name> nothing_is_fine_too;
typedef Name<struct reason_name> reason;
typedef Name<struct spec_name> spec;
@@ -48,6 +49,7 @@ namespace paludis
struct Constraint
{
NamedValue<n::destination_type, DestinationType> destination_type;
+ NamedValue<n::force_unable, bool> force_unable;
NamedValue<n::nothing_is_fine_too, bool> nothing_is_fine_too;
NamedValue<n::reason, std::shared_ptr<const Reason> > reason;
NamedValue<n::spec, PackageOrBlockDepSpec> spec;
@@ -69,6 +71,7 @@ namespace paludis
bool nothing_is_fine_too() const PALUDIS_ATTRIBUTE((warn_unused_result));
bool all_untaken() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ bool any_force_unable() const PALUDIS_ATTRIBUTE((warn_unused_result));
UseExisting strictest_use_existing() const PALUDIS_ATTRIBUTE((warn_unused_result));
void add(const std::shared_ptr<const Constraint> &);
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index cc847b2..cb4e15c 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -610,6 +610,7 @@ Decider::_make_constraints_from_target(
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::force_unable() = false,
n::nothing_is_fine_too() = existing.second,
n::reason() = reason,
n::spec() = spec,
@@ -638,6 +639,7 @@ Decider::_make_constraints_from_dependency(
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::force_unable() = false,
n::nothing_is_fine_too() = existing.second,
n::reason() = reason,
n::spec() = *dep.spec().if_package(),
@@ -665,6 +667,7 @@ Decider::_make_constraints_from_blocker(
if (destination_types[*t])
result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = *t,
+ n::force_unable() = false,
n::nothing_is_fine_too() = true,
n::reason() = reason,
n::spec() = spec,
@@ -707,6 +710,9 @@ namespace
bool ok(const std::shared_ptr<const PackageID> & chosen_id,
const std::shared_ptr<const ChangedChoices> & changed_choices) const
{
+ if (constraint.force_unable())
+ return false;
+
if (constraint.spec().if_package())
{
if (! match_package_with_maybe_changes(*env, *constraint.spec().if_package(),
@@ -745,6 +751,9 @@ namespace
bool visit(const RemoveDecision &) const
{
+ if (constraint.force_unable())
+ return false;
+
return constraint.nothing_is_fine_too();
}
@@ -1511,6 +1520,9 @@ Decider::_try_to_find_decision_for(
const bool try_masked_this_time,
const bool try_removes_if_allowed) const
{
+ if (resolution->constraints()->any_force_unable())
+ return make_null_shared_ptr();
+
const std::shared_ptr<const PackageID> existing_id(_find_existing_id_for(resolution));
std::shared_ptr<const PackageID> installable_id;
@@ -2358,6 +2370,7 @@ namespace
std::shared_ptr<ConstraintSequence> result(std::make_shared<ConstraintSequence>());
result->push_back(make_shared_copy(make_named_values<Constraint>(
n::destination_type() = destination_type,
+ n::force_unable() = false,
n::nothing_is_fine_too() = true,
n::reason() = std::make_shared<LikeOtherDestinationTypeReason>(
resolvent,
diff --git a/paludis/resolver/get_constraints_for_dependent_helper.cc b/paludis/resolver/get_constraints_for_dependent_helper.cc
index 642699a..d27f9a6 100644
--- a/paludis/resolver/get_constraints_for_dependent_helper.cc
+++ b/paludis/resolver/get_constraints_for_dependent_helper.cc
@@ -93,6 +93,7 @@ GetConstraintsForDependentHelper::operator() (
result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = dt_install_to_slash,
+ n::force_unable() = false,
n::nothing_is_fine_too() = true,
n::reason() = reason,
n::spec() = BlockDepSpec("!" + stringify(*spec), *spec, bk_weak),
diff --git a/paludis/resolver/get_constraints_for_purge_helper.cc b/paludis/resolver/get_constraints_for_purge_helper.cc
index 625ae88..631a1e4 100644
--- a/paludis/resolver/get_constraints_for_purge_helper.cc
+++ b/paludis/resolver/get_constraints_for_purge_helper.cc
@@ -84,6 +84,7 @@ GetConstraintsForPurgeHelper::operator() (
result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = dt_install_to_slash,
+ n::force_unable() = false,
n::nothing_is_fine_too() = true,
n::reason() = reason,
n::spec() = BlockDepSpec("!" + stringify(spec), spec, bk_weak),
diff --git a/paludis/resolver/get_constraints_for_via_binary_helper.cc b/paludis/resolver/get_constraints_for_via_binary_helper.cc
index 3f4cd7c..ee7ea91 100644
--- a/paludis/resolver/get_constraints_for_via_binary_helper.cc
+++ b/paludis/resolver/get_constraints_for_via_binary_helper.cc
@@ -70,6 +70,7 @@ GetConstraintsForViaBinaryHelper::operator() (
result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = resolution->resolvent().destination_type(),
+ n::force_unable() = false,
n::nothing_is_fine_too() = false,
n::reason() = reason,
n::spec() = spec,
diff --git a/paludis/resolver/get_initial_constraints_for_helper.cc b/paludis/resolver/get_initial_constraints_for_helper.cc
index 3300976..a82a3ee 100644
--- a/paludis/resolver/get_initial_constraints_for_helper.cc
+++ b/paludis/resolver/get_initial_constraints_for_helper.cc
@@ -100,6 +100,7 @@ GetInitialConstraintsForHelper::add_preset_spec(const PackageDepSpec & spec)
const std::shared_ptr<Constraint> constraint(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = r.destination_type(),
+ n::force_unable() = false,
n::nothing_is_fine_too() = true,
n::reason() = reason,
n::spec() = spec,
@@ -252,6 +253,7 @@ GetInitialConstraintsForHelper::_make_initial_constraints_for(
{
result->add(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = resolvent.destination_type(),
+ n::force_unable() = false,
n::nothing_is_fine_too() = true,
n::reason() = std::make_shared<PresetReason>("is scm", make_null_shared_ptr()),
n::spec() = make_package_dep_spec({ }).package(resolvent.package()),