aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-15 19:11:21 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-15 19:11:21 +0100
commitcdca53e46b68e6ed5839e022b6b44dd2337be943 (patch)
treeb8fa49de10d91dd5dbcdf0203a86c4a0411b88fe
parent738cd1623c5deedd4c3b933ebc5a685a2a3e9b74 (diff)
downloadpaludis-cdca53e46b68e6ed5839e022b6b44dd2337be943.tar.gz
paludis-cdca53e46b68e6ed5839e022b6b44dd2337be943.tar.xz
Be able to add notes to decisions
-rw-r--r--paludis/resolver/Makefile.am2
-rw-r--r--paludis/resolver/decisions-fwd.hh10
-rw-r--r--paludis/resolver/decisions.cc156
-rw-r--r--paludis/resolver/decisions.hh50
-rw-r--r--paludis/resolver/lineariser.cc3
-rw-r--r--paludis/resolver/lineariser_notes-fwd.hh31
-rw-r--r--paludis/resolver/lineariser_notes.cc41
-rw-r--r--paludis/resolver/lineariser_notes.hh41
-rw-r--r--paludis/resolver/resolved.cc66
-rw-r--r--paludis/resolver/resolved.hh2
-rw-r--r--paludis/resolver/resolver.cc2
-rw-r--r--paludis/resolver/resolver_test.cc17
-rw-r--r--src/clients/cave/cmd_display_resolution.cc26
13 files changed, 352 insertions, 95 deletions
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index db5b447..5a5f00b 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -31,6 +31,7 @@ noinst_HEADERS = \
destination.hh destination-fwd.hh \
destination_types.hh destination_types-fwd.hh destination_types-se.hh \
lineariser.hh lineariser-fwd.hh \
+ lineariser_notes.hh lineariser_notes-fwd.hh \
nag.hh nag-fwd.hh \
package_or_block_dep_spec.hh package_or_block_dep_spec-fwd.hh \
reason.hh reason-fwd.hh \
@@ -62,6 +63,7 @@ libpaludisresolver_a_SOURCES = \
destination.cc \
destination_types.cc \
lineariser.cc \
+ lineariser_notes.cc \
nag.cc \
package_or_block_dep_spec.cc \
reason.cc \
diff --git a/paludis/resolver/decisions-fwd.hh b/paludis/resolver/decisions-fwd.hh
index 6f0ab1f..3268d32 100644
--- a/paludis/resolver/decisions-fwd.hh
+++ b/paludis/resolver/decisions-fwd.hh
@@ -20,11 +20,19 @@
#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_DECISIONS_FWD_HH
#define PALUDIS_GUARD_PALUDIS_RESOLVER_DECISIONS_FWD_HH 1
+#include <paludis/util/no_type.hh>
+#include <paludis/resolver/lineariser_notes-fwd.hh>
+#include <paludis/resolver/decision-fwd.hh>
+#include <tr1/memory>
+
namespace paludis
{
namespace resolver
{
- template <typename D_> struct Decisions;
+ template <typename Decision_, typename Notes_ = NoType<0u> *>
+ struct Decisions;
+
+ typedef Decisions<ChangeOrRemoveDecision, std::tr1::shared_ptr<const LineariserNotes> > ChangeOrRemoveDecisionsWithNotes;
}
}
diff --git a/paludis/resolver/decisions.cc b/paludis/resolver/decisions.cc
index 7903282..4f005dd 100644
--- a/paludis/resolver/decisions.cc
+++ b/paludis/resolver/decisions.cc
@@ -19,93 +19,193 @@
#include <paludis/resolver/decisions.hh>
#include <paludis/resolver/decision.hh>
+#include <paludis/resolver/lineariser_notes.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/serialise-impl.hh>
#include <list>
using namespace paludis;
using namespace paludis::resolver;
+namespace
+{
+ template <typename Decision_, typename Notes_>
+ struct ContainerTraits
+ {
+ typedef std::list<std::pair<
+ std::tr1::shared_ptr<const Decision_>,
+ Notes_> > ContainerType;
+
+ static void do_push_back(
+ ContainerType & c,
+ const std::tr1::shared_ptr<const Decision_> & d,
+ const Notes_ & n)
+ {
+ c.push_back(std::make_pair(d, n));
+ }
+
+ static void do_member(SerialiserObjectWriter & w, int n,
+ const std::pair<std::tr1::shared_ptr<const Decision_>, Notes_> & d)
+ {
+ w.member(SerialiserFlags<serialise::might_be_null>(), stringify(n) + ".1", d.first);
+ w.member(SerialiserFlags<serialise::might_be_null>(), stringify(n) + ".2", d.second);
+ }
+
+ static void do_extract(
+ std::tr1::shared_ptr<Decisions<Decision_, Notes_> > & result,
+ Deserialisator & v,
+ int n)
+ {
+ result->push_back(
+ v.member<std::tr1::shared_ptr<Decision_> >(stringify(n) + ".1"),
+ v.member<Notes_>(stringify(n) + ".2")
+ );
+ }
+ };
+
+ template <typename Decision_>
+ struct ContainerTraits<Decision_, NoType<0u> *>
+ {
+ typedef std::list<std::tr1::shared_ptr<const Decision_> > ContainerType;
+
+ static void do_push_back(
+ ContainerType & c,
+ const std::tr1::shared_ptr<const Decision_> & d,
+ const NoType<0u> * const)
+ {
+ c.push_back(d);
+ }
+
+ static void do_member(SerialiserObjectWriter & w, int n, const std::tr1::shared_ptr<const Decision_> & d)
+ {
+ w.member(SerialiserFlags<serialise::might_be_null>(), stringify(n), d);
+ }
+
+ static void do_extract(
+ std::tr1::shared_ptr<Decisions<Decision_> > & result,
+ Deserialisator & v,
+ int n)
+ {
+ result->push_back(v.member<std::tr1::shared_ptr<Decision_> >(stringify(n)));
+ }
+ };
+}
+
namespace paludis
{
#ifdef PALUDIS_NO_DOUBLE_TEMPLATE
template <>
#endif
- template <typename Decision_>
- struct Implementation<Decisions<Decision_> >
+ template <typename Decision_, typename Notes_>
+ struct Implementation<Decisions<Decision_, Notes_> >
{
- std::list<std::tr1::shared_ptr<const Decision_> > values;
+ typename ContainerTraits<Decision_, Notes_>::ContainerType values;
};
#ifdef PALUDIS_NO_DOUBLE_TEMPLATE
template <>
#endif
- template <typename Decision_>
- struct WrappedForwardIteratorTraits<DecisionsConstIteratorTag<Decision_> >
+ template <typename Decision_, typename Notes_>
+ struct WrappedForwardIteratorTraits<DecisionsConstIteratorTag<Decision_, Notes_> >
{
- typedef typename std::list<std::tr1::shared_ptr<const Decision_> >::const_iterator UnderlyingIterator;
+ typedef typename ContainerTraits<Decision_, Notes_>::ContainerType::const_iterator UnderlyingIterator;
};
}
-template <typename Decision_>
-Decisions<Decision_>::Decisions() :
- PrivateImplementationPattern<Decisions<Decision_> >(new Implementation<Decisions<Decision_> >)
+template <typename Decision_, typename Notes_>
+Decisions<Decision_, Notes_>::Decisions() :
+ PrivateImplementationPattern<Decisions<Decision_, Notes_> >(new Implementation<Decisions<Decision_, Notes_> >)
{
}
-template <typename Decision_>
-Decisions<Decision_>::~Decisions()
+template <typename Decision_, typename Notes_>
+Decisions<Decision_, Notes_>::~Decisions()
{
}
-template <typename Decision_>
+template <typename Decision_, typename Notes_>
void
-Decisions<Decision_>::push_back(const std::tr1::shared_ptr<const Decision_> & d)
+Decisions<Decision_, Notes_>::push_back(
+ const std::tr1::shared_ptr<const Decision_> & d,
+ const Notes_ & n)
{
- _imp->values.push_back(d);
+ ContainerTraits<Decision_, Notes_>::do_push_back(_imp->values, d, n);
}
-template <typename Decision_>
+template <typename Decision_, typename Notes_>
void
-Decisions<Decision_>::cast_push_back(const std::tr1::shared_ptr<const Decision> & d)
+Decisions<Decision_, Notes_>::cast_push_back(
+ const std::tr1::shared_ptr<const Decision> & d,
+ const Notes_ & n)
{
if (! simple_visitor_cast<const Decision_>(*d))
throw InternalError(PALUDIS_HERE, "Wrong Decision type");
- push_back(std::tr1::static_pointer_cast<const Decision_>(d));
+ push_back(std::tr1::static_pointer_cast<const Decision_>(d), n);
}
-template <typename Decision_>
-typename Decisions<Decision_>::ConstIterator
-Decisions<Decision_>::begin() const
+template <typename Decision_, typename Notes_>
+typename Decisions<Decision_, Notes_>::ConstIterator
+Decisions<Decision_, Notes_>::begin() const
{
return ConstIterator(_imp->values.begin());
}
-template <typename Decision_>
-typename Decisions<Decision_>::ConstIterator
-Decisions<Decision_>::end() const
+template <typename Decision_, typename Notes_>
+typename Decisions<Decision_, Notes_>::ConstIterator
+Decisions<Decision_, Notes_>::end() const
{
return ConstIterator(_imp->values.end());
}
-template <typename Decision_>
+template <typename Decision_, typename Notes_>
bool
-Decisions<Decision_>::empty() const
+Decisions<Decision_, Notes_>::empty() const
{
return _imp->values.empty();
}
+template <typename Decision_, typename Notes_>
+void
+Decisions<Decision_, Notes_>::serialise(Serialiser & s) const
+{
+ SerialiserObjectWriter w(s.object("Decisions"));
+
+ int n(0);
+ for (ConstIterator i(begin()), i_end(end()) ;
+ i != i_end ; ++i)
+ ContainerTraits<Decision_, Notes_>::do_member(w, ++n, *i);
+
+ w.member(SerialiserFlags<>(), "count", stringify(n));
+}
+
+template <typename Decision_, typename Notes_>
+const std::tr1::shared_ptr<Decisions<Decision_, Notes_> >
+Decisions<Decision_, Notes_>::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "Decisions");
+ std::tr1::shared_ptr<Decisions<Decision_, Notes_> > result(new Decisions<Decision_, Notes_>);
+ for (int n(1), n_end(v.member<int>("count") + 1) ; n != n_end ; ++n)
+ ContainerTraits<Decision_, Notes_>::do_extract(result, v, n);
+ return result;
+}
+
template class Decisions<UnableToMakeDecision>;
template class Decisions<ChangesToMakeDecision>;
template class Decisions<ChangeOrRemoveDecision>;
+template class Decisions<ChangeOrRemoveDecision, std::tr1::shared_ptr<const LineariserNotes> >;
-template class WrappedForwardIterator<DecisionsConstIteratorTag<UnableToMakeDecision>,
+template class WrappedForwardIterator<Decisions<UnableToMakeDecision>::ConstIteratorTag,
const std::tr1::shared_ptr<const UnableToMakeDecision> >;
-template class WrappedForwardIterator<DecisionsConstIteratorTag<ChangesToMakeDecision>,
+template class WrappedForwardIterator<Decisions<ChangesToMakeDecision>::ConstIteratorTag,
const std::tr1::shared_ptr<const ChangesToMakeDecision> >;
-template class WrappedForwardIterator<DecisionsConstIteratorTag<ChangeOrRemoveDecision>,
+template class WrappedForwardIterator<Decisions<ChangeOrRemoveDecision>::ConstIteratorTag,
const std::tr1::shared_ptr<const ChangeOrRemoveDecision> >;
+template class WrappedForwardIterator<Decisions<ChangeOrRemoveDecision, std::tr1::shared_ptr<const LineariserNotes> >::ConstIteratorTag,
+ const std::pair<
+ std::tr1::shared_ptr<const ChangeOrRemoveDecision>,
+ std::tr1::shared_ptr<const LineariserNotes> > >;
diff --git a/paludis/resolver/decisions.hh b/paludis/resolver/decisions.hh
index 1afd90d..a9c7de2 100644
--- a/paludis/resolver/decisions.hh
+++ b/paludis/resolver/decisions.hh
@@ -22,52 +22,82 @@
#include <paludis/resolver/decisions-fwd.hh>
#include <paludis/resolver/decision-fwd.hh>
+#include <paludis/resolver/lineariser_notes-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/no_type.hh>
+#include <paludis/serialise-fwd.hh>
#include <tr1/memory>
namespace paludis
{
namespace resolver
{
- template <typename Decision_>
+ template <typename Decision_, typename Notes_>
struct DecisionsConstIteratorTag;
+ template <typename Decision_, typename Notes_>
+ struct DecisionsIteratorValueType
+ {
+ typedef const std::pair<std::tr1::shared_ptr<const Decision_>, Notes_> Type;
+ };
+
template <typename Decision_>
+ struct DecisionsIteratorValueType<Decision_, NoType<0u> *>
+ {
+ typedef const std::tr1::shared_ptr<const Decision_> Type;
+ };
+
+ template <typename Decision_, typename Notes_>
class PALUDIS_VISIBLE Decisions :
- private PrivateImplementationPattern<Decisions<Decision_> >
+ private PrivateImplementationPattern<Decisions<Decision_, Notes_> >
{
- using PrivateImplementationPattern<Decisions<Decision_> >::_imp;
+ using PrivateImplementationPattern<Decisions<Decision_, Notes_> >::_imp;
public:
Decisions();
~Decisions();
- void push_back(const std::tr1::shared_ptr<const Decision_> &);
- void cast_push_back(const std::tr1::shared_ptr<const Decision> &);
+ void push_back(
+ const std::tr1::shared_ptr<const Decision_> &,
+ const Notes_ & = static_cast<NoType<0u> *>(0));
- typedef DecisionsConstIteratorTag<Decision_> ConstIteratorTag;
- typedef WrappedForwardIterator<ConstIteratorTag, const std::tr1::shared_ptr<const Decision_> > ConstIterator;
+ void cast_push_back(
+ const std::tr1::shared_ptr<const Decision> &,
+ const Notes_ & = static_cast<NoType<0u> *>(0));
+
+ typedef DecisionsConstIteratorTag<Decision_, Notes_> ConstIteratorTag;
+ typedef WrappedForwardIterator<ConstIteratorTag,
+ typename DecisionsIteratorValueType<Decision_, Notes_>::Type> ConstIterator;
ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result));
ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result));
bool empty() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void serialise(Serialiser &) const;
+ static const std::tr1::shared_ptr<Decisions> deserialise(Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
};
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
extern template class Decisions<UnableToMakeDecision>;
extern template class Decisions<ChangesToMakeDecision>;
extern template class Decisions<ChangeOrRemoveDecision>;
+ extern template class Decisions<ChangeOrRemoveDecision, std::tr1::shared_ptr<const LineariserNotes> >;
#endif
}
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
- extern template class WrappedForwardIterator<resolver::DecisionsConstIteratorTag<resolver::UnableToMakeDecision>,
+ extern template class WrappedForwardIterator<resolver::Decisions<resolver::UnableToMakeDecision>::ConstIteratorTag,
const std::tr1::shared_ptr<const resolver::UnableToMakeDecision> >;
- extern template class WrappedForwardIterator<resolver::DecisionsConstIteratorTag<resolver::ChangesToMakeDecision>,
+ extern template class WrappedForwardIterator<resolver::Decisions<resolver::ChangesToMakeDecision>::ConstIteratorTag,
const std::tr1::shared_ptr<const resolver::ChangesToMakeDecision> >;
- extern template class WrappedForwardIterator<resolver::DecisionsConstIteratorTag<resolver::ChangeOrRemoveDecision>,
+ extern template class WrappedForwardIterator<resolver::Decisions<resolver::ChangeOrRemoveDecision>::ConstIteratorTag,
const std::tr1::shared_ptr<const resolver::ChangeOrRemoveDecision> >;
+ extern template class WrappedForwardIterator<resolver::Decisions<resolver::ChangeOrRemoveDecision,
+ std::tr1::shared_ptr<const resolver::LineariserNotes> >::ConstIteratorTag,
+ const std::pair<
+ std::tr1::shared_ptr<const resolver::ChangeOrRemoveDecision>,
+ std::tr1::shared_ptr<const resolver::LineariserNotes> > >;
#endif
}
diff --git a/paludis/resolver/lineariser.cc b/paludis/resolver/lineariser.cc
index bed3413..815fcaf 100644
--- a/paludis/resolver/lineariser.cc
+++ b/paludis/resolver/lineariser.cc
@@ -30,6 +30,7 @@
#include <paludis/resolver/work_list.hh>
#include <paludis/resolver/work_item.hh>
#include <paludis/resolver/destination.hh>
+#include <paludis/resolver/lineariser_notes.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
@@ -470,7 +471,7 @@ Lineariser::linearise_sub_ssccs(
void
Lineariser::schedule(const std::tr1::shared_ptr<const ChangeOrRemoveDecision> & d)
{
- _imp->resolved->taken_change_or_remove_decisions()->push_back(d);
+ _imp->resolved->taken_change_or_remove_decisions()->push_back(d, make_shared_ptr(new LineariserNotes));
if (d->required_confirmations_if_any())
_imp->resolved->taken_unconfirmed_change_or_remove_decisions()->push_back(d);
diff --git a/paludis/resolver/lineariser_notes-fwd.hh b/paludis/resolver/lineariser_notes-fwd.hh
new file mode 100644
index 0000000..1dc4fca
--- /dev/null
+++ b/paludis/resolver/lineariser_notes-fwd.hh
@@ -0,0 +1,31 @@
+/* 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_LINEARISER_NOTES_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_RESOLVER_LINEARISER_NOTES_FWD_HH 1
+
+namespace paludis
+{
+ namespace resolver
+ {
+ struct LineariserNotes;
+ }
+}
+
+#endif
diff --git a/paludis/resolver/lineariser_notes.cc b/paludis/resolver/lineariser_notes.cc
new file mode 100644
index 0000000..16b2c42
--- /dev/null
+++ b/paludis/resolver/lineariser_notes.cc
@@ -0,0 +1,41 @@
+/* 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/lineariser_notes.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/serialise-impl.hh>
+
+using namespace paludis;
+using namespace paludis::resolver;
+
+void
+LineariserNotes::serialise(Serialiser & s) const
+{
+ s.object("LineariserNotes")
+ ;
+}
+
+const std::tr1::shared_ptr<LineariserNotes>
+LineariserNotes::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "LineariserNotes");
+
+ return make_shared_ptr(new LineariserNotes);
+}
+
diff --git a/paludis/resolver/lineariser_notes.hh b/paludis/resolver/lineariser_notes.hh
new file mode 100644
index 0000000..21ce339
--- /dev/null
+++ b/paludis/resolver/lineariser_notes.hh
@@ -0,0 +1,41 @@
+/* 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_LINEARISER_NOTES_HH
+#define PALUDIS_GUARD_PALUDIS_RESOLVER_LINEARISER_NOTES_HH 1
+
+#include <paludis/resolver/lineariser_notes-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/serialise-fwd.hh>
+#include <tr1/memory>
+
+namespace paludis
+{
+ namespace resolver
+ {
+ struct LineariserNotes
+ {
+ void serialise(Serialiser &) const;
+ static const std::tr1::shared_ptr<LineariserNotes> deserialise(
+ Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+ }
+}
+
+#endif
diff --git a/paludis/resolver/resolved.cc b/paludis/resolver/resolved.cc
index ff09e5e..dcf8a48 100644
--- a/paludis/resolver/resolved.cc
+++ b/paludis/resolver/resolved.cc
@@ -33,11 +33,11 @@ Resolved::serialise(Serialiser & s) const
{
s.object("Resolved")
.member(SerialiserFlags<serialise::might_be_null>(), "resolutions_by_resolvent", resolutions_by_resolvent())
- .member(SerialiserFlags<serialise::container, serialise::might_be_null>(), "taken_change_or_remove_decisions", taken_change_or_remove_decisions())
- .member(SerialiserFlags<serialise::container, serialise::might_be_null>(), "taken_unable_to_make_decisions", taken_unable_to_make_decisions())
- .member(SerialiserFlags<serialise::container, serialise::might_be_null>(), "taken_unconfirmed_change_or_remove_decisions", taken_unconfirmed_change_or_remove_decisions())
- .member(SerialiserFlags<serialise::container, serialise::might_be_null>(), "untaken_change_or_remove_decisions", untaken_change_or_remove_decisions())
- .member(SerialiserFlags<serialise::container, serialise::might_be_null>(), "untaken_unable_to_make_decisions", untaken_unable_to_make_decisions())
+ .member(SerialiserFlags<serialise::might_be_null>(), "taken_change_or_remove_decisions", taken_change_or_remove_decisions())
+ .member(SerialiserFlags<serialise::might_be_null>(), "taken_unable_to_make_decisions", taken_unable_to_make_decisions())
+ .member(SerialiserFlags<serialise::might_be_null>(), "taken_unconfirmed_change_or_remove_decisions", taken_unconfirmed_change_or_remove_decisions())
+ .member(SerialiserFlags<serialise::might_be_null>(), "untaken_change_or_remove_decisions", untaken_change_or_remove_decisions())
+ .member(SerialiserFlags<serialise::might_be_null>(), "untaken_unable_to_make_decisions", untaken_unable_to_make_decisions())
.member(SerialiserFlags<serialise::might_be_null>(), "work_lists", work_lists())
;
}
@@ -47,49 +47,21 @@ Resolved::deserialise(Deserialisation & d)
{
Deserialisator v(d, "Resolved");
- std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > taken_change_or_remove_decisions(new Decisions<ChangeOrRemoveDecision>);
- {
- Deserialisator vv(*v.find_remove_member("taken_change_or_remove_decisions"), "c");
- for (int n(1), n_end(vv.member<int>("count") + 1) ; n != n_end ; ++n)
- taken_change_or_remove_decisions->push_back(vv.member<std::tr1::shared_ptr<ChangeOrRemoveDecision> >(stringify(n)));
- }
-
- std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > taken_unconfirmed_change_or_remove_decisions(new Decisions<ChangeOrRemoveDecision>);
- {
- Deserialisator vv(*v.find_remove_member("taken_unconfirmed_change_or_remove_decisions"), "c");
- for (int n(1), n_end(vv.member<int>("count") + 1) ; n != n_end ; ++n)
- taken_unconfirmed_change_or_remove_decisions->push_back(vv.member<std::tr1::shared_ptr<ChangeOrRemoveDecision> >(stringify(n)));
- }
-
- std::tr1::shared_ptr<Decisions<UnableToMakeDecision> > taken_unable_to_make_decisions(new Decisions<UnableToMakeDecision>);
- {
- Deserialisator vv(*v.find_remove_member("taken_unable_to_make_decisions"), "c");
- for (int n(1), n_end(vv.member<int>("count") + 1) ; n != n_end ; ++n)
- taken_unable_to_make_decisions->push_back(vv.member<std::tr1::shared_ptr<UnableToMakeDecision> >(stringify(n)));
- }
-
- std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > untaken_change_or_remove_decisions(new Decisions<ChangeOrRemoveDecision>);
- {
- Deserialisator vv(*v.find_remove_member("untaken_change_or_remove_decisions"), "c");
- for (int n(1), n_end(vv.member<int>("count") + 1) ; n != n_end ; ++n)
- untaken_change_or_remove_decisions->push_back(vv.member<std::tr1::shared_ptr<ChangeOrRemoveDecision> >(stringify(n)));
- }
-
- std::tr1::shared_ptr<Decisions<UnableToMakeDecision> > untaken_unable_to_make_decisions(new Decisions<UnableToMakeDecision>);
- {
- Deserialisator vv(*v.find_remove_member("untaken_unable_to_make_decisions"), "c");
- for (int n(1), n_end(vv.member<int>("count") + 1) ; n != n_end ; ++n)
- untaken_unable_to_make_decisions->push_back(vv.member<std::tr1::shared_ptr<UnableToMakeDecision> >(stringify(n)));
- }
-
return make_named_values<Resolved>(
- n::resolutions_by_resolvent() = v.member<std::tr1::shared_ptr<ResolutionsByResolvent> >("resolutions_by_resolvent"),
- n::taken_change_or_remove_decisions() = taken_change_or_remove_decisions,
- n::taken_unable_to_make_decisions() = taken_unable_to_make_decisions,
- n::taken_unconfirmed_change_or_remove_decisions() = taken_unconfirmed_change_or_remove_decisions,
- n::untaken_change_or_remove_decisions() = untaken_change_or_remove_decisions,
- n::untaken_unable_to_make_decisions() = untaken_unable_to_make_decisions,
- n::work_lists() = v.member<std::tr1::shared_ptr<WorkLists> >("work_lists")
+ n::resolutions_by_resolvent() =
+ v.member<std::tr1::shared_ptr<ResolutionsByResolvent> >("resolutions_by_resolvent"),
+ n::taken_change_or_remove_decisions() =
+ v.member<std::tr1::shared_ptr<ChangeOrRemoveDecisionsWithNotes> >("taken_change_or_remove_decisions"),
+ n::taken_unable_to_make_decisions() =
+ v.member<std::tr1::shared_ptr<Decisions<UnableToMakeDecision> > >("taken_unable_to_make_decisions"),
+ n::taken_unconfirmed_change_or_remove_decisions() =
+ v.member<std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > >("taken_unconfirmed_change_or_remove_decisions"),
+ n::untaken_change_or_remove_decisions() =
+ v.member<std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > >("untaken_change_or_remove_decisions"),
+ n::untaken_unable_to_make_decisions() =
+ v.member<std::tr1::shared_ptr<Decisions<UnableToMakeDecision> > >("untaken_unable_to_make_decisions"),
+ n::work_lists() =
+ v.member<std::tr1::shared_ptr<WorkLists> >("work_lists")
);
}
diff --git a/paludis/resolver/resolved.hh b/paludis/resolver/resolved.hh
index fb90e88..54a7dac 100644
--- a/paludis/resolver/resolved.hh
+++ b/paludis/resolver/resolved.hh
@@ -47,7 +47,7 @@ namespace paludis
struct Resolved
{
NamedValue<n::resolutions_by_resolvent, std::tr1::shared_ptr<ResolutionsByResolvent> > resolutions_by_resolvent;
- NamedValue<n::taken_change_or_remove_decisions, std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > > taken_change_or_remove_decisions;
+ NamedValue<n::taken_change_or_remove_decisions, std::tr1::shared_ptr<ChangeOrRemoveDecisionsWithNotes> > taken_change_or_remove_decisions;
NamedValue<n::taken_unable_to_make_decisions, std::tr1::shared_ptr<Decisions<UnableToMakeDecision> > > taken_unable_to_make_decisions;
NamedValue<n::taken_unconfirmed_change_or_remove_decisions, std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > > taken_unconfirmed_change_or_remove_decisions;
NamedValue<n::untaken_change_or_remove_decisions, std::tr1::shared_ptr<Decisions<ChangeOrRemoveDecision> > > untaken_change_or_remove_decisions;
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 7ead5de..b52fe7e 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -64,7 +64,7 @@ namespace paludis
fns(f),
resolved(new Resolved(make_named_values<Resolved>(
n::resolutions_by_resolvent() = make_shared_ptr(new ResolutionsByResolvent),
- n::taken_change_or_remove_decisions() = make_shared_ptr(new Decisions<ChangeOrRemoveDecision>),
+ n::taken_change_or_remove_decisions() = make_shared_ptr(new ChangeOrRemoveDecisionsWithNotes),
n::taken_unable_to_make_decisions() = make_shared_ptr(new Decisions<UnableToMakeDecision>),
n::taken_unconfirmed_change_or_remove_decisions() = make_shared_ptr(new Decisions<ChangeOrRemoveDecision>),
n::untaken_change_or_remove_decisions() = make_shared_ptr(new Decisions<ChangeOrRemoveDecision>),
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index b67f32d..456a1f7 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -419,6 +419,21 @@ ResolverTestCase::get_resolved(const std::string & target)
return get_resolved(target_spec);
}
+namespace
+{
+ template <typename T_>
+ std::tr1::shared_ptr<T_> get_decision(const std::tr1::shared_ptr<T_> & d)
+ {
+ return d;
+ }
+
+ template <typename T_, typename N_>
+ std::tr1::shared_ptr<T_> get_decision(const std::pair<std::tr1::shared_ptr<T_>, N_> & d)
+ {
+ return d.first;
+ }
+}
+
template <typename Decisions_>
void
ResolverTestCase::check_resolved_one(
@@ -435,7 +450,7 @@ ResolverTestCase::check_resolved_one(
std::tr1::shared_ptr<const Decision> d;
if (decision != decision_end)
- d = *decision++;
+ d = get_decision(*decision++);
TEST_CHECK_MESSAGE(decision_check->first(d), decision_check->second(d));
++decision_check;
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index a962e3b..6af82ca 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -1086,10 +1086,23 @@ namespace
}
}
+ std::pair<std::tr1::shared_ptr<const ChangeOrRemoveDecision>, std::tr1::shared_ptr<const LineariserNotes> >
+ get_decision_and_notes(const std::tr1::shared_ptr<const ChangeOrRemoveDecision> & d)
+ {
+ return std::make_pair(d, make_null_shared_ptr());
+ }
+
+ std::pair<std::tr1::shared_ptr<const ChangeOrRemoveDecision>, std::tr1::shared_ptr<const LineariserNotes> >
+ get_decision_and_notes(const std::pair<std::tr1::shared_ptr<const ChangeOrRemoveDecision>, std::tr1::shared_ptr<const LineariserNotes> > & d)
+ {
+ return d;
+ }
+
+ template <typename Decisions_>
void display_a_changes_and_removes(
const std::tr1::shared_ptr<Environment> & env,
const std::tr1::shared_ptr<const Resolved> & resolved,
- const std::tr1::shared_ptr<const Decisions<ChangeOrRemoveDecision> > & decisions,
+ const std::tr1::shared_ptr<Decisions_> & decisions,
const DisplayResolutionCommandLine & cmdline,
ChoicesToExplain & choices_to_explain,
const bool more_annotations,
@@ -1106,14 +1119,17 @@ namespace
cout << "These are the actions I will take, in order:" << endl << endl;
bool any(false);
- for (Decisions<ChangeOrRemoveDecision>::ConstIterator i(decisions->begin()),
- i_end(decisions->end()) ;
+ for (typename Decisions_::ConstIterator i(decisions->begin()), i_end(decisions->end()) ;
i != i_end ; ++i)
{
any = true;
- const ChangesToMakeDecision * const changes_to_make_decision(simple_visitor_cast<const ChangesToMakeDecision>(**i));
- const RemoveDecision * const remove_decision(simple_visitor_cast<const RemoveDecision>(**i));
+ const std::pair<
+ std::tr1::shared_ptr<const ChangeOrRemoveDecision>,
+ std::tr1::shared_ptr<const LineariserNotes> > star_i(get_decision_and_notes(*i));
+
+ const ChangesToMakeDecision * const changes_to_make_decision(simple_visitor_cast<const ChangesToMakeDecision>(*star_i.first));
+ const RemoveDecision * const remove_decision(simple_visitor_cast<const RemoveDecision>(*star_i.first));
if (changes_to_make_decision)
{
display_one_installish(