aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-26 14:33:07 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-26 14:33:07 +0100
commit1842b15a88f5f0a956851e89ba1fd2b98f4787ef (patch)
treedc719848f026bc8677ea619e4d96de7451821454
parent15d1ea83469f8a1a13e767912b6d6575fd816e64 (diff)
downloadpaludis-1842b15a88f5f0a956851e89ba1fd2b98f4787ef.tar.gz
paludis-1842b15a88f5f0a956851e89ba1fd2b98f4787ef.tar.xz
NAGIndex rather than Resolvent
-rw-r--r--paludis/resolver/nag-fwd.hh9
-rw-r--r--paludis/resolver/nag.cc102
-rw-r--r--paludis/resolver/nag.hh29
-rw-r--r--paludis/resolver/orderer.cc123
-rw-r--r--paludis/resolver/orderer.hh4
-rw-r--r--paludis/resolver/strongly_connected_component.hh11
6 files changed, 182 insertions, 96 deletions
diff --git a/paludis/resolver/nag-fwd.hh b/paludis/resolver/nag-fwd.hh
index 3ebc41e..b41ccc8 100644
--- a/paludis/resolver/nag-fwd.hh
+++ b/paludis/resolver/nag-fwd.hh
@@ -20,12 +20,21 @@
#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_NAG_FWD_HH
#define PALUDIS_GUARD_PALUDIS_RESOLVER_NAG_FWD_HH 1
+#include <paludis/util/attributes.hh>
+#include <iosfwd>
+
namespace paludis
{
namespace resolver
{
struct NAG;
+ struct NAGIndex;
struct NAGEdgeProperties;
+
+ bool operator< (const NAGIndex &, const NAGIndex &) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+ bool operator== (const NAGIndex &, const NAGIndex &) PALUDIS_ATTRIBUTE((warn_unused_result)) PALUDIS_VISIBLE;
+
+ std::ostream & operator<< (std::ostream &, const NAGIndex &) PALUDIS_VISIBLE;
}
}
diff --git a/paludis/resolver/nag.cc b/paludis/resolver/nag.cc
index 0f887c8..e131527 100644
--- a/paludis/resolver/nag.cc
+++ b/paludis/resolver/nag.cc
@@ -26,9 +26,10 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/wrapped_output_iterator.hh>
+#include <paludis/util/wrapped_output_iterator-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/set-impl.hh>
#include <paludis/util/member_iterator-impl.hh>
#include <paludis/serialise-impl.hh>
#include <tr1/unordered_set>
@@ -40,10 +41,53 @@
using namespace paludis;
using namespace paludis::resolver;
-typedef std::tr1::unordered_set<Resolvent, Hash<Resolvent> > Nodes;
-typedef std::tr1::unordered_map<Resolvent, NAGEdgeProperties, Hash<Resolvent> > NodesWithProperties;
-typedef std::tr1::unordered_map<Resolvent, NodesWithProperties, Hash<Resolvent> > Edges;
-typedef std::tr1::unordered_map<Resolvent, Nodes, Hash<Resolvent> > PlainEdges;
+typedef std::tr1::unordered_set<NAGIndex, Hash<NAGIndex> > Nodes;
+typedef std::tr1::unordered_map<NAGIndex, NAGEdgeProperties, Hash<NAGIndex> > NodesWithProperties;
+typedef std::tr1::unordered_map<NAGIndex, NodesWithProperties, Hash<NAGIndex> > Edges;
+typedef std::tr1::unordered_map<NAGIndex, Nodes, Hash<NAGIndex> > PlainEdges;
+
+std::size_t
+NAGIndex::hash() const
+{
+ return resolvent().hash();
+}
+
+bool
+paludis::resolver::operator< (const NAGIndex & a, const NAGIndex & b)
+{
+ return a.resolvent() < b.resolvent();
+}
+
+bool
+paludis::resolver::operator== (const NAGIndex & a, const NAGIndex & b)
+{
+ return a.resolvent() == b.resolvent();
+}
+
+std::ostream &
+paludis::resolver::operator<< (std::ostream & s, const NAGIndex & r)
+{
+ s << r.resolvent();
+ return s;
+}
+
+void
+NAGIndex::serialise(Serialiser & s) const
+{
+ s.object("NAGIndex")
+ .member(SerialiserFlags<>(), "resolvent", resolvent())
+ ;
+}
+
+const NAGIndex
+NAGIndex::deserialise(Deserialisation & d)
+{
+ Deserialisator v(d, "NAGIndex");
+
+ return make_named_values<NAGIndex>(
+ n::resolvent() = v.member<Resolvent>("resolvent")
+ );
+}
namespace paludis
{
@@ -84,13 +128,13 @@ NAG::~NAG()
}
void
-NAG::add_node(const Resolvent & r)
+NAG::add_node(const NAGIndex & r)
{
_imp->nodes.insert(r);
}
void
-NAG::add_edge(const Resolvent & a, const Resolvent & b, const NAGEdgeProperties & p)
+NAG::add_edge(const NAGIndex & a, const NAGIndex & b, const NAGEdgeProperties & p)
{
_imp->edges.insert(std::make_pair(a, NodesWithProperties())).first->second.insert(std::make_pair(b, p)).first->second |= p;
}
@@ -119,12 +163,12 @@ namespace
NamedValue<n::lowlink, int> lowlink;
};
- typedef std::tr1::unordered_map<Resolvent, TarjanData, Hash<Resolvent> > TarjanDataMap;
- typedef std::list<Resolvent> TarjanStack;
- typedef std::tr1::unordered_map<Resolvent, StronglyConnectedComponent, Hash<Resolvent> > StronglyConnectedComponentsByRepresentative;
- typedef std::tr1::unordered_map<Resolvent, Resolvent, Hash<Resolvent> > RepresentativeNodes;
+ typedef std::tr1::unordered_map<NAGIndex, TarjanData, Hash<NAGIndex> > TarjanDataMap;
+ typedef std::list<NAGIndex> TarjanStack;
+ typedef std::tr1::unordered_map<NAGIndex, StronglyConnectedComponent, Hash<NAGIndex> > StronglyConnectedComponentsByRepresentative;
+ typedef std::tr1::unordered_map<NAGIndex, NAGIndex, Hash<NAGIndex> > RepresentativeNodes;
- TarjanDataMap::iterator tarjan(const Resolvent & node, const Edges & edges, TarjanDataMap & data, TarjanStack & stack, int & index,
+ TarjanDataMap::iterator tarjan(const NAGIndex & node, const Edges & edges, TarjanDataMap & data, TarjanStack & stack, int & index,
StronglyConnectedComponentsByRepresentative & result)
{
TarjanDataMap::iterator node_data(data.insert(std::make_pair(node, make_named_values<TarjanData>(
@@ -156,8 +200,8 @@ namespace
if (node_data->second.index() == node_data->second.lowlink())
{
StronglyConnectedComponent scc(make_named_values<StronglyConnectedComponent>(
- n::nodes() = make_shared_ptr(new Set<Resolvent>),
- n::requirements() = make_shared_ptr(new Set<Resolvent>)
+ n::nodes() = make_shared_ptr(new Set<NAGIndex>),
+ n::requirements() = make_shared_ptr(new Set<NAGIndex>)
));
std::copy(stack.begin(), top_of_stack_before_node, scc.nodes()->inserter());
@@ -173,7 +217,7 @@ namespace
void dfs(
const StronglyConnectedComponentsByRepresentative & sccs,
- const Resolvent & node,
+ const NAGIndex & node,
const PlainEdges & edges,
Nodes & done,
std::tr1::shared_ptr<SortedStronglyConnectedComponents> & result)
@@ -182,11 +226,11 @@ namespace
return;
PlainEdges::const_iterator e(edges.find(node));
- std::set<Resolvent> consistently_ordered_edges;
+ std::set<NAGIndex> consistently_ordered_edges;
if (e != edges.end())
std::copy(e->second.begin(), e->second.end(), std::inserter(consistently_ordered_edges, consistently_ordered_edges.begin()));
- for (std::set<Resolvent>::const_iterator n(consistently_ordered_edges.begin()), n_end(consistently_ordered_edges.end()) ;
+ for (std::set<NAGIndex>::const_iterator n(consistently_ordered_edges.begin()), n_end(consistently_ordered_edges.end()) ;
n != n_end ; ++n)
dfs(sccs, *n, edges, done, result);
@@ -213,7 +257,7 @@ NAG::sorted_strongly_connected_components() const
RepresentativeNodes representative_nodes;
for (StronglyConnectedComponentsByRepresentative::const_iterator s(sccs.begin()), s_end(sccs.end()) ;
s != s_end ; ++s)
- for (Set<Resolvent>::ConstIterator r(s->second.nodes()->begin()), r_end(s->second.nodes()->end()) ;
+ for (Set<NAGIndex>::ConstIterator r(s->second.nodes()->begin()), r_end(s->second.nodes()->end()) ;
r != r_end ; ++r)
if (! representative_nodes.insert(std::make_pair(*r, s->first)).second)
throw InternalError(PALUDIS_HERE, "node in multiple sccs");
@@ -241,10 +285,10 @@ NAG::sorted_strongly_connected_components() const
* easier). we know there're no cycles. */
std::tr1::shared_ptr<SortedStronglyConnectedComponents> result(new SortedStronglyConnectedComponents);
Nodes done;
- std::set<Resolvent> consistently_ordered_representative_nodes;
+ std::set<NAGIndex> consistently_ordered_representative_nodes;
std::copy(first_iterator(sccs.begin()), first_iterator(sccs.end()),
std::inserter(consistently_ordered_representative_nodes, consistently_ordered_representative_nodes.begin()));
- for (std::set<Resolvent>::const_iterator n(consistently_ordered_representative_nodes.begin()),
+ for (std::set<NAGIndex>::const_iterator n(consistently_ordered_representative_nodes.begin()),
n_end(consistently_ordered_representative_nodes.end()) ;
n != n_end ; ++n)
dfs(sccs, *n, scc_edges, done, result);
@@ -256,7 +300,7 @@ NAG::sorted_strongly_connected_components() const
}
NAG::EdgesFromConstIterator
-NAG::begin_edges_from(const Resolvent & r) const
+NAG::begin_edges_from(const NAGIndex & r) const
{
Edges::const_iterator e(_imp->edges.find(r));
if (e == _imp->edges.end())
@@ -266,7 +310,7 @@ NAG::begin_edges_from(const Resolvent & r) const
}
NAG::EdgesFromConstIterator
-NAG::end_edges_from(const Resolvent & r) const
+NAG::end_edges_from(const NAGIndex & r) const
{
Edges::const_iterator e(_imp->edges.find(r));
if (e == _imp->edges.end())
@@ -319,13 +363,13 @@ NAG::deserialise(Deserialisation & d)
{
Deserialisator vv(*v.find_remove_member("nodes"), "c");
for (int n(1), n_end(vv.member<int>("count") + 1) ; n != n_end ; ++n)
- result->add_node(vv.member<Resolvent>(stringify(n)));
+ result->add_node(vv.member<NAGIndex>(stringify(n)));
}
for (int n(1), n_end(v.member<int>("edge.count") + 1) ; n != n_end ; ++n)
result->add_edge(
- v.member<Resolvent>("edge." + stringify(n) + ".f"),
- v.member<Resolvent>("edge." + stringify(n) + ".t"),
+ v.member<NAGIndex>("edge." + stringify(n) + ".f"),
+ v.member<NAGIndex>("edge." + stringify(n) + ".t"),
v.member<NAGEdgeProperties>("edge." + stringify(n) + ".p")
);
@@ -365,6 +409,10 @@ NAGEdgeProperties::deserialise(Deserialisation & d)
);
}
-template class WrappedForwardIterator<NAG::EdgesFromConstIteratorTag, const std::pair<const Resolvent, NAGEdgeProperties> >;
-template class WrappedForwardIterator<NAG::NodesConstIteratorTag, const Resolvent>;
+template class WrappedForwardIterator<NAG::EdgesFromConstIteratorTag, const std::pair<const NAGIndex, NAGEdgeProperties> >;
+template class WrappedForwardIterator<NAG::NodesConstIteratorTag, const NAGIndex>;
+
+template class Set<NAGIndex>;
+template class WrappedForwardIterator<Set<NAGIndex>::ConstIteratorTag, const NAGIndex>;
+template class WrappedOutputIterator<Set<NAGIndex>::InserterTag, NAGIndex>;
diff --git a/paludis/resolver/nag.hh b/paludis/resolver/nag.hh
index 4f400bb..68d96d7 100644
--- a/paludis/resolver/nag.hh
+++ b/paludis/resolver/nag.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_NAG_HH 1
#include <paludis/resolver/nag-fwd.hh>
-#include <paludis/resolver/resolvent-fwd.hh>
+#include <paludis/resolver/resolvent.hh>
#include <paludis/resolver/strongly_connected_component-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -35,12 +35,23 @@ namespace paludis
{
typedef Name<struct build_name> build;
typedef Name<struct build_all_met_name> build_all_met;
+ typedef Name<struct resolvent_name> resolvent;
typedef Name<struct run_name> run;
typedef Name<struct run_all_met_name> run_all_met;
}
namespace resolver
{
+ struct NAGIndex
+ {
+ NamedValue<n::resolvent, Resolvent> resolvent;
+
+ std::size_t hash() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void serialise(Serialiser &) const;
+ static const NAGIndex deserialise(Deserialisation & d) PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
struct NAGEdgeProperties
{
NamedValue<n::build, bool> build;
@@ -61,8 +72,8 @@ namespace paludis
NAG();
~NAG();
- void add_node(const Resolvent &);
- void add_edge(const Resolvent &, const Resolvent &, const NAGEdgeProperties &);
+ void add_node(const NAGIndex &);
+ void add_edge(const NAGIndex &, const NAGIndex &, const NAGEdgeProperties &);
void verify_edges() const;
@@ -70,12 +81,12 @@ namespace paludis
sorted_strongly_connected_components() const PALUDIS_ATTRIBUTE((warn_unused_result));
struct EdgesFromConstIteratorTag;
- typedef WrappedForwardIterator<EdgesFromConstIteratorTag, const std::pair<const Resolvent, NAGEdgeProperties> > EdgesFromConstIterator;
- EdgesFromConstIterator begin_edges_from(const Resolvent &) const PALUDIS_ATTRIBUTE((warn_unused_result));
- EdgesFromConstIterator end_edges_from(const Resolvent &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ typedef WrappedForwardIterator<EdgesFromConstIteratorTag, const std::pair<const NAGIndex, NAGEdgeProperties> > EdgesFromConstIterator;
+ EdgesFromConstIterator begin_edges_from(const NAGIndex &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ EdgesFromConstIterator end_edges_from(const NAGIndex &) const PALUDIS_ATTRIBUTE((warn_unused_result));
struct NodesConstIteratorTag;
- typedef WrappedForwardIterator<NodesConstIteratorTag, const Resolvent> NodesConstIterator;
+ typedef WrappedForwardIterator<NodesConstIteratorTag, const NAGIndex> NodesConstIterator;
NodesConstIterator begin_nodes() const PALUDIS_ATTRIBUTE((warn_unused_result));
NodesConstIterator end_nodes() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -86,8 +97,8 @@ namespace paludis
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
extern template class WrappedForwardIterator<resolver::NAG::EdgesFromConstIteratorTag,
- const std::pair<const resolver::Resolvent, resolver::NAGEdgeProperties> >;
- extern template class WrappedForwardIterator<resolver::NAG::NodesConstIteratorTag, const resolver::Resolvent>;
+ const std::pair<const resolver::NAGIndex, resolver::NAGEdgeProperties> >;
+ extern template class WrappedForwardIterator<resolver::NAG::NodesConstIteratorTag, const resolver::NAGIndex>;
#endif
}
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 0c0c518..2c6fbe3 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -50,8 +50,8 @@
using namespace paludis;
using namespace paludis::resolver;
-typedef std::tr1::unordered_map<Resolvent, std::tr1::shared_ptr<const ChangeOrRemoveDecision>, Hash<Resolvent> > ChangeOrRemoveResolvents;
-typedef std::tr1::unordered_map<Resolvent, JobNumber, Hash<Resolvent> > InstallJobNumbers;
+typedef std::tr1::unordered_map<NAGIndex, std::tr1::shared_ptr<const ChangeOrRemoveDecision>, Hash<NAGIndex> > ChangeOrRemoveIndices;
+typedef std::tr1::unordered_map<NAGIndex, JobNumber, Hash<NAGIndex> > InstallJobNumbers;
namespace paludis
{
@@ -60,7 +60,7 @@ namespace paludis
{
const Environment * const env;
const std::tr1::shared_ptr<Resolved> resolved;
- ChangeOrRemoveResolvents change_or_remove_resolvents;
+ ChangeOrRemoveIndices change_or_remove_indices;
InstallJobNumbers install_job_numbers;
Implementation(
@@ -92,19 +92,19 @@ namespace
{
const std::tr1::shared_ptr<Resolved> resolved;
ResolventsSet & ignore_dependencies_from_resolvents;
- ChangeOrRemoveResolvents & change_or_remove_resolvents;
+ ChangeOrRemoveIndices & change_or_remove_indices;
const Resolvent resolvent;
const std::tr1::shared_ptr<const Decision> decision;
DecisionDispatcher(
const std::tr1::shared_ptr<Resolved> & r,
ResolventsSet & i,
- ChangeOrRemoveResolvents & c,
+ ChangeOrRemoveIndices & c,
const Resolvent & v,
const std::tr1::shared_ptr<const Decision> & d) :
resolved(r),
ignore_dependencies_from_resolvents(i),
- change_or_remove_resolvents(c),
+ change_or_remove_indices(c),
resolvent(v),
decision(d)
{
@@ -126,13 +126,17 @@ namespace
bool visit(const NothingNoChangeDecision &)
{
- resolved->nag()->add_node(resolvent);
+ resolved->nag()->add_node(make_named_values<NAGIndex>(
+ n::resolvent() = resolvent
+ ));
return true;
}
bool visit(const ExistingNoChangeDecision &)
{
- resolved->nag()->add_node(resolvent);
+ resolved->nag()->add_node(make_named_values<NAGIndex>(
+ n::resolvent() = resolvent
+ ));
return true;
}
@@ -140,8 +144,11 @@ namespace
{
if (decision->taken())
{
- resolved->nag()->add_node(resolvent);
- change_or_remove_resolvents.insert(std::make_pair(resolvent,
+ NAGIndex index(make_named_values<NAGIndex>(
+ n::resolvent() = resolvent
+ ));
+ resolved->nag()->add_node(index);
+ change_or_remove_indices.insert(std::make_pair(index,
std::tr1::static_pointer_cast<const ChangeOrRemoveDecision>(decision)));
return true;
}
@@ -157,8 +164,11 @@ namespace
{
if (decision->taken())
{
- resolved->nag()->add_node(resolvent);
- change_or_remove_resolvents.insert(std::make_pair(resolvent,
+ NAGIndex index(make_named_values<NAGIndex>(
+ n::resolvent() = resolvent
+ ));
+ resolved->nag()->add_node(index);
+ change_or_remove_indices.insert(std::make_pair(index,
std::tr1::static_pointer_cast<const ChangeOrRemoveDecision>(decision)));
return true;
}
@@ -276,7 +286,14 @@ namespace
arrow = false;
if (arrow)
- nag->add_edge(r.from_resolvent(), resolvent, make_named_values<NAGEdgeProperties>(
+ nag->add_edge(
+ make_named_values<NAGIndex>(
+ n::resolvent() = r.from_resolvent()
+ ),
+ make_named_values<NAGIndex>(
+ n::resolvent() = resolvent
+ ),
+ make_named_values<NAGEdgeProperties>(
n::build() = classifier.build,
n::build_all_met() = r.already_met() || ! classifier.build,
n::run() = classifier.run,
@@ -317,10 +334,10 @@ namespace
};
bool no_build_dependencies(
- const Set<Resolvent> & resolvents,
+ const Set<NAGIndex> & indices,
const NAG & nag)
{
- for (Set<Resolvent>::ConstIterator r(resolvents.begin()), r_end(resolvents.end()) ;
+ for (Set<NAGIndex>::ConstIterator r(indices.begin()), r_end(indices.end()) ;
r != r_end ; ++r)
for (NAG::EdgesFromConstIterator e(nag.begin_edges_from(*r)), e_end(nag.end_edges_from(*r)) ;
e != e_end ; ++e)
@@ -346,7 +363,7 @@ Orderer::resolve()
DecisionDispatcher decision_dispatcher(
_imp->resolved,
ignore_dependencies_from_resolvents,
- _imp->change_or_remove_resolvents,
+ _imp->change_or_remove_indices,
(*r)->resolvent(),
(*r)->decision());
if (! (*r)->decision()->accept_returning<bool>(decision_dispatcher))
@@ -386,12 +403,12 @@ Orderer::resolve()
* nodes. this matters for cycle resolution. we identify them now, even
* though our scc might just contain a single install, rather than
* adding in extra useless code for the special easy case. */
- typedef std::tr1::unordered_set<Resolvent, Hash<Resolvent> > ChangesInSCC;
+ typedef std::tr1::unordered_set<NAGIndex, Hash<NAGIndex> > ChangesInSCC;
ChangesInSCC changes_in_scc;
- for (Set<Resolvent>::ConstIterator r(scc->nodes()->begin()), r_end(scc->nodes()->end()) ;
+ for (Set<NAGIndex>::ConstIterator r(scc->nodes()->begin()), r_end(scc->nodes()->end()) ;
r != r_end ; ++r)
- if (_imp->change_or_remove_resolvents.end() != _imp->change_or_remove_resolvents.find(*r))
+ if (_imp->change_or_remove_indices.end() != _imp->change_or_remove_indices.find(*r))
changes_in_scc.insert(*r);
if (changes_in_scc.empty())
@@ -404,7 +421,7 @@ Orderer::resolve()
/* there's only one real package in the component, so there's no
* need to try anything clever */
_check_self_deps_and_schedule(*changes_in_scc.begin(),
- _imp->change_or_remove_resolvents.find(*changes_in_scc.begin())->second,
+ _imp->change_or_remove_indices.find(*changes_in_scc.begin())->second,
make_shared_copy(make_named_values<OrdererNotes>(
n::cycle_breaking() = ""
)));
@@ -437,9 +454,9 @@ Orderer::resolve()
namespace
{
- std::string nice_resolvent(const Resolvent & r)
+ std::string nice_index(const NAGIndex & x)
{
- return stringify(r.package()) + stringify(r.slot());
+ return stringify(x.resolvent().package()) + stringify(x.resolvent().slot());
}
}
@@ -459,11 +476,11 @@ Orderer::_order_sub_ssccs(
{
/* yay. it's all on its own. */
_check_self_deps_and_schedule(*sub_scc->nodes()->begin(),
- _imp->change_or_remove_resolvents.find(*sub_scc->nodes()->begin())->second,
+ _imp->change_or_remove_indices.find(*sub_scc->nodes()->begin())->second,
make_shared_copy(make_named_values<OrdererNotes>(
n::cycle_breaking() = (can_recurse ?
- "In dependency cycle with existing packages: " + join(scc_nag.begin_nodes(), scc_nag.end_nodes(), ", ", nice_resolvent) :
- "In dependency cycle with: " + join(top_scc.nodes()->begin(), top_scc.nodes()->end(), ", ", nice_resolvent))
+ "In dependency cycle with existing packages: " + join(scc_nag.begin_nodes(), scc_nag.end_nodes(), ", ", nice_index) :
+ "In dependency cycle with: " + join(top_scc.nodes()->begin(), top_scc.nodes()->end(), ", ", nice_index))
)));
}
else if (no_build_dependencies(*sub_scc->nodes(), scc_nag))
@@ -471,14 +488,14 @@ Orderer::_order_sub_ssccs(
/* what's that, timmy? we have directly codependent nodes?
* well i'm jolly glad that's because they're run
* dependency cycles which we can order however we like! */
- for (Set<Resolvent>::ConstIterator r(sub_scc->nodes()->begin()), r_end(sub_scc->nodes()->end()) ;
+ for (Set<NAGIndex>::ConstIterator r(sub_scc->nodes()->begin()), r_end(sub_scc->nodes()->end()) ;
r != r_end ; ++r)
_check_self_deps_and_schedule(*r,
- _imp->change_or_remove_resolvents.find(*r)->second,
+ _imp->change_or_remove_indices.find(*r)->second,
make_shared_copy(make_named_values<OrdererNotes>(
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) : "")
+ sub_scc->nodes()->begin(), sub_scc->nodes()->end(), ", ", nice_index) + (can_recurse ?
+ " in dependency cycle with " + join(top_scc.nodes()->begin(), top_scc.nodes()->end(), ", ", nice_index) : "")
)));
}
else if (can_recurse)
@@ -487,7 +504,7 @@ Orderer::_order_sub_ssccs(
* this whole mess again, except without any edges for
* dependencies that're already met */
NAG scc_nag_without_met_deps;
- for (Set<Resolvent>::ConstIterator r(sub_scc->nodes()->begin()), r_end(sub_scc->nodes()->end()) ;
+ for (Set<NAGIndex>::ConstIterator r(sub_scc->nodes()->begin()), r_end(sub_scc->nodes()->end()) ;
r != r_end ; ++r)
{
scc_nag_without_met_deps.add_node(*r);
@@ -510,32 +527,32 @@ Orderer::_order_sub_ssccs(
}
else
{
- for (Set<Resolvent>::ConstIterator r(sub_scc->nodes()->begin()), r_end(sub_scc->nodes()->end()) ;
+ for (Set<NAGIndex>::ConstIterator r(sub_scc->nodes()->begin()), r_end(sub_scc->nodes()->end()) ;
r != r_end ; ++r)
_imp->resolved->taken_unorderable_decisions()->push_back(
- _imp->change_or_remove_resolvents.find(*r)->second,
+ _imp->change_or_remove_indices.find(*r)->second,
make_shared_copy(make_named_values<OrdererNotes>(
n::cycle_breaking() = "In unsolvable cycle with " + join(
- top_scc.nodes()->begin(), top_scc.nodes()->end(), ", ", nice_resolvent))));
+ top_scc.nodes()->begin(), top_scc.nodes()->end(), ", ", nice_index))));
}
}
}
namespace
{
- typedef std::tr1::unordered_set<Resolvent, Hash<Resolvent> > RecursedRequirements;
+ typedef std::tr1::unordered_set<NAGIndex, Hash<NAGIndex> > RecursedRequirements;
void populate_requirements(
const std::tr1::shared_ptr<const NAG> & nag,
const InstallJobNumbers & install_job_numbers,
- const Resolvent & resolvent,
+ const NAGIndex & index,
const std::tr1::shared_ptr<JobRequirements> & requirements,
const bool recursing,
RecursedRequirements & recursed)
{
if (! recursing)
- for (NAG::EdgesFromConstIterator e(nag->begin_edges_from(resolvent)),
- e_end(nag->end_edges_from(resolvent)) ;
+ for (NAG::EdgesFromConstIterator e(nag->begin_edges_from(index)),
+ e_end(nag->end_edges_from(index)) ;
e != e_end ; ++e)
{
if ((! e->second.build_all_met()) || (! e->second.run_all_met()))
@@ -549,9 +566,9 @@ namespace
}
}
- if (recursed.insert(resolvent).second)
- for (NAG::EdgesFromConstIterator e(nag->begin_edges_from(resolvent)),
- e_end(nag->end_edges_from(resolvent)) ;
+ if (recursed.insert(index).second)
+ for (NAG::EdgesFromConstIterator e(nag->begin_edges_from(index)),
+ e_end(nag->end_edges_from(index)) ;
e != e_end ; ++e)
{
InstallJobNumbers::const_iterator n(install_job_numbers.find(e->first));
@@ -567,17 +584,17 @@ namespace
void
Orderer::_check_self_deps_and_schedule(
- const Resolvent & resolvent,
+ const NAGIndex & index,
const std::tr1::shared_ptr<const ChangeOrRemoveDecision> & d,
const std::tr1::shared_ptr<OrdererNotes> & n)
{
/* do we dep directly upon ourself? */
bool direct_self_dep(false), self_dep_is_met(true), self_dep_is_not_build(true);
- for (NAG::EdgesFromConstIterator e(_imp->resolved->nag()->begin_edges_from(resolvent)),
- e_end(_imp->resolved->nag()->end_edges_from(resolvent)) ;
+ for (NAG::EdgesFromConstIterator e(_imp->resolved->nag()->begin_edges_from(index)),
+ e_end(_imp->resolved->nag()->end_edges_from(index)) ;
e != e_end ; ++e)
{
- if (e->first == resolvent)
+ if (e->first == index)
{
direct_self_dep = true;
self_dep_is_met = self_dep_is_met && e->second.build_all_met() && e->second.run_all_met();
@@ -601,11 +618,11 @@ Orderer::_check_self_deps_and_schedule(
if (direct_self_dep && ! self_dep_is_met && ! self_dep_is_not_build)
{
_imp->resolved->taken_unorderable_decisions()->push_back(
- _imp->change_or_remove_resolvents.find(resolvent)->second,
+ _imp->change_or_remove_indices.find(index)->second,
n);
}
else
- _schedule(resolvent, d, n);
+ _schedule(index, d, n);
}
namespace
@@ -614,15 +631,15 @@ namespace
{
const std::tr1::shared_ptr<const Resolved> resolved;
InstallJobNumbers & install_job_numbers;
- const Resolvent resolvent;
+ const NAGIndex index;
ExtraScheduler(
const std::tr1::shared_ptr<const Resolved> & r,
InstallJobNumbers & i,
- const Resolvent & v) :
+ const NAGIndex & v) :
resolved(r),
install_job_numbers(i),
- resolvent(v)
+ index(v)
{
}
@@ -645,7 +662,7 @@ namespace
populate_requirements(
resolved->nag(),
install_job_numbers,
- resolvent,
+ index,
requirements,
false,
recursed
@@ -665,7 +682,7 @@ namespace
replacing
))));
- install_job_numbers.insert(std::make_pair(resolvent, install_job_n));
+ install_job_numbers.insert(std::make_pair(index, install_job_n));
}
void visit(const RemoveDecision & remove_decision) const
@@ -686,7 +703,7 @@ namespace
void
Orderer::_schedule(
- const Resolvent & resolvent,
+ const NAGIndex & index,
const std::tr1::shared_ptr<const ChangeOrRemoveDecision> & d,
const std::tr1::shared_ptr<const OrdererNotes> & n)
{
@@ -694,6 +711,6 @@ Orderer::_schedule(
if (d->required_confirmations_if_any())
_imp->resolved->taken_unconfirmed_decisions()->push_back(d);
- d->accept(ExtraScheduler(_imp->resolved, _imp->install_job_numbers, resolvent));
+ d->accept(ExtraScheduler(_imp->resolved, _imp->install_job_numbers, index));
}
diff --git a/paludis/resolver/orderer.hh b/paludis/resolver/orderer.hh
index e524244..e75280d 100644
--- a/paludis/resolver/orderer.hh
+++ b/paludis/resolver/orderer.hh
@@ -39,12 +39,12 @@ namespace paludis
{
private:
void _check_self_deps_and_schedule(
- const Resolvent &,
+ const NAGIndex &,
const std::tr1::shared_ptr<const ChangeOrRemoveDecision> &,
const std::tr1::shared_ptr<OrdererNotes> &);
void _schedule(
- const Resolvent &,
+ const NAGIndex &,
const std::tr1::shared_ptr<const ChangeOrRemoveDecision> &,
const std::tr1::shared_ptr<const OrdererNotes> &);
diff --git a/paludis/resolver/strongly_connected_component.hh b/paludis/resolver/strongly_connected_component.hh
index 1c76dcf..4533930 100644
--- a/paludis/resolver/strongly_connected_component.hh
+++ b/paludis/resolver/strongly_connected_component.hh
@@ -22,6 +22,7 @@
#include <paludis/resolver/strongly_connected_component-fwd.hh>
#include <paludis/resolver/resolvent-fwd.hh>
+#include <paludis/resolver/nag-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
@@ -41,15 +42,15 @@ namespace paludis
{
struct StronglyConnectedComponent
{
- NamedValue<n::nodes, std::tr1::shared_ptr<Set<Resolvent> > > nodes;
- NamedValue<n::requirements, std::tr1::shared_ptr<Set<Resolvent> > > requirements;
+ NamedValue<n::nodes, std::tr1::shared_ptr<Set<NAGIndex> > > nodes;
+ NamedValue<n::requirements, std::tr1::shared_ptr<Set<NAGIndex> > > requirements;
};
}
#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
- extern template class Set<resolver::Resolvent>;
- extern template class WrappedForwardIterator<Set<resolver::Resolvent>::ConstIteratorTag, const resolver::Resolvent>;
- extern template class WrappedOutputIterator<Set<resolver::Resolvent>::InserterTag, resolver::Resolvent>;
+ extern template class Set<resolver::NAGIndex>;
+ extern template class WrappedForwardIterator<Set<resolver::NAGIndex>::ConstIteratorTag, const resolver::NAGIndex>;
+ extern template class WrappedOutputIterator<Set<resolver::NAGIndex>::InserterTag, resolver::NAGIndex>;
extern template class Sequence<resolver::StronglyConnectedComponent>;
extern template class WrappedForwardIterator<Sequence<resolver::StronglyConnectedComponent>::ConstIteratorTag, const resolver::StronglyConnectedComponent>;