aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-02 09:20:24 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-02 01:51:58 +0100
commit2908c5b1ee5df105cde0927bf3cbf7ff90d20b20 (patch)
treeec6948d32483ee046f27e5afdfaf183793070695
parent057bb9835c0533f2cc75c321b3f6645b7b1cf3b3 (diff)
downloadpaludis-2908c5b1ee5df105cde0927bf3cbf7ff90d20b20.tar.gz
paludis-2908c5b1ee5df105cde0927bf3cbf7ff90d20b20.tar.xz
betterer dumping
-rw-r--r--paludis/resolver/resolution.hh3
-rw-r--r--paludis/resolver/resolver.cc14
-rw-r--r--paludis/resolver/resolver.hh2
-rw-r--r--paludis/resolver/sanitised_dependencies.cc21
-rw-r--r--src/clients/cave/cmd_resolve.cc5
5 files changed, 39 insertions, 6 deletions
diff --git a/paludis/resolver/resolution.hh b/paludis/resolver/resolution.hh
index 864bc0d..b89304a 100644
--- a/paludis/resolver/resolution.hh
+++ b/paludis/resolver/resolution.hh
@@ -25,6 +25,7 @@
#include <paludis/resolver/constraint-fwd.hh>
#include <paludis/resolver/decision-fwd.hh>
#include <paludis/resolver/destinations-fwd.hh>
+#include <paludis/resolver/sanitised_dependencies-fwd.hh>
#include <paludis/util/named_value.hh>
#include <tr1/memory>
@@ -37,6 +38,7 @@ namespace paludis
struct constraints;
struct decision;
struct destinations;
+ struct sanitised_dependencies;
}
namespace resolver
@@ -48,6 +50,7 @@ namespace paludis
NamedValue<n::constraints, std::tr1::shared_ptr<Constraints> > constraints;
NamedValue<n::decision, std::tr1::shared_ptr<Decision> > decision;
NamedValue<n::destinations, std::tr1::shared_ptr<Destinations> > destinations;
+ NamedValue<n::sanitised_dependencies, std::tr1::shared_ptr<SanitisedDependencies> > sanitised_dependencies;
};
}
}
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 3412c38..e65ca17 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -365,7 +365,8 @@ Resolver::_create_resolution_for_qpn_s(const QPN_S & qpn_s) const
value_for<n::arrows>(make_shared_ptr(new ArrowSequence)),
value_for<n::constraints>(_initial_constraints_for(qpn_s)),
value_for<n::decision>(make_null_shared_ptr()),
- value_for<n::destinations>(make_null_shared_ptr())
+ value_for<n::destinations>(make_null_shared_ptr()),
+ value_for<n::sanitised_dependencies>(make_null_shared_ptr())
)));
}
@@ -587,6 +588,7 @@ Resolver::_add_dependencies(const QPN_S & our_qpn_s, const std::tr1::shared_ptr<
const std::tr1::shared_ptr<SanitisedDependencies> deps(new SanitisedDependencies);
deps->populate(*this, our_resolution->decision()->package_id());
+ our_resolution->sanitised_dependencies() = deps;
for (SanitisedDependencies::ConstIterator s(deps->begin()), s_end(deps->end()) ;
s != s_end ; ++s)
@@ -1002,7 +1004,7 @@ Resolver::end() const
}
void
-Resolver::dump(std::ostream & s) const
+Resolver::dump(std::ostream & s, const bool show_deps) const
{
s << "Initial Constraints:" << std::endl;
for (InitialConstraints::const_iterator i(_imp->initial_constraints.begin()),
@@ -1016,7 +1018,15 @@ Resolver::dump(std::ostream & s) const
for (ResolutionsByQPN_SMap::const_iterator i(_imp->resolutions_by_qpn_s.begin()),
i_end(_imp->resolutions_by_qpn_s.end()) ;
i != i_end ; ++i)
+ {
s << " [*] " << std::left << std::setw(30) << i->first << " " << *i->second << std::endl;
+ if (show_deps)
+ for (SanitisedDependencies::ConstIterator d(i->second->sanitised_dependencies()->begin()),
+ d_end(i->second->sanitised_dependencies()->end()) ;
+ d != d_end ; ++d)
+ s << " -> " << *d << std::endl;
+ }
+
s << std::endl;
s << "Ordered Resolutions:" << std::endl;
diff --git a/paludis/resolver/resolver.hh b/paludis/resolver/resolver.hh
index 039c536..3fb6ee6 100644
--- a/paludis/resolver/resolver.hh
+++ b/paludis/resolver/resolver.hh
@@ -159,7 +159,7 @@ namespace paludis
void add_initial_constraint(const QPN_S &, const std::tr1::shared_ptr<const Constraint> &);
void resolve();
- void dump(std::ostream &) const;
+ void dump(std::ostream &, const bool deps) const;
struct ConstIteratorTag;
typedef WrappedForwardIterator<ConstIteratorTag,
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index 9cc86e6..5735d01 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -24,6 +24,7 @@
#include <paludis/util/save.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/options.hh>
+#include <paludis/util/join.hh>
#include <paludis/spec_tree.hh>
#include <paludis/package_dep_spec_properties.hh>
#include <paludis/slot_requirement.hh>
@@ -512,7 +513,25 @@ SanitisedDependencies::end() const
std::ostream &
paludis::resolver::operator<< (std::ostream & s, const SanitisedDependency & d)
{
- s << d.spec();
+ std::stringstream ss;
+ ss << "Dep(" << d.spec();
+
+ if (! d.active_dependency_labels()->system_labels()->empty())
+ ss << " system { " << join(indirect_iterator(d.active_dependency_labels()->system_labels()->begin()),
+ indirect_iterator(d.active_dependency_labels()->system_labels()->end()), ", ") << " }";
+ if (! d.active_dependency_labels()->type_labels()->empty())
+ ss << " type { " << join(indirect_iterator(d.active_dependency_labels()->type_labels()->begin()),
+ indirect_iterator(d.active_dependency_labels()->type_labels()->end()), ", ") << " }";
+ if (! d.active_dependency_labels()->abi_labels()->empty())
+ ss << " abi { " << join(indirect_iterator(d.active_dependency_labels()->abi_labels()->begin()),
+ indirect_iterator(d.active_dependency_labels()->abi_labels()->end()), ", ") << " }";
+ if (! d.active_dependency_labels()->suggest_labels()->empty())
+ ss << " suggest { " << join(indirect_iterator(d.active_dependency_labels()->suggest_labels()->begin()),
+ indirect_iterator(d.active_dependency_labels()->suggest_labels()->end()), ", ") << " }";
+
+ ss << ")";
+
+ s << ss.str();
return s;
}
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index 73e8283..3e12430 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -348,7 +348,8 @@ namespace
g_dump_options(this, "Dump Options", "Dump the resolver's state to stdout after completion, or when an "
"error occurs. For debugging purposes; produces rather a lot of noise."),
a_dump(&g_dump_options, "dump", '\0', "Dump debug output", true),
- a_dump_dependencies(&g_dump_options, "dump-dependencies", '\0', "If dumping, also dump dependency information", true)
+ a_dump_dependencies(&g_dump_options, "dump-dependencies", '\0', "If dumping, also dump the "
+ "sanitised dependencies selected for every package" , true)
{
add_usage_line("[ -x|--execute ] [ -z|--lazy or -c|--complete or -e|--everything ] spec ...");
add_usage_line("[ -x|--execute ] [ -z|--lazy or -c|--complete or -e|--everything ] set");
@@ -472,7 +473,7 @@ namespace
Context context("When dumping the resolver:");
if (cmdline.a_dump.specified())
- resolver->dump(std::cerr);
+ resolver->dump(std::cerr, cmdline.a_dump_dependencies.specified());
}
}