aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-26 10:55:57 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-26 10:55:57 +0100
commit8342db9bf5f43b46b8b87433892198b779c64108 (patch)
tree5867f961374cf944a271e08a242171728cf3364a
parentda783b99128623ec97d355b286b452f6b60dda43 (diff)
downloadpaludis-8342db9bf5f43b46b8b87433892198b779c64108.tar.gz
paludis-8342db9bf5f43b46b8b87433892198b779c64108.tar.xz
Fix InternalError when dealing with certain cycles
For an SCC NAG in the form: (a -> b -> c -> a) -> (d -> e -> f -> d) -> (already met g) -> we would try to put the inter-SCC arrows in the subgraphs.
-rw-r--r--paludis/resolver/orderer.cc15
-rw-r--r--paludis/resolver/resolver_TEST_cycles.cc44
-rwxr-xr-xpaludis/resolver/resolver_TEST_cycles_setup.sh67
3 files changed, 119 insertions, 7 deletions
diff --git a/paludis/resolver/orderer.cc b/paludis/resolver/orderer.cc
index 9e891e3..c9a62d7 100644
--- a/paludis/resolver/orderer.cc
+++ b/paludis/resolver/orderer.cc
@@ -623,13 +623,14 @@ Orderer::_order_sub_ssccs(
scc_nag_without_met_deps.add_node(*r);
for (NAG::EdgesFromConstIterator e(scc_nag.begin_edges_from(*r)), e_end(scc_nag.end_edges_from(*r)) ;
e != e_end ; ++e)
- if ((! e->second.build_all_met()) || (! e->second.run_all_met()))
- scc_nag_without_met_deps.add_edge(*r, e->first, make_named_values<NAGEdgeProperties>(
- n::build() = e->second.build() && ! e->second.build_all_met(),
- n::build_all_met() = e->second.build_all_met(),
- n::run() = e->second.run() && ! e->second.run_all_met(),
- n::run_all_met() = e->second.run_all_met()
- ));
+ if (sub_scc->nodes()->end() != sub_scc->nodes()->find(e->first))
+ if ((! e->second.build_all_met()) || (! e->second.run_all_met()))
+ scc_nag_without_met_deps.add_edge(*r, e->first, make_named_values<NAGEdgeProperties>(
+ n::build() = e->second.build() && ! e->second.build_all_met(),
+ n::build_all_met() = e->second.build_all_met(),
+ n::run() = e->second.run() && ! e->second.run_all_met(),
+ n::run_all_met() = e->second.run_all_met()
+ ));
}
scc_nag_without_met_deps.verify_edges();
diff --git a/paludis/resolver/resolver_TEST_cycles.cc b/paludis/resolver/resolver_TEST_cycles.cc
index 3f0b3cd..ebba3cc 100644
--- a/paludis/resolver/resolver_TEST_cycles.cc
+++ b/paludis/resolver/resolver_TEST_cycles.cc
@@ -347,5 +347,49 @@ namespace test_cases
test_self_x_b(-1, false), test_self_x_r(-1, true),
test_self_0_b( 0, false), test_self_0_r( 0, true),
test_self_1_b( 1, false), test_self_1_r( 1, true);
+
+ struct CycleDeps : ResolverCyclesTestCase
+ {
+ CycleDeps() :
+ ResolverCyclesTestCase("cycle deps")
+ {
+ install("cycle-deps", "dep-g", "1")->build_dependencies_key()->set_from_string("cycle-deps/dep-c");
+ }
+
+ virtual ResolverFunctions get_resolver_functions(InitialConstraints & initial_constraints)
+ {
+ ResolverFunctions result(ResolverCyclesTestCase::get_resolver_functions(initial_constraints));
+ result.get_use_existing_fn() = std::bind(&use_existing_if_same, std::placeholders::_1,
+ std::placeholders::_2, std::placeholders::_3);
+ return result;
+ }
+
+ void run()
+ {
+ std::shared_ptr<const Resolved> resolved(get_resolved("cycle-deps/target"));
+
+ check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("cycle-deps/target"))
+ .finished()),
+ n::taken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unconfirmed_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unorderable_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("cycle-deps/dep-d"))
+ .change(QualifiedPackageName("cycle-deps/dep-e"))
+ .change(QualifiedPackageName("cycle-deps/dep-f"))
+ .change(QualifiedPackageName("cycle-deps/dep-a"))
+ .change(QualifiedPackageName("cycle-deps/dep-b"))
+ .change(QualifiedPackageName("cycle-deps/dep-c"))
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+ }
+ } test_cycle_deps;
}
diff --git a/paludis/resolver/resolver_TEST_cycles_setup.sh b/paludis/resolver/resolver_TEST_cycles_setup.sh
index dec11a5..5bdbcb8 100755
--- a/paludis/resolver/resolver_TEST_cycles_setup.sh
+++ b/paludis/resolver/resolver_TEST_cycles_setup.sh
@@ -188,5 +188,72 @@ END
done
+# cycle-deps
+echo 'cycle-deps' >> metadata/categories.conf
+
+mkdir -p 'packages/cycle-deps/target'
+cat <<END > packages/cycle-deps/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="cycle-deps/dep-a"
+END
+
+mkdir -p 'packages/cycle-deps/dep-a'
+cat <<END > packages/cycle-deps/dep-a/dep-a-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="build: cycle-deps/dep-b"
+END
+
+mkdir -p 'packages/cycle-deps/dep-b'
+cat <<END > packages/cycle-deps/dep-b/dep-b-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="build: cycle-deps/dep-c cycle-deps/dep-d"
+END
+
+mkdir -p 'packages/cycle-deps/dep-c'
+cat <<END > packages/cycle-deps/dep-c/dep-c-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="build: cycle-deps/dep-a"
+END
+
+mkdir -p 'packages/cycle-deps/dep-d'
+cat <<END > packages/cycle-deps/dep-d/dep-d-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="build: cycle-deps/dep-e"
+END
+
+mkdir -p 'packages/cycle-deps/dep-e'
+cat <<END > packages/cycle-deps/dep-e/dep-e-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="build: cycle-deps/dep-f"
+END
+
+mkdir -p 'packages/cycle-deps/dep-f'
+cat <<END > packages/cycle-deps/dep-f/dep-f-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="build: cycle-deps/dep-d cycle-deps/dep-g"
+END
+
+mkdir -p 'packages/cycle-deps/dep-g'
+cat <<END > packages/cycle-deps/dep-g/dep-g-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="build: cycle-deps/dep-c"
+END
+
cd ..