diff options
author | 2012-08-16 20:16:31 +0100 | |
---|---|---|
committer | 2012-08-16 20:16:31 +0100 | |
commit | f5f8d71ebed1e1b001838a62dcda5100f86634ad (patch) | |
tree | e63d0f9928cf133babd5383ad1b33c5cfab68393 | |
parent | 4d09ff971069bc3c7f38bb514b9f25237eac99bd (diff) | |
download | paludis-f5f8d71ebed1e1b001838a62dcda5100f86634ad.tar.gz paludis-f5f8d71ebed1e1b001838a62dcda5100f86634ad.tar.xz |
More debugging information
-rw-r--r-- | paludis/resolver/orderer.cc | 2 | ||||
-rw-r--r-- | paludis/resolver/reason-fwd.hh | 5 | ||||
-rw-r--r-- | paludis/resolver/reason.cc | 61 |
3 files changed, 66 insertions, 2 deletions
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc index 47230a62a..5c7e690bc 100644 --- a/paludis/resolver/orderer.cc +++ b/paludis/resolver/orderer.cc @@ -498,7 +498,7 @@ Orderer::resolve() c_end((*r)->constraints()->end()) ; c != c_end ; ++c) { - Context subsubcontext("When handling constraint '" + stringify((*c)->spec()) + "':"); + Context subsubcontext("When handling constraint '" + stringify((*c)->spec()) + "' with reason '" + stringify(*(*c)->reason()) + "':"); (*c)->reason()->accept(edges_from_reason_visitor); } } diff --git a/paludis/resolver/reason-fwd.hh b/paludis/resolver/reason-fwd.hh index b6c6bdbe2..e10406b6a 100644 --- a/paludis/resolver/reason-fwd.hh +++ b/paludis/resolver/reason-fwd.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2009, 2010 Ciaran McCreesh + * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -22,6 +22,7 @@ #include <paludis/util/attributes.hh> #include <paludis/util/sequence-fwd.hh> +#include <iosfwd> #include <memory> namespace paludis @@ -40,6 +41,8 @@ namespace paludis typedef Sequence<std::shared_ptr<const Reason> > Reasons; } + + std::ostream & operator<< (std::ostream & s, const resolver::Reason & d) PALUDIS_VISIBLE; } #endif diff --git a/paludis/resolver/reason.cc b/paludis/resolver/reason.cc index f68241ed3..36cb23d30 100644 --- a/paludis/resolver/reason.cc +++ b/paludis/resolver/reason.cc @@ -27,6 +27,7 @@ #include <paludis/util/pimp-impl.hh> #include <paludis/util/sequence-impl.hh> #include <paludis/util/wrapped_forward_iterator-impl.hh> +#include <paludis/util/join.hh> #include <paludis/serialise-impl.hh> #include <paludis/changed_choices.hh> @@ -488,6 +489,65 @@ Reason::deserialise(Deserialisation & d) throw InternalError(PALUDIS_HERE, "unknown class '" + stringify(d.class_name()) + "'"); } +namespace +{ + std::string stringify_change_by_resolvent(const ChangeByResolvent & r) + { + return stringify(r.resolvent()); + } + + struct ReasonStringifier + { + std::string visit(const TargetReason &) const + { + return "target"; + } + + std::string visit(const DependencyReason & r) const + { + return "dependency from " + stringify(*r.from_id()); + } + + std::string visit(const DependentReason & r) const + { + return "dependent upon " + stringify(*r.dependent_upon().package_id()); + } + + std::string visit(const WasUsedByReason & r) const + { + return "was used by " + join(r.ids_and_resolvents_being_removed()->begin(), r.ids_and_resolvents_being_removed()->end(), + ", ", stringify_change_by_resolvent); + } + + std::string visit(const PresetReason &) const + { + return "preset"; + } + + std::string visit(const SetReason & r) const + { + return "set " + stringify(r.set_name()) + " due to " + r.reason_for_set()->accept_returning<std::string>(*this); + } + + std::string visit(const LikeOtherDestinationTypeReason & r) const + { + return "to be like " + stringify(r.other_resolvent()) + " due to " + r.reason_for_other()->accept_returning<std::string>(*this); + } + + std::string visit(const ViaBinaryReason & r) const + { + return "via binary for " + stringify(r.other_resolvent()); + } + }; +} + +std::ostream & +paludis::operator<< (std::ostream & s, const Reason & d) +{ + s << d.accept_returning<std::string>(ReasonStringifier()); + return s; +} + namespace paludis { template class Pimp<TargetReason>; @@ -502,3 +562,4 @@ namespace paludis template class Sequence<std::shared_ptr<const Reason> >; template class WrappedForwardIterator<Reasons::ConstIteratorTag, const std::shared_ptr<const Reason> >; } + |