aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-14 12:09:07 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-14 12:11:39 +0100
commitbf6cfe9d43403c955ed521821d18c5aef99c8675 (patch)
tree8e2239ad87c0887913074e5692a95bdd45df0e4f
parent961537a03c94b4bc74647f2a91e6703994fc6298 (diff)
downloadpaludis-bf6cfe9d43403c955ed521821d18c5aef99c8675.tar.gz
paludis-bf6cfe9d43403c955ed521821d18c5aef99c8675.tar.xz
Add resolvents to decisions
-rw-r--r--paludis/resolver/decider.cc22
-rw-r--r--paludis/resolver/decision.cc80
-rw-r--r--paludis/resolver/decision.hh14
3 files changed, 97 insertions, 19 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index b1786d3..ce14810 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -1371,6 +1371,7 @@ Decider::_try_to_find_decision_for(
{
/* nothing existing, but nothing's ok */
return make_shared_ptr(new NothingNoChangeDecision(
+ resolvent,
! resolution->constraints()->all_untaken()
));
}
@@ -1381,6 +1382,7 @@ Decider::_try_to_find_decision_for(
/* there's nothing suitable existing. we fix the last_ct when we do
* destinations. */
return make_shared_ptr(new ChangesToMakeDecision(
+ resolvent,
installable_id,
best,
last_ct,
@@ -1414,6 +1416,7 @@ Decider::_try_to_find_decision_for(
}
return make_shared_ptr(new ExistingNoChangeDecision(
+ resolvent,
existing_id,
true,
true,
@@ -1428,6 +1431,7 @@ Decider::_try_to_find_decision_for(
* able to remove things. */
if (resolution->constraints()->nothing_is_fine_too() && _installed_but_allowed_to_remove(resolvent))
return make_shared_ptr(new RemoveDecision(
+ resolvent,
_installed_ids(resolvent),
! resolution->constraints()->all_untaken()
));
@@ -1494,6 +1498,7 @@ Decider::_try_to_find_decision_for(
/* we've got existing and installable. do we have any reason not to pick the existing id? */
const std::tr1::shared_ptr<Decision> existing(new ExistingNoChangeDecision(
+ resolvent,
existing_id,
is_same,
is_same_version,
@@ -1501,6 +1506,7 @@ Decider::_try_to_find_decision_for(
! resolution->constraints()->all_untaken()
));
const std::tr1::shared_ptr<Decision> changes_to_make(new ChangesToMakeDecision(
+ resolvent,
installable_id,
best,
last_ct,
@@ -1513,6 +1519,7 @@ Decider::_try_to_find_decision_for(
case ue_only_if_transient:
case ue_never:
return make_shared_ptr(new ChangesToMakeDecision(
+ resolvent,
installable_id,
best,
last_ct,
@@ -1560,6 +1567,7 @@ Decider::_cannot_decide_for(
unsuitable_candidates->push_back(_make_unsuitable_candidate(resolvent, resolution, *i, false));
return make_shared_ptr(new UnableToMakeDecision(
+ resolvent,
unsuitable_candidates,
! resolution->constraints()->all_untaken()
));
@@ -1694,15 +1702,17 @@ Decider::_get_unmatching_constraints(
bool is_transient(id->behaviours_key() && id->behaviours_key()->value()->end() !=
id->behaviours_key()->value()->find("transient"));
decision.reset(new ExistingNoChangeDecision(
- id,
- true,
- true,
- is_transient,
- ! (*c)->untaken()
- ));
+ resolvent,
+ id,
+ true,
+ true,
+ is_transient,
+ ! (*c)->untaken()
+ ));
}
else
decision.reset(new ChangesToMakeDecision(
+ resolvent,
id,
false,
last_ct,
diff --git a/paludis/resolver/decision.cc b/paludis/resolver/decision.cc
index f2b001d..5f1473e 100644
--- a/paludis/resolver/decision.cc
+++ b/paludis/resolver/decision.cc
@@ -20,6 +20,7 @@
#include <paludis/resolver/decision.hh>
#include <paludis/resolver/destination.hh>
#include <paludis/resolver/unsuitable_candidates.hh>
+#include <paludis/resolver/resolvent.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
@@ -46,6 +47,7 @@ Decision::deserialise(Deserialisation & d)
{
Deserialisator v(d, "NothingNoChangeDecision");
return make_shared_ptr(new NothingNoChangeDecision(
+ v.member<Resolvent>("resolvent"),
v.member<bool>("taken")
));
}
@@ -53,6 +55,7 @@ Decision::deserialise(Deserialisation & d)
{
Deserialisator v(d, "ExistingNoChangeDecision");
return make_shared_ptr(new ExistingNoChangeDecision(
+ v.member<Resolvent>("resolvent"),
v.member<std::tr1::shared_ptr<const PackageID> >("existing_id"),
v.member<bool>("is_same"),
v.member<bool>("is_same_version"),
@@ -81,6 +84,7 @@ ChangesToMakeDecision::deserialise(Deserialisation & d)
{
Deserialisator v(d, "ChangesToMakeDecision");
return make_shared_ptr(new ChangesToMakeDecision(
+ v.member<Resolvent>("resolvent"),
v.member<std::tr1::shared_ptr<const PackageID> >("origin_id"),
v.member<bool>("best"),
destringify<ChangeType>(v.member<std::string>("change_type")),
@@ -100,6 +104,7 @@ UnableToMakeDecision::deserialise(Deserialisation & d)
unsuitable_candidates->push_back(vv.member<UnsuitableCandidate>(stringify(n)));
return make_shared_ptr(new UnableToMakeDecision(
+ v.member<Resolvent>("resolvent"),
unsuitable_candidates,
v.member<bool>("taken")
));
@@ -116,6 +121,7 @@ RemoveDecision::deserialise(Deserialisation & d)
ids->push_back(vv.member<std::tr1::shared_ptr<const PackageID> >(stringify(n)));
return make_shared_ptr(new RemoveDecision(
+ v.member<Resolvent>("resolvent"),
ids,
v.member<bool>("taken")
));
@@ -126,17 +132,19 @@ namespace paludis
template <>
struct Implementation<NothingNoChangeDecision>
{
+ const Resolvent resolvent;
const bool taken;
- Implementation(const bool t) :
+ Implementation(const Resolvent & r, const bool t) :
+ resolvent(r),
taken(t)
{
}
};
}
-NothingNoChangeDecision::NothingNoChangeDecision(const bool t) :
- PrivateImplementationPattern<NothingNoChangeDecision>(new Implementation<NothingNoChangeDecision>(t))
+NothingNoChangeDecision::NothingNoChangeDecision(const Resolvent & r, const bool t) :
+ PrivateImplementationPattern<NothingNoChangeDecision>(new Implementation<NothingNoChangeDecision>(r, t))
{
}
@@ -148,6 +156,12 @@ NothingNoChangeDecision::~NothingNoChangeDecision()
}
#endif
+const Resolvent
+NothingNoChangeDecision::resolvent() const
+{
+ return _imp->resolvent;
+}
+
bool
NothingNoChangeDecision::taken() const
{
@@ -158,6 +172,7 @@ void
NothingNoChangeDecision::serialise(Serialiser & s) const
{
s.object("NothingNoChangeDecision")
+ .member(SerialiserFlags<>(), "resolvent", resolvent())
.member(SerialiserFlags<>(), "taken", taken())
;
}
@@ -167,14 +182,17 @@ namespace paludis
template <>
struct Implementation<ExistingNoChangeDecision>
{
+ const Resolvent resolvent;
const std::tr1::shared_ptr<const PackageID> existing_id;
const bool is_same;
const bool is_same_version;
const bool is_transient;
const bool taken;
- Implementation(const std::tr1::shared_ptr<const PackageID> & e,
+ Implementation(const Resolvent & l,
+ const std::tr1::shared_ptr<const PackageID> & e,
const bool s, const bool v, const bool r, const bool t) :
+ resolvent(l),
existing_id(e),
is_same(s),
is_same_version(v),
@@ -185,10 +203,10 @@ namespace paludis
};
}
-ExistingNoChangeDecision::ExistingNoChangeDecision(const std::tr1::shared_ptr<const PackageID> & e,
+ExistingNoChangeDecision::ExistingNoChangeDecision(const Resolvent & l, const std::tr1::shared_ptr<const PackageID> & e,
const bool s, const bool v, const bool r, const bool t) :
PrivateImplementationPattern<ExistingNoChangeDecision>(new Implementation<ExistingNoChangeDecision>(
- e, s, v, r, t))
+ l, e, s, v, r, t))
{
}
@@ -224,6 +242,12 @@ ExistingNoChangeDecision::is_transient() const
return _imp->is_transient;
}
+const Resolvent
+ExistingNoChangeDecision::resolvent() const
+{
+ return _imp->resolvent;
+}
+
bool
ExistingNoChangeDecision::taken() const
{
@@ -234,6 +258,7 @@ void
ExistingNoChangeDecision::serialise(Serialiser & s) const
{
s.object("ExistingNoChangeDecision")
+ .member(SerialiserFlags<>(), "resolvent", resolvent())
.member(SerialiserFlags<serialise::might_be_null>(), "existing_id", existing_id())
.member(SerialiserFlags<>(), "is_same", is_same())
.member(SerialiserFlags<>(), "is_same_version", is_same_version())
@@ -247,6 +272,7 @@ namespace paludis
template <>
struct Implementation<ChangesToMakeDecision>
{
+ const Resolvent resolvent;
const std::tr1::shared_ptr<const PackageID> origin_id;
const bool best;
ChangeType change_type;
@@ -254,11 +280,13 @@ namespace paludis
std::tr1::shared_ptr<const Destination> destination;
Implementation(
+ const Resolvent & l,
const std::tr1::shared_ptr<const PackageID> & o,
const bool b,
const ChangeType c,
const bool t,
const std::tr1::shared_ptr<const Destination> & d) :
+ resolvent(l),
origin_id(o),
best(b),
change_type(c),
@@ -270,12 +298,13 @@ namespace paludis
}
ChangesToMakeDecision::ChangesToMakeDecision(
+ const Resolvent & r,
const std::tr1::shared_ptr<const PackageID> & o,
const bool b,
const ChangeType c,
const bool t,
const std::tr1::shared_ptr<const Destination> & d) :
- PrivateImplementationPattern<ChangesToMakeDecision>(new Implementation<ChangesToMakeDecision>(o, b, c, t, d))
+ PrivateImplementationPattern<ChangesToMakeDecision>(new Implementation<ChangesToMakeDecision>(r, o, b, c, t, d))
{
}
@@ -323,6 +352,12 @@ ChangesToMakeDecision::best() const
return _imp->best;
}
+const Resolvent
+ChangesToMakeDecision::resolvent() const
+{
+ return _imp->resolvent;
+}
+
bool
ChangesToMakeDecision::taken() const
{
@@ -333,6 +368,7 @@ void
ChangesToMakeDecision::serialise(Serialiser & s) const
{
s.object("ChangesToMakeDecision")
+ .member(SerialiserFlags<>(), "resolvent", resolvent())
.member(SerialiserFlags<serialise::might_be_null>(), "origin_id", origin_id())
.member(SerialiserFlags<>(), "best", best())
.member(SerialiserFlags<>(), "change_type", stringify(change_type()))
@@ -346,10 +382,13 @@ namespace paludis
template <>
struct Implementation<UnableToMakeDecision>
{
+ const Resolvent resolvent;
const std::tr1::shared_ptr<const UnsuitableCandidates> unsuitable_candidates;
const bool taken;
- Implementation(const std::tr1::shared_ptr<const UnsuitableCandidates> & u, const bool t) :
+ Implementation(const Resolvent & l,
+ const std::tr1::shared_ptr<const UnsuitableCandidates> & u, const bool t) :
+ resolvent(l),
unsuitable_candidates(u),
taken(t)
{
@@ -358,9 +397,10 @@ namespace paludis
}
UnableToMakeDecision::UnableToMakeDecision(
+ const Resolvent & l,
const std::tr1::shared_ptr<const UnsuitableCandidates> & u,
const bool t) :
- PrivateImplementationPattern<UnableToMakeDecision>(new Implementation<UnableToMakeDecision>(u, t))
+ PrivateImplementationPattern<UnableToMakeDecision>(new Implementation<UnableToMakeDecision>(l, u, t))
{
}
@@ -378,6 +418,12 @@ UnableToMakeDecision::unsuitable_candidates() const
return _imp->unsuitable_candidates;
}
+const Resolvent
+UnableToMakeDecision::resolvent() const
+{
+ return _imp->resolvent;
+}
+
bool
UnableToMakeDecision::taken() const
{
@@ -388,6 +434,7 @@ void
UnableToMakeDecision::serialise(Serialiser & s) const
{
s.object("UnableToMakeDecision")
+ .member(SerialiserFlags<>(), "resolvent", resolvent())
.member(SerialiserFlags<>(), "taken", taken())
.member(SerialiserFlags<serialise::might_be_null, serialise::container>(), "unsuitable_candidates", unsuitable_candidates())
;
@@ -398,10 +445,12 @@ namespace paludis
template <>
struct Implementation<RemoveDecision>
{
+ const Resolvent resolvent;
const std::tr1::shared_ptr<const PackageIDSequence> ids;
const bool taken;
- Implementation(const std::tr1::shared_ptr<const PackageIDSequence> & i, const bool t) :
+ Implementation(const Resolvent & l, const std::tr1::shared_ptr<const PackageIDSequence> & i, const bool t) :
+ resolvent(l),
ids(i),
taken(t)
{
@@ -409,8 +458,8 @@ namespace paludis
};
}
-RemoveDecision::RemoveDecision(const std::tr1::shared_ptr<const PackageIDSequence> & i, const bool t) :
- PrivateImplementationPattern<RemoveDecision>(new Implementation<RemoveDecision>(i, t))
+RemoveDecision::RemoveDecision(const Resolvent & l, const std::tr1::shared_ptr<const PackageIDSequence> & i, const bool t) :
+ PrivateImplementationPattern<RemoveDecision>(new Implementation<RemoveDecision>(l, i, t))
{
}
@@ -422,6 +471,12 @@ RemoveDecision::~RemoveDecision()
}
#endif
+const Resolvent
+RemoveDecision::resolvent() const
+{
+ return _imp->resolvent;
+}
+
bool
RemoveDecision::taken() const
{
@@ -438,6 +493,7 @@ void
RemoveDecision::serialise(Serialiser & s) const
{
s.object("RemoveDecision")
+ .member(SerialiserFlags<>(), "resolvent", resolvent())
.member(SerialiserFlags<>(), "taken", taken())
.member(SerialiserFlags<serialise::might_be_null, serialise::container>(), "ids", ids())
;
diff --git a/paludis/resolver/decision.hh b/paludis/resolver/decision.hh
index 877bbbf..2ae9e13 100644
--- a/paludis/resolver/decision.hh
+++ b/paludis/resolver/decision.hh
@@ -24,6 +24,7 @@
#include <paludis/resolver/destination-fwd.hh>
#include <paludis/resolver/unsuitable_candidates-fwd.hh>
#include <paludis/resolver/change_type-fwd.hh>
+#include <paludis/resolver/resolvent-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/type_list.hh>
@@ -42,6 +43,8 @@ namespace paludis
public:
virtual ~Decision() = 0;
+ virtual const Resolvent resolvent() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
virtual bool taken() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
virtual void serialise(Serialiser &) const = 0;
@@ -56,9 +59,10 @@ namespace paludis
private PrivateImplementationPattern<NothingNoChangeDecision>
{
public:
- NothingNoChangeDecision(const bool);
+ NothingNoChangeDecision(const Resolvent &, const bool);
~NothingNoChangeDecision();
+ virtual const Resolvent resolvent() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool taken() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void serialise(Serialiser &) const;
@@ -71,6 +75,7 @@ namespace paludis
{
public:
ExistingNoChangeDecision(
+ const Resolvent &,
const std::tr1::shared_ptr<const PackageID> &,
const bool is_same,
const bool is_same_version,
@@ -86,6 +91,7 @@ namespace paludis
bool is_same_version() const PALUDIS_ATTRIBUTE((warn_unused_result));
bool is_transient() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const Resolvent resolvent() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool taken() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void serialise(Serialiser &) const;
@@ -104,6 +110,7 @@ namespace paludis
{
public:
ChangesToMakeDecision(
+ const Resolvent &,
const std::tr1::shared_ptr<const PackageID> &,
const bool best,
const ChangeType,
@@ -127,6 +134,7 @@ namespace paludis
void set_change_type(ChangeType);
+ virtual const Resolvent resolvent() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool taken() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void serialise(Serialiser &) const;
@@ -143,10 +151,12 @@ namespace paludis
{
public:
RemoveDecision(
+ const Resolvent &,
const std::tr1::shared_ptr<const PackageIDSequence> &,
const bool taken);
~RemoveDecision();
+ virtual const Resolvent resolvent() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool taken() const PALUDIS_ATTRIBUTE((warn_unused_result));
const std::tr1::shared_ptr<const PackageIDSequence> ids() const
@@ -166,10 +176,12 @@ namespace paludis
{
public:
UnableToMakeDecision(
+ const Resolvent &,
const std::tr1::shared_ptr<const UnsuitableCandidates> &,
const bool taken);
~UnableToMakeDecision();
+ virtual const Resolvent resolvent() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool taken() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void serialise(Serialiser &) const;