aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-29 13:30:45 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-29 13:30:45 +0100
commitbf9034006571dcdd6d911df490fa5257e4e5a1d5 (patch)
treefab4fc537b5a7829b5be5ee002b00486f0492deb
parent1f0c1eef60d958954dba2cdc1af89c7602745ee1 (diff)
downloadpaludis-bf9034006571dcdd6d911df490fa5257e4e5a1d5.tar.gz
paludis-bf9034006571dcdd6d911df490fa5257e4e5a1d5.tar.xz
Track resolvents for uninstall reasons
-rw-r--r--paludis/resolver/Makefile.am2
-rw-r--r--paludis/resolver/change_by_resolvent-fwd.hh35
-rw-r--r--paludis/resolver/change_by_resolvent.cc51
-rw-r--r--paludis/resolver/change_by_resolvent.hh57
-rw-r--r--paludis/resolver/decider.cc149
-rw-r--r--paludis/resolver/decider.hh17
-rw-r--r--paludis/resolver/reason.cc38
-rw-r--r--paludis/resolver/reason.hh9
-rw-r--r--paludis/resolver/resolver_functions.hh5
-rw-r--r--paludis/resolver/resolver_test.cc7
-rw-r--r--paludis/resolver/resolver_test.hh5
-rw-r--r--src/clients/cave/cmd_display_resolution.cc15
-rw-r--r--src/clients/cave/cmd_resolve_dump.cc12
-rw-r--r--src/clients/cave/resolve_common.cc20
14 files changed, 328 insertions, 94 deletions
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index 94d7e78..561f8f8 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -29,6 +29,7 @@ BUILT_SOURCES = \
noinst_HEADERS = \
any_child_score.hh any_child_score-fwd.hh any_child_score-se.hh \
+ change_by_resolvent.hh change_by_resolvent-fwd.hh \
change_type.hh change_type-fwd.hh change_type-se.hh \
constraint.hh constraint-fwd.hh \
decider.hh decider-fwd.hh \
@@ -63,6 +64,7 @@ noinst_HEADERS = \
libpaludisresolver_a_SOURCES = \
any_child_score.cc \
+ change_by_resolvent.cc \
change_type.cc \
constraint.cc \
decider.cc \
diff --git a/paludis/resolver/change_by_resolvent-fwd.hh b/paludis/resolver/change_by_resolvent-fwd.hh
new file mode 100644
index 0000000..600ff88
--- /dev/null
+++ b/paludis/resolver/change_by_resolvent-fwd.hh
@@ -0,0 +1,35 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_CHANGE_BY_RESOLVENT_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_RESOLVER_CHANGE_BY_RESOLVENT_FWD_HH 1
+
+#include <paludis/util/sequence-fwd.hh>
+
+namespace paludis
+{
+ namespace resolver
+ {
+ struct ChangeByResolvent;
+
+ typedef Sequence<ChangeByResolvent> ChangeByResolventSequence;
+ }
+}
+
+#endif
diff --git a/paludis/resolver/change_by_resolvent.cc b/paludis/resolver/change_by_resolvent.cc
new file mode 100644
index 0000000..03e0a26
--- /dev/null
+++ b/paludis/resolver/change_by_resolvent.cc
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/resolver/change_by_resolvent.hh>
+#include <paludis/resolver/resolvent.hh>
+#include <paludis/util/sequence-impl.hh>
+#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/serialise-impl.hh>
+
+using namespace paludis;
+using namespace paludis::resolver;
+
+void
+ChangeByResolvent::serialise(Serialiser & s) const
+{
+ s.object("ChangeByResolvent")
+ .member(SerialiserFlags<serialise::might_be_null>(), "package_id", package_id())
+ .member(SerialiserFlags<>(), "resolvent", resolvent())
+ ;
+}
+
+const ChangeByResolvent
+ChangeByResolvent::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "ChangeByResolvent");
+ return make_named_values<ChangeByResolvent>(
+ n::package_id() = v.member<std::tr1::shared_ptr<const PackageID> >("package_id"),
+ n::resolvent() = v.member<Resolvent>("resolvent")
+ );
+}
+
+template class Sequence<ChangeByResolvent>;
+template class WrappedForwardIterator<Sequence<ChangeByResolvent>::ConstIteratorTag, const ChangeByResolvent>;
+
diff --git a/paludis/resolver/change_by_resolvent.hh b/paludis/resolver/change_by_resolvent.hh
new file mode 100644
index 0000000..8a1119c
--- /dev/null
+++ b/paludis/resolver/change_by_resolvent.hh
@@ -0,0 +1,57 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_CHANGE_BY_RESOLVENT_HH
+#define PALUDIS_GUARD_PALUDIS_RESOLVER_CHANGE_BY_RESOLVENT_HH 1
+
+#include <paludis/resolver/change_by_resolvent-fwd.hh>
+#include <paludis/resolver/resolvent.hh>
+#include <paludis/util/named_value.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/serialise-fwd.hh>
+
+namespace paludis
+{
+ namespace n
+ {
+ typedef Name<struct package_id_name> package_id;
+ typedef Name<struct resolvent_name> resolvent;
+ }
+
+ namespace resolver
+ {
+ struct ChangeByResolvent
+ {
+ NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
+ NamedValue<n::resolvent, Resolvent> resolvent;
+
+ void serialise(Serialiser &) const;
+ static const ChangeByResolvent deserialise(Deserialisation &) PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+ }
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class Sequence<resolver::ChangeByResolvent>;
+ extern template class WrappedForwardIterator<Sequence<resolver::ChangeByResolvent>::ConstIteratorTag, const resolver::ChangeByResolvent>;
+#endif
+}
+
+#endif
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index 03356e6..6cb4c42 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -31,6 +31,7 @@
#include <paludis/resolver/unsuitable_candidates.hh>
#include <paludis/resolver/resolver.hh>
#include <paludis/resolver/required_confirmations.hh>
+#include <paludis/resolver/change_by_resolvent.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_named_values.hh>
@@ -146,8 +147,8 @@ Decider::_resolve_dependents()
bool changed(false);
const std::pair<
- std::tr1::shared_ptr<const PackageIDSequence>,
- std::tr1::shared_ptr<const PackageIDSequence> > changing(_collect_changing());
+ std::tr1::shared_ptr<const ChangeByResolventSequence>,
+ std::tr1::shared_ptr<const ChangeByResolventSequence> > changing(_collect_changing());
if (changing.first->empty())
return false;
@@ -159,7 +160,7 @@ Decider::_resolve_dependents()
{
_imp->env->trigger_notifier_callback(NotifierCallbackResolverStepEvent());
- const std::tr1::shared_ptr<const PackageIDSequence> dependent_upon(_dependent_upon(
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> dependent_upon(_dependent_upon(
*s, changing.first, changing.second));
if (dependent_upon->empty())
continue;
@@ -194,28 +195,39 @@ const std::tr1::shared_ptr<ConstraintSequence>
Decider::_make_constraints_for_dependent(
const std::tr1::shared_ptr<const Resolution> & resolution,
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & r) const
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & r) const
{
return _imp->fns.get_constraints_for_dependent_fn()(resolution, id, r);
}
namespace
{
+ const std::tr1::shared_ptr<const PackageID> dependent_checker_id(const std::tr1::shared_ptr<const PackageID> & i)
+ {
+ return i;
+ }
+
+ const std::tr1::shared_ptr<const PackageID> dependent_checker_id(const ChangeByResolvent & i)
+ {
+ return i.package_id();
+ }
+
+ template <typename C_>
struct DependentChecker
{
const Environment * const env;
- const std::tr1::shared_ptr<const PackageIDSequence> going_away;
- const std::tr1::shared_ptr<const PackageIDSequence> newly_available;
- const std::tr1::shared_ptr<PackageIDSequence> result;
+ const std::tr1::shared_ptr<const C_> going_away;
+ const std::tr1::shared_ptr<const C_> newly_available;
+ const std::tr1::shared_ptr<C_> result;
DependentChecker(
const Environment * const e,
- const std::tr1::shared_ptr<const PackageIDSequence> & g,
- const std::tr1::shared_ptr<const PackageIDSequence> & n) :
+ const std::tr1::shared_ptr<const C_> & g,
+ const std::tr1::shared_ptr<const C_> & n) :
env(e),
going_away(g),
newly_available(n),
- result(new PackageIDSequence)
+ result(new C_)
{
}
@@ -227,16 +239,24 @@ namespace
void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & s)
{
- for (PackageIDSequence::ConstIterator g(going_away->begin()), g_end(going_away->end()) ;
+ for (typename C_::ConstIterator g(going_away->begin()), g_end(going_away->end()) ;
g != g_end ; ++g)
{
- if (! match_package(*env, *s.spec(), **g, MatchPackageOptions()))
+ if (! match_package(*env, *s.spec(), *dependent_checker_id(*g), MatchPackageOptions()))
continue;
- if (indirect_iterator(newly_available->end()) == std::find_if(
- indirect_iterator(newly_available->begin()), indirect_iterator(newly_available->end()),
- std::tr1::bind(&match_package, std::tr1::cref(*env), std::tr1::cref(*s.spec()),
- std::tr1::placeholders::_1, MatchPackageOptions())))
+ bool any(false);
+ for (typename C_::ConstIterator n(newly_available->begin()), n_end(newly_available->end()) ;
+ n != n_end ; ++n)
+ {
+ if (match_package(*env, *s.spec(), *dependent_checker_id(*n), MatchPackageOptions()))
+ {
+ any = true;
+ break;
+ }
+ }
+
+ if (! any)
result->push_back(*g);
}
}
@@ -268,15 +288,20 @@ namespace
{
}
};
+
+ const std::tr1::shared_ptr<const PackageID> get_change_by_resolvent_id(const ChangeByResolvent & r)
+ {
+ return r.package_id();
+ }
}
-const std::tr1::shared_ptr<const PackageIDSequence>
+const std::tr1::shared_ptr<const ChangeByResolventSequence>
Decider::_dependent_upon(
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & going_away,
- const std::tr1::shared_ptr<const PackageIDSequence> & staying) const
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & going_away,
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & staying) const
{
- DependentChecker c(_imp->env, going_away, staying);
+ DependentChecker<ChangeByResolventSequence> c(_imp->env, going_away, staying);
if (id->dependencies_key())
id->dependencies_key()->value()->root()->accept(c);
else
@@ -298,12 +323,14 @@ namespace
{
struct ChangingCollector
{
- std::tr1::shared_ptr<PackageIDSequence> going_away;
- std::tr1::shared_ptr<PackageIDSequence> newly_available;
+ std::tr1::shared_ptr<Resolution> current_resolution;
+
+ std::tr1::shared_ptr<ChangeByResolventSequence> going_away;
+ std::tr1::shared_ptr<ChangeByResolventSequence> newly_available;
ChangingCollector() :
- going_away(new PackageIDSequence),
- newly_available(new PackageIDSequence)
+ going_away(new ChangeByResolventSequence),
+ newly_available(new ChangeByResolventSequence)
{
}
@@ -317,14 +344,27 @@ namespace
void visit(const RemoveDecision & d)
{
- std::copy(d.ids()->begin(), d.ids()->end(), going_away->back_inserter());
+ for (PackageIDSequence::ConstIterator i(d.ids()->begin()), i_end(d.ids()->end()) ;
+ i != i_end ; ++i)
+ going_away->push_back(make_named_values<ChangeByResolvent>(
+ n::package_id() = *i,
+ n::resolvent() = current_resolution->resolvent()
+ ));
}
void visit(const ChangesToMakeDecision & d)
{
- std::copy(d.destination()->replacing()->begin(), d.destination()->replacing()->end(),
- going_away->back_inserter());
- newly_available->push_back(d.origin_id());
+ for (PackageIDSequence::ConstIterator i(d.destination()->replacing()->begin()), i_end(d.destination()->replacing()->end()) ;
+ i != i_end ; ++i)
+ going_away->push_back(make_named_values<ChangeByResolvent>(
+ n::package_id() = *i,
+ n::resolvent() = current_resolution->resolvent()
+ ));
+
+ newly_available->push_back(make_named_values<ChangeByResolvent>(
+ n::package_id() = d.origin_id(),
+ n::resolvent() = current_resolution->resolvent()
+ ));
}
void visit(const UnableToMakeDecision &)
@@ -338,8 +378,8 @@ namespace
}
const std::pair<
- std::tr1::shared_ptr<const PackageIDSequence>,
- std::tr1::shared_ptr<const PackageIDSequence> >
+ std::tr1::shared_ptr<const ChangeByResolventSequence>,
+ std::tr1::shared_ptr<const ChangeByResolventSequence> >
Decider::_collect_changing() const
{
ChangingCollector c;
@@ -348,13 +388,34 @@ Decider::_collect_changing() const
i_end(_imp->resolutions_by_resolvent->end()) ;
i != i_end ; ++i)
if ((*i)->decision() && (*i)->decision()->taken())
+ {
+ c.current_resolution = *i;
(*i)->decision()->accept(c);
+ }
return std::make_pair(c.going_away, c.newly_available);
}
+namespace
+{
+ struct ChangeByResolventPackageIDIs
+ {
+ const std::tr1::shared_ptr<const PackageID> id;
+
+ ChangeByResolventPackageIDIs(const std::tr1::shared_ptr<const PackageID> & i) :
+ id(i)
+ {
+ }
+
+ bool operator() (const ChangeByResolvent & r) const
+ {
+ return *r.package_id() == *id;
+ }
+ };
+}
+
const std::tr1::shared_ptr<const PackageIDSequence>
-Decider::_collect_staying(const std::tr1::shared_ptr<const PackageIDSequence> & going_away) const
+Decider::_collect_staying(const std::tr1::shared_ptr<const ChangeByResolventSequence> & going_away) const
{
const std::tr1::shared_ptr<const PackageIDSequence> existing((*_imp->env)[selection::AllVersionsUnsorted(
generator::All() | filter::InstalledAtRoot(FSEntry("/")))]);
@@ -362,8 +423,7 @@ Decider::_collect_staying(const std::tr1::shared_ptr<const PackageIDSequence> &
const std::tr1::shared_ptr<PackageIDSequence> result(new PackageIDSequence);
for (PackageIDSequence::ConstIterator x(existing->begin()), x_end(existing->end()) ;
x != x_end ; ++x)
- if (indirect_iterator(going_away->end()) == std::find(indirect_iterator(going_away->begin()),
- indirect_iterator(going_away->end()), **x))
+ if (going_away->end() == std::find_if(going_away->begin(), going_away->end(), ChangeByResolventPackageIDIs(*x)))
result->push_back(*x);
return result;
@@ -1781,7 +1841,7 @@ Decider::purge()
if (resolution->decision())
continue;
- const std::tr1::shared_ptr<const PackageIDSequence> used_to_use(new PackageIDSequence);
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> used_to_use(new ChangeByResolventSequence);
const std::tr1::shared_ptr<const ConstraintSequence> constraints(_make_constraints_for_purge(resolution, *i, used_to_use));
for (ConstraintSequence::ConstIterator c(constraints->begin()), c_end(constraints->end()) ;
c != c_end ; ++c)
@@ -1946,14 +2006,16 @@ Decider::_resolve_purges()
Context context("When finding things to purge:");
const std::pair<
- std::tr1::shared_ptr<const PackageIDSequence>,
- std::tr1::shared_ptr<const PackageIDSequence> > going_away_newly_available(_collect_changing());
+ std::tr1::shared_ptr<const ChangeByResolventSequence>,
+ std::tr1::shared_ptr<const ChangeByResolventSequence> > going_away_newly_available(_collect_changing());
const std::tr1::shared_ptr<PackageIDSet> going_away(new PackageIDSet);
- std::copy(going_away_newly_available.first->begin(), going_away_newly_available.first->end(), going_away->inserter());
+ std::transform(going_away_newly_available.first->begin(), going_away_newly_available.first->end(),
+ going_away->inserter(), get_change_by_resolvent_id);
const std::tr1::shared_ptr<PackageIDSet> newly_available(new PackageIDSet);
- std::copy(going_away_newly_available.second->begin(), going_away_newly_available.second->end(), newly_available->inserter());
+ std::transform(going_away_newly_available.second->begin(), going_away_newly_available.second->end(),
+ newly_available->inserter(), get_change_by_resolvent_id);
const std::tr1::shared_ptr<const PackageIDSet> have_now(_collect_installed());
@@ -2016,11 +2078,12 @@ Decider::_resolve_purges()
if (match_package_in_set(*_imp->env, *world, **i, MatchPackageOptions()))
continue;
- const std::tr1::shared_ptr<PackageIDSequence> used_to_use(new PackageIDSequence), star_i_set(new PackageIDSequence);
+ const std::tr1::shared_ptr<ChangeByResolventSequence> used_to_use(new ChangeByResolventSequence);
+ const std::tr1::shared_ptr<PackageIDSequence> star_i_set(new PackageIDSequence);
star_i_set->push_back(*i);
- for (PackageIDSet::ConstIterator g(going_away->begin()), g_end(going_away->end()) ;
+ for (ChangeByResolventSequence::ConstIterator g(going_away_newly_available.first->begin()), g_end(going_away_newly_available.first->end()) ;
g != g_end ; ++g)
- if (! _collect_depped_upon(*g, star_i_set)->empty())
+ if (! _collect_depped_upon(g->package_id(), star_i_set)->empty())
used_to_use->push_back(*g);
Resolvent resolvent(*i, dt_install_to_slash);
@@ -2094,7 +2157,7 @@ Decider::_collect_depped_upon(
const std::tr1::shared_ptr<const PackageID> & id,
const std::tr1::shared_ptr<const PackageIDSequence> & candidates) const
{
- DependentChecker c(_imp->env, candidates, make_shared_ptr(new PackageIDSequence));
+ DependentChecker<PackageIDSequence> c(_imp->env, candidates, make_shared_ptr(new PackageIDSequence));
if (id->dependencies_key())
id->dependencies_key()->value()->root()->accept(c);
else
@@ -2141,7 +2204,7 @@ const std::tr1::shared_ptr<ConstraintSequence>
Decider::_make_constraints_for_purge(
const std::tr1::shared_ptr<const Resolution> & resolution,
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & r) const
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & r) const
{
return _imp->fns.get_constraints_for_purge_fn()(resolution, id, r);
}
diff --git a/paludis/resolver/decider.hh b/paludis/resolver/decider.hh
index bd27e69..23e984c 100644
--- a/paludis/resolver/decider.hh
+++ b/paludis/resolver/decider.hh
@@ -37,6 +37,7 @@
#include <paludis/resolver/change_type-fwd.hh>
#include <paludis/resolver/package_or_block_dep_spec-fwd.hh>
#include <paludis/resolver/resolutions_by_resolvent-fwd.hh>
+#include <paludis/resolver/change_by_resolvent-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/tribool-fwd.hh>
@@ -93,12 +94,12 @@ namespace paludis
const std::tr1::shared_ptr<ConstraintSequence> _make_constraints_for_dependent(
const std::tr1::shared_ptr<const Resolution> & resolution,
const std::tr1::shared_ptr<const PackageID> &,
- const std::tr1::shared_ptr<const PackageIDSequence> &) const;
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> &) const;
const std::tr1::shared_ptr<ConstraintSequence> _make_constraints_for_purge(
const std::tr1::shared_ptr<const Resolution> & resolution,
const std::tr1::shared_ptr<const PackageID> &,
- const std::tr1::shared_ptr<const PackageIDSequence> &) const;
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> &) const;
const std::tr1::shared_ptr<ConstraintSequence> _make_constraints_from_other_destination(
const std::tr1::shared_ptr<const Resolution> & resolution,
@@ -217,16 +218,16 @@ namespace paludis
bool _remove_if_dependent(const std::tr1::shared_ptr<const PackageID> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
const std::pair<
- std::tr1::shared_ptr<const PackageIDSequence>,
- std::tr1::shared_ptr<const PackageIDSequence> > _collect_changing() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ std::tr1::shared_ptr<const ChangeByResolventSequence>,
+ std::tr1::shared_ptr<const ChangeByResolventSequence> > _collect_changing() const PALUDIS_ATTRIBUTE((warn_unused_result));
const std::tr1::shared_ptr<const PackageIDSequence> _collect_staying(
- const std::tr1::shared_ptr<const PackageIDSequence> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
- const std::tr1::shared_ptr<const PackageIDSequence> _dependent_upon(
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> _dependent_upon(
const std::tr1::shared_ptr<const PackageID> &,
- const std::tr1::shared_ptr<const PackageIDSequence> &,
- const std::tr1::shared_ptr<const PackageIDSequence> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> &,
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> &) const PALUDIS_ATTRIBUTE((warn_unused_result));
void _confirm(const std::tr1::shared_ptr<const Resolution> & resolution);
diff --git a/paludis/resolver/reason.cc b/paludis/resolver/reason.cc
index 5731e54..e90e903 100644
--- a/paludis/resolver/reason.cc
+++ b/paludis/resolver/reason.cc
@@ -20,6 +20,7 @@
#include <paludis/resolver/reason.hh>
#include <paludis/resolver/resolvent.hh>
#include <paludis/resolver/sanitised_dependencies.hh>
+#include <paludis/resolver/change_by_resolvent.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/serialise-impl.hh>
@@ -111,16 +112,16 @@ namespace paludis
template <>
struct Implementation<DependentReason>
{
- const std::tr1::shared_ptr<const PackageID> id_being_removed;
+ const ChangeByResolvent id_being_removed;
- Implementation(const std::tr1::shared_ptr<const PackageID> & i) :
+ Implementation(const ChangeByResolvent & i) :
id_being_removed(i)
{
}
};
}
-DependentReason::DependentReason(const std::tr1::shared_ptr<const PackageID> & i) :
+DependentReason::DependentReason(const ChangeByResolvent & i) :
PrivateImplementationPattern<DependentReason>(new Implementation<DependentReason>(i))
{
}
@@ -129,8 +130,8 @@ DependentReason::~DependentReason()
{
}
-const std::tr1::shared_ptr<const PackageID>
-DependentReason::id_being_removed() const
+const ChangeByResolvent
+DependentReason::id_and_resolvent_being_removed() const
{
return _imp->id_being_removed;
}
@@ -139,7 +140,7 @@ void
DependentReason::serialise(Serialiser & s) const
{
s.object("DependentReason")
- .member(SerialiserFlags<serialise::might_be_null>(), "id_being_removed", id_being_removed())
+ .member(SerialiserFlags<>(), "id_and_resolvent_being_removed", id_and_resolvent_being_removed())
;
}
@@ -148,16 +149,16 @@ namespace paludis
template <>
struct Implementation<WasUsedByReason>
{
- const std::tr1::shared_ptr<const PackageIDSequence> ids_being_removed;
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> ids_being_removed;
- Implementation(const std::tr1::shared_ptr<const PackageIDSequence> & i) :
+ Implementation(const std::tr1::shared_ptr<const ChangeByResolventSequence> & i) :
ids_being_removed(i)
{
}
};
}
-WasUsedByReason::WasUsedByReason(const std::tr1::shared_ptr<const PackageIDSequence> & i) :
+WasUsedByReason::WasUsedByReason(const std::tr1::shared_ptr<const ChangeByResolventSequence> & i) :
PrivateImplementationPattern<WasUsedByReason>(new Implementation<WasUsedByReason>(i))
{
}
@@ -166,8 +167,8 @@ WasUsedByReason::~WasUsedByReason()
{
}
-const std::tr1::shared_ptr<const PackageIDSequence>
-WasUsedByReason::ids_being_removed() const
+const std::tr1::shared_ptr<const ChangeByResolventSequence>
+WasUsedByReason::ids_and_resolvents_being_removed() const
{
return _imp->ids_being_removed;
}
@@ -176,7 +177,7 @@ void
WasUsedByReason::serialise(Serialiser & s) const
{
s.object("WasUsedByReason")
- .member(SerialiserFlags<serialise::container, serialise::might_be_null>(), "ids_being_removed", ids_being_removed())
+ .member(SerialiserFlags<serialise::container, serialise::might_be_null>(), "ids_and_resolvents_being_removed", ids_and_resolvents_being_removed())
;
}
@@ -356,17 +357,18 @@ Reason::deserialise(Deserialisation & d)
else if (d.class_name() == "DependentReason")
{
Deserialisator v(d, "DependentReason");
- const std::tr1::shared_ptr<const PackageID> id_being_removed(v.member<std::tr1::shared_ptr<const PackageID> >("id_being_removed"));
- return make_shared_ptr(new DependentReason(id_being_removed));
+ return make_shared_ptr(new DependentReason(
+ v.member<ChangeByResolvent>("id_and_resolvent_being_removed"))
+ );
}
else if (d.class_name() == "WasUsedByReason")
{
Deserialisator v(d, "WasUsedByReason");
- Deserialisator vv(*v.find_remove_member("ids_being_removed"), "c");
- std::tr1::shared_ptr<PackageIDSequence> ids_being_removed(new PackageIDSequence);
+ Deserialisator vv(*v.find_remove_member("ids_and_resolvents_being_removed"), "c");
+ std::tr1::shared_ptr<ChangeByResolventSequence> ids_and_resolvents_being_removed(new ChangeByResolventSequence);
for (int n(1), n_end(vv.member<int>("count") + 1) ; n != n_end ; ++n)
- ids_being_removed->push_back(vv.member<std::tr1::shared_ptr<const PackageID> >(stringify(n)));
- return make_shared_ptr(new WasUsedByReason(ids_being_removed));
+ ids_and_resolvents_being_removed->push_back(vv.member<ChangeByResolvent>(stringify(n)));
+ return make_shared_ptr(new WasUsedByReason(ids_and_resolvents_being_removed));
}
else if (d.class_name() == "LikeOtherDestinationTypeReason")
{
diff --git a/paludis/resolver/reason.hh b/paludis/resolver/reason.hh
index 90ed077..b041b83 100644
--- a/paludis/resolver/reason.hh
+++ b/paludis/resolver/reason.hh
@@ -23,6 +23,7 @@
#include <paludis/resolver/reason-fwd.hh>
#include <paludis/resolver/resolvent-fwd.hh>
#include <paludis/resolver/sanitised_dependencies-fwd.hh>
+#include <paludis/resolver/change_by_resolvent-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/type_list.hh>
@@ -85,10 +86,10 @@ namespace paludis
public ImplementAcceptMethods<Reason, DependentReason>
{
public:
- DependentReason(const std::tr1::shared_ptr<const PackageID> & id);
+ DependentReason(const ChangeByResolvent &);
~DependentReason();
- const std::tr1::shared_ptr<const PackageID> id_being_removed() const;
+ const ChangeByResolvent id_and_resolvent_being_removed() const;
virtual void serialise(Serialiser &) const;
};
@@ -99,10 +100,10 @@ namespace paludis
public ImplementAcceptMethods<Reason, WasUsedByReason>
{
public:
- WasUsedByReason(const std::tr1::shared_ptr<const PackageIDSequence> & ids);
+ WasUsedByReason(const std::tr1::shared_ptr<const ChangeByResolventSequence> & ids);
~WasUsedByReason();
- const std::tr1::shared_ptr<const PackageIDSequence> ids_being_removed() const;
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> ids_and_resolvents_being_removed() const;
virtual void serialise(Serialiser &) const;
};
diff --git a/paludis/resolver/resolver_functions.hh b/paludis/resolver/resolver_functions.hh
index da50574..1d7ece3 100644
--- a/paludis/resolver/resolver_functions.hh
+++ b/paludis/resolver/resolver_functions.hh
@@ -30,6 +30,7 @@
#include <paludis/resolver/destination_types-fwd.hh>
#include <paludis/resolver/constraint-fwd.hh>
#include <paludis/resolver/required_confirmations-fwd.hh>
+#include <paludis/resolver/change_by_resolvent-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/util/tribool-fwd.hh>
#include <paludis/filter-fwd.hh>
@@ -85,13 +86,13 @@ namespace paludis
typedef std::tr1::function<std::tr1::shared_ptr<ConstraintSequence> (
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageID> &,
- const std::tr1::shared_ptr<const PackageIDSequence> &
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> &
)> GetConstraintsForDependentFunction;
typedef std::tr1::function<std::tr1::shared_ptr<ConstraintSequence> (
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageID> &,
- const std::tr1::shared_ptr<const PackageIDSequence> &
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> &
)> GetConstraintsForPurgeFunction;
typedef std::tr1::function<DestinationTypes (
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 04f2e01..013b12a 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -28,6 +28,7 @@
#include <paludis/resolver/decisions.hh>
#include <paludis/resolver/decider.hh>
#include <paludis/resolver/reason.hh>
+#include <paludis/resolver/change_by_resolvent.hh>
#include <paludis/util/map.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/sequence.hh>
@@ -280,7 +281,7 @@ const std::tr1::shared_ptr<ConstraintSequence>
paludis::resolver::resolver_test::get_constraints_for_dependent_fn(
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & ids)
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & ids)
{
const std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
@@ -291,7 +292,7 @@ paludis::resolver::resolver_test::get_constraints_for_dependent_fn(
id->slot_key()->value(), false)));
PackageDepSpec spec(partial_spec);
- for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ for (ChangeByResolventSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
{
const std::tr1::shared_ptr<DependentReason> reason(new DependentReason(*i));
@@ -313,7 +314,7 @@ const std::tr1::shared_ptr<ConstraintSequence>
paludis::resolver::resolver_test::get_constraints_for_purge_fn(
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & ids)
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & ids)
{
const std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index 06bff90..8d5e4cc 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -33,6 +33,7 @@
#include <paludis/resolver/required_confirmations-fwd.hh>
#include <paludis/resolver/package_or_block_dep_spec-fwd.hh>
#include <paludis/resolver/resolved-fwd.hh>
+#include <paludis/resolver/change_by_resolvent-fwd.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -69,13 +70,13 @@ namespace paludis
get_constraints_for_dependent_fn(
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & ids);
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & ids);
const std::tr1::shared_ptr<ConstraintSequence>
get_constraints_for_purge_fn(
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & ids);
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & ids);
std::tr1::shared_ptr<Resolvents> get_resolvents_for_fn(const PackageDepSpec & spec,
const std::tr1::shared_ptr<const SlotName> &,
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index d9757d2..8d6f842 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -53,6 +53,7 @@
#include <paludis/resolver/decisions.hh>
#include <paludis/resolver/required_confirmations.hh>
#include <paludis/resolver/orderer_notes.hh>
+#include <paludis/resolver/change_by_resolvent.hh>
#include <paludis/package_id.hh>
#include <paludis/version_spec.hh>
#include <paludis/metadata_key.hh>
@@ -139,6 +140,11 @@ namespace
return value->value();
}
+ std::string stringify_change_by_resolvent(const ChangeByResolvent & r)
+ {
+ return stringify(*r.package_id());
+ }
+
struct ReasonNameGetter
{
const bool verbose;
@@ -201,16 +207,17 @@ namespace
std::pair<std::string, bool> visit(const DependentReason & r) const
{
- return std::make_pair("dependent upon " + stringify(*r.id_being_removed()), true);
+ return std::make_pair("dependent upon " + stringify(*r.id_and_resolvent_being_removed().package_id()), true);
}
std::pair<std::string, bool> visit(const WasUsedByReason & r) const
{
- if (r.ids_being_removed()->empty())
+ if (r.ids_and_resolvents_being_removed()->empty())
return std::make_pair("was unused", true);
else
- return std::make_pair("was used by " + join(indirect_iterator(r.ids_being_removed()->begin()),
- indirect_iterator(r.ids_being_removed()->end()), ", "), true);
+ return std::make_pair("was used by " + join(r.ids_and_resolvents_being_removed()->begin(),
+ r.ids_and_resolvents_being_removed()->end(),
+ ", ", stringify_change_by_resolvent), true);
}
std::pair<std::string, bool> visit(const TargetReason &) const
diff --git a/src/clients/cave/cmd_resolve_dump.cc b/src/clients/cave/cmd_resolve_dump.cc
index 93742b6..802424d 100644
--- a/src/clients/cave/cmd_resolve_dump.cc
+++ b/src/clients/cave/cmd_resolve_dump.cc
@@ -27,6 +27,7 @@
#include <paludis/resolver/reason.hh>
#include <paludis/resolver/destination.hh>
#include <paludis/resolver/resolutions_by_resolvent.hh>
+#include <paludis/resolver/change_by_resolvent.hh>
#include <paludis/util/enum_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/join.hh>
@@ -68,6 +69,11 @@ namespace
return "null";
}
+ std::string stringify_change_by_resolvent(const ChangeByResolvent & r)
+ {
+ return stringify(*r.package_id());
+ }
+
struct DecisionStringifier
{
const std::string visit(const UnableToMakeDecision & d) const
@@ -169,13 +175,13 @@ namespace
void visit(const DependentReason & r)
{
- str = "Dependent(" + stringify(*r.id_being_removed()) + ")";
+ str = "Dependent(" + stringify(*r.id_and_resolvent_being_removed().package_id()) + ")";
}
void visit(const WasUsedByReason & r)
{
- str = "WasUsedBy(" + join(indirect_iterator(r.ids_being_removed()->begin()),
- indirect_iterator(r.ids_being_removed()->end()), ", ") + ")";
+ str = "WasUsedBy(" + join(r.ids_and_resolvents_being_removed()->begin(),
+ r.ids_and_resolvents_being_removed()->end(), ", ", stringify_change_by_resolvent) + ")";
}
void visit(const DependencyReason & r)
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index 5b5e713..ee95060 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -54,6 +54,7 @@
#include <paludis/resolver/required_confirmations.hh>
#include <paludis/resolver/job_lists.hh>
#include <paludis/resolver/decisions.hh>
+#include <paludis/resolver/change_by_resolvent.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/notifier_callback.hh>
#include <paludis/generator.hh>
@@ -1262,7 +1263,7 @@ namespace
const PackageDepSpecList & list,
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & ids)
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & ids)
{
const std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
@@ -1279,7 +1280,7 @@ namespace
spec = make_shared_ptr(new PackageDepSpec(partial_spec));
}
- for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
+ for (ChangeByResolventSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
{
const std::tr1::shared_ptr<DependentReason> reason(new DependentReason(*i));
@@ -1302,7 +1303,7 @@ namespace
const PackageDepSpecList & list,
const std::tr1::shared_ptr<const Resolution> &,
const std::tr1::shared_ptr<const PackageID> & id,
- const std::tr1::shared_ptr<const PackageIDSequence> & ids)
+ const std::tr1::shared_ptr<const ChangeByResolventSequence> & ids)
{
const std::tr1::shared_ptr<ConstraintSequence> result(new ConstraintSequence);
@@ -1536,6 +1537,11 @@ namespace
}
};
+ std::string stringify_change_by_resolvent(const ChangeByResolvent & r)
+ {
+ return stringify(*r.package_id());
+ }
+
struct ShortReasonName
{
const std::string visit(const DependencyReason & r) const
@@ -1546,16 +1552,16 @@ namespace
const std::string visit(const WasUsedByReason & r) const
{
- if (r.ids_being_removed()->empty())
+ if (r.ids_and_resolvents_being_removed()->empty())
return "from was unused";
else
- return "from was used by " + join(indirect_iterator(r.ids_being_removed()->begin()),
- indirect_iterator(r.ids_being_removed()->end()), ", ");
+ return "from was used by " + join(r.ids_and_resolvents_being_removed()->begin(),
+ r.ids_and_resolvents_being_removed()->end(), ", ", stringify_change_by_resolvent);
}
const std::string visit(const DependentReason & r) const
{
- return "from dependent " + stringify(*r.id_being_removed());
+ return "from dependent " + stringify(*r.id_and_resolvent_being_removed().package_id());
}
const std::string visit(const TargetReason &) const