aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-15 20:26:41 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-15 20:26:41 +0100
commit4647accd334b99314f394f9ee4dbdd5a1f15c2b8 (patch)
treefde0d1f2d2c6f1908c4d82465e23f648c9b0398e
parentcdca53e46b68e6ed5839e022b6b44dd2337be943 (diff)
downloadpaludis-4647accd334b99314f394f9ee4dbdd5a1f15c2b8.tar.gz
paludis-4647accd334b99314f394f9ee4dbdd5a1f15c2b8.tar.xz
Note when we do icky cycle breaking
-rw-r--r--paludis/resolver/lineariser.cc41
-rw-r--r--paludis/resolver/lineariser.hh6
-rw-r--r--paludis/resolver/lineariser_notes.cc6
-rw-r--r--paludis/resolver/lineariser_notes.hh8
-rw-r--r--src/clients/cave/cmd_display_resolution.cc5
5 files changed, 56 insertions, 10 deletions
diff --git a/paludis/resolver/lineariser.cc b/paludis/resolver/lineariser.cc
index 815fcaf..101bb1c 100644
--- a/paludis/resolver/lineariser.cc
+++ b/paludis/resolver/lineariser.cc
@@ -38,6 +38,7 @@
#include <paludis/util/join.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_shared_copy.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/environment.hh>
#include <paludis/notifier_callback.hh>
@@ -380,7 +381,10 @@ Lineariser::resolve()
{
/* there's only one real package in the component, so there's no
* need to try anything clever */
- schedule(_imp->change_or_remove_resolvents.find(*changes_in_scc.begin())->second);
+ schedule(_imp->change_or_remove_resolvents.find(*changes_in_scc.begin())->second,
+ make_shared_copy(make_named_values<LineariserNotes>(
+ n::cycle_breaking() = ""
+ )));
}
else
{
@@ -403,14 +407,23 @@ Lineariser::resolve()
/* now we try again, hopefully with lots of small SCCs now */
const std::tr1::shared_ptr<const SortedStronglyConnectedComponents> sub_ssccs(scc_nag.sorted_strongly_connected_components());
- linearise_sub_ssccs(scc_nag, sub_ssccs, true);
+ linearise_sub_ssccs(scc_nag, *scc, sub_ssccs, true);
}
}
}
+namespace
+{
+ std::string nice_resolvent(const Resolvent & r)
+ {
+ return stringify(r.package()) + stringify(r.slot());
+ }
+}
+
void
Lineariser::linearise_sub_ssccs(
const NAG & scc_nag,
+ const StronglyConnectedComponent & top_scc,
const std::tr1::shared_ptr<const SortedStronglyConnectedComponents> & sub_ssccs,
const bool can_recurse)
{
@@ -420,7 +433,12 @@ Lineariser::linearise_sub_ssccs(
if (sub_scc->nodes()->size() == 1)
{
/* yay. it's all on its own. */
- schedule(_imp->change_or_remove_resolvents.find(*sub_scc->nodes()->begin())->second);
+ schedule(_imp->change_or_remove_resolvents.find(*sub_scc->nodes()->begin())->second,
+ make_shared_copy(make_named_values<LineariserNotes>(
+ n::cycle_breaking() = (can_recurse ?
+ "In dependency cycle with existing packages: " :
+ "In dependency cycle with: ") + join(top_scc.nodes()->begin(), top_scc.nodes()->end(), ", ", nice_resolvent)
+ )));
}
else if (no_build_dependencies(*sub_scc->nodes(), scc_nag))
{
@@ -429,7 +447,12 @@ Lineariser::linearise_sub_ssccs(
* dependency cycles which we can order however we like! */
for (Set<Resolvent>::ConstIterator r(sub_scc->nodes()->begin()), r_end(sub_scc->nodes()->end()) ;
r != r_end ; ++r)
- schedule(_imp->change_or_remove_resolvents.find(*r)->second);
+ schedule(_imp->change_or_remove_resolvents.find(*r)->second,
+ make_shared_copy(make_named_values<LineariserNotes>(
+ n::cycle_breaking() = "In run dependency cycle with: " + join(
+ sub_scc->nodes()->begin(), sub_scc->nodes()->end(), ", ", nice_resolvent) + (can_recurse ?
+ " in dependency cycle with " + join(top_scc.nodes()->begin(), top_scc.nodes()->end(), ", ", nice_resolvent) : "")
+ )));
}
else if (can_recurse)
{
@@ -456,22 +479,24 @@ Lineariser::linearise_sub_ssccs(
const std::tr1::shared_ptr<const SortedStronglyConnectedComponents> sub_ssccs_without_met_deps(
scc_nag_without_met_deps.sorted_strongly_connected_components());
- linearise_sub_ssccs(scc_nag_without_met_deps, sub_ssccs_without_met_deps, false);
+ linearise_sub_ssccs(scc_nag_without_met_deps, top_scc, sub_ssccs_without_met_deps, false);
}
else
{
/* all that effort was wasted. there's incest and there's nothing we
* can do to fix it. */
throw InternalError(PALUDIS_HERE, "circular dependencies we're not smart enough to solve yet: { "
- + join(sub_scc->nodes()->begin(), sub_scc->nodes()->end(), ", ") + " }");
+ + join(sub_scc->nodes()->begin(), sub_scc->nodes()->end(), ", ", nice_resolvent) + " }");
}
}
}
void
-Lineariser::schedule(const std::tr1::shared_ptr<const ChangeOrRemoveDecision> & d)
+Lineariser::schedule(
+ const std::tr1::shared_ptr<const ChangeOrRemoveDecision> & d,
+ const std::tr1::shared_ptr<const LineariserNotes> & n)
{
- _imp->resolved->taken_change_or_remove_decisions()->push_back(d, make_shared_ptr(new LineariserNotes));
+ _imp->resolved->taken_change_or_remove_decisions()->push_back(d, n);
if (d->required_confirmations_if_any())
_imp->resolved->taken_unconfirmed_change_or_remove_decisions()->push_back(d);
diff --git a/paludis/resolver/lineariser.hh b/paludis/resolver/lineariser.hh
index ac69c50..36590f9 100644
--- a/paludis/resolver/lineariser.hh
+++ b/paludis/resolver/lineariser.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_LINEARISER_HH 1
#include <paludis/resolver/lineariser-fwd.hh>
+#include <paludis/resolver/lineariser_notes-fwd.hh>
#include <paludis/resolver/resolved-fwd.hh>
#include <paludis/resolver/decision-fwd.hh>
#include <paludis/resolver/strongly_connected_component-fwd.hh>
@@ -36,10 +37,13 @@ namespace paludis
private PrivateImplementationPattern<Lineariser>
{
private:
- void schedule(const std::tr1::shared_ptr<const ChangeOrRemoveDecision> &);
+ void schedule(
+ const std::tr1::shared_ptr<const ChangeOrRemoveDecision> &,
+ const std::tr1::shared_ptr<const LineariserNotes> &);
void linearise_sub_ssccs(
const NAG &,
+ const StronglyConnectedComponent & top_scc,
const std::tr1::shared_ptr<const SortedStronglyConnectedComponents> & sub_ssccs,
const bool can_recurse);
diff --git a/paludis/resolver/lineariser_notes.cc b/paludis/resolver/lineariser_notes.cc
index 16b2c42..4996996 100644
--- a/paludis/resolver/lineariser_notes.cc
+++ b/paludis/resolver/lineariser_notes.cc
@@ -19,6 +19,7 @@
#include <paludis/resolver/lineariser_notes.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/serialise-impl.hh>
using namespace paludis;
@@ -28,6 +29,7 @@ void
LineariserNotes::serialise(Serialiser & s) const
{
s.object("LineariserNotes")
+ .member(SerialiserFlags<>(), "cycle_breaking", cycle_breaking())
;
}
@@ -36,6 +38,8 @@ LineariserNotes::deserialise(Deserialisation & d)
{
Deserialisator v(d, "LineariserNotes");
- return make_shared_ptr(new LineariserNotes);
+ return make_shared_ptr(new LineariserNotes(make_named_values<LineariserNotes>(
+ n::cycle_breaking() = v.member<std::string>("cycle_breaking")
+ )));
}
diff --git a/paludis/resolver/lineariser_notes.hh b/paludis/resolver/lineariser_notes.hh
index 21ce339..d6599aa 100644
--- a/paludis/resolver/lineariser_notes.hh
+++ b/paludis/resolver/lineariser_notes.hh
@@ -22,15 +22,23 @@
#include <paludis/resolver/lineariser_notes-fwd.hh>
#include <paludis/util/attributes.hh>
+#include <paludis/util/named_value.hh>
#include <paludis/serialise-fwd.hh>
#include <tr1/memory>
namespace paludis
{
+ namespace n
+ {
+ typedef Name<struct cycle_breaking_name> cycle_breaking;
+ }
+
namespace resolver
{
struct LineariserNotes
{
+ NamedValue<n::cycle_breaking, std::string> cycle_breaking;
+
void serialise(Serialiser &) const;
static const std::tr1::shared_ptr<LineariserNotes> deserialise(
Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 6af82ca..7f6453f 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -52,6 +52,7 @@
#include <paludis/resolver/unsuitable_candidates.hh>
#include <paludis/resolver/decisions.hh>
#include <paludis/resolver/required_confirmations.hh>
+#include <paludis/resolver/lineariser_notes.hh>
#include <paludis/package_id.hh>
#include <paludis/version_spec.hh>
#include <paludis/metadata_key.hh>
@@ -668,6 +669,7 @@ namespace
const bool more_annotations,
const bool confirmations,
const bool untaken,
+ const std::string & notes,
ChoicesToExplain & choices_to_explain)
{
std::string x("X");
@@ -742,6 +744,8 @@ namespace
display_reasons(resolution, more_annotations);
if (confirmations)
display_confirmations(decision);
+ if (! notes.empty())
+ cout << " " << c::bold_normal() << notes << c::normal() << endl;
}
void display_one_uninstall(
@@ -1140,6 +1144,7 @@ namespace
more_annotations,
unconfirmed,
untaken,
+ star_i.second ? star_i.second->cycle_breaking() : "",
choices_to_explain);
}
else if (remove_decision)