aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-27 19:06:22 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-27 19:20:50 +0100
commit3adb65ec6115d08f8af36a739dca1840dce099c9 (patch)
treea8779d62089d33d49a2f42f0519d347a5a2c8a4a
parent676900a5ce9d2023915def9bfc451e64c795d424 (diff)
downloadpaludis-3adb65ec6115d08f8af36a739dca1840dce099c9.tar.gz
paludis-3adb65ec6115d08f8af36a739dca1840dce099c9.tar.xz
more information about arrows
-rw-r--r--paludis/resolver/arrow.cc5
-rw-r--r--paludis/resolver/arrow.hh3
-rw-r--r--paludis/resolver/resolver.cc34
3 files changed, 39 insertions, 3 deletions
diff --git a/paludis/resolver/arrow.cc b/paludis/resolver/arrow.cc
index f4d31f3..240c353 100644
--- a/paludis/resolver/arrow.cc
+++ b/paludis/resolver/arrow.cc
@@ -19,6 +19,7 @@
#include <paludis/resolver/arrow.hh>
#include <paludis/resolver/serialise-impl.hh>
+#include <paludis/resolver/reason.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
@@ -32,6 +33,7 @@ Arrow::serialise(Serialiser & s) const
s.object("Arrow")
.member(SerialiserFlags<>(), "comes_after", comes_after())
.member(SerialiserFlags<>(), "ignorable_pass", ignorable_pass())
+ .member(SerialiserFlags<serialise::might_be_null>(), "reason", reason())
;
}
@@ -41,7 +43,8 @@ Arrow::deserialise(Deserialisation & d)
Deserialisator v(d, "Arrow");
return make_shared_ptr(new Arrow(make_named_values<Arrow>(
value_for<n::comes_after>(v.member<Resolvent>("comes_after")),
- value_for<n::ignorable_pass>(v.member<bool>("ignorable_pass"))
+ value_for<n::ignorable_pass>(v.member<bool>("ignorable_pass")),
+ value_for<n::reason>(v.member<std::tr1::shared_ptr<const Reason> >("reason"))
)));
}
diff --git a/paludis/resolver/arrow.hh b/paludis/resolver/arrow.hh
index 98562b4..b79cea1 100644
--- a/paludis/resolver/arrow.hh
+++ b/paludis/resolver/arrow.hh
@@ -23,6 +23,7 @@
#include <paludis/resolver/arrow-fwd.hh>
#include <paludis/resolver/resolvent.hh>
#include <paludis/resolver/serialise-fwd.hh>
+#include <paludis/resolver/reason-fwd.hh>
#include <paludis/util/named_value.hh>
namespace paludis
@@ -31,6 +32,7 @@ namespace paludis
{
struct comes_after;
struct ignorable_pass;
+ struct reason;
}
namespace resolver
@@ -39,6 +41,7 @@ namespace paludis
{
NamedValue<n::comes_after, Resolvent> comes_after;
NamedValue<n::ignorable_pass, int> ignorable_pass;
+ NamedValue<n::reason, std::tr1::shared_ptr<const Reason> > reason;
void serialise(Serialiser &) const;
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index eef951a..35416df 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -925,7 +925,8 @@ Resolver::_resolve_arrow(
{
resolution->arrows()->push_back(make_shared_ptr(new Arrow(make_named_values<Arrow>(
value_for<n::comes_after>(resolvent),
- value_for<n::ignorable_pass>(0)
+ value_for<n::ignorable_pass>(0),
+ value_for<n::reason>(constraint->reason())
))));
}
}
@@ -942,7 +943,8 @@ Resolver::_resolve_arrow(
resolution->arrows()->push_back(make_shared_ptr(new Arrow(make_named_values<Arrow>(
value_for<n::comes_after>(resolvent),
- value_for<n::ignorable_pass>(ignorable_pass)
+ value_for<n::ignorable_pass>(ignorable_pass),
+ value_for<n::reason>(constraint->reason())
))));
}
}
@@ -1281,6 +1283,33 @@ Resolver::find_any_score(const Resolvent & our_resolvent, const SanitisedDepende
return 0;
}
+namespace
+{
+ struct ReasonDescriber
+ {
+ const std::string visit(const DependencyReason & r) const
+ {
+ return " (" + r.sanitised_dependency().active_dependency_labels_as_string() + " " +
+ stringify(r.sanitised_dependency().spec()) + ")";
+ }
+
+ const std::string visit(const TargetReason &) const
+ {
+ return "";
+ }
+
+ const std::string visit(const PresetReason &) const
+ {
+ return "";
+ }
+
+ const std::string visit(const SetReason &) const
+ {
+ return "";
+ }
+ };
+}
+
const std::string
Resolver::_find_cycle(const Resolvent & start_resolvent, const int ignorable_pass) const
{
@@ -1314,6 +1343,7 @@ Resolver::_find_cycle(const Resolvent & start_resolvent, const int ignorable_pas
continue;
ok = true;
+ result << (*a)->reason()->accept_returning<std::string>(ReasonDescriber());
current = (*a)->comes_after();
break;
}