aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-14 13:36:55 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-14 13:36:55 +0100
commite0dc10d364802bee37e19a8468002d61e358cb43 (patch)
treef020e95f67e7f1799efd17af8e0e0f96038bbf8b
parent50d099e6e079d180d14584180f942e9e365690ea (diff)
downloadpaludis-e0dc10d364802bee37e19a8468002d61e358cb43.tar.gz
paludis-e0dc10d364802bee37e19a8468002d61e358cb43.tar.xz
Labels affect edges
-rw-r--r--paludis/resolver/lineariser.cc79
-rw-r--r--paludis/resolver/resolver_TEST_simple.cc50
-rwxr-xr-xpaludis/resolver/resolver_TEST_simple_setup.sh70
3 files changed, 198 insertions, 1 deletions
diff --git a/paludis/resolver/lineariser.cc b/paludis/resolver/lineariser.cc
index 83c573d..56c55d5 100644
--- a/paludis/resolver/lineariser.cc
+++ b/paludis/resolver/lineariser.cc
@@ -155,6 +155,65 @@ namespace
}
};
+ struct LabelsClassifier
+ {
+ bool build;
+ bool run;
+ bool post;
+
+ LabelsClassifier() :
+ build(false),
+ run(false),
+ post(false)
+ {
+ }
+
+ void visit(const DependenciesBuildLabel &)
+ {
+ build = true;
+ }
+
+ void visit(const DependenciesInstallLabel &)
+ {
+ build = true;
+ }
+
+ void visit(const DependenciesFetchLabel &)
+ {
+ build = true;
+ }
+
+ void visit(const DependenciesRunLabel &)
+ {
+ run = true;
+ }
+
+ void visit(const DependenciesTestLabel &)
+ {
+ build = true;
+ }
+
+ void visit(const DependenciesPostLabel &)
+ {
+ post = true;
+ }
+
+ void visit(const DependenciesSuggestionLabel &)
+ {
+ post = true;
+ }
+
+ void visit(const DependenciesRecommendationLabel &)
+ {
+ post = true;
+ }
+
+ void visit(const DependenciesCompileAgainstLabel &)
+ {
+ build = true;
+ }
+ };
+
struct EdgesFromReasonVisitor
{
const std::tr1::shared_ptr<NAG> nag;
@@ -175,8 +234,26 @@ namespace
{
/* we may be constrained by a dep from a package that was changed
* from a non error decision to an unable to make decision */
- if (ignore_dependencies_from_resolvents.end() == ignore_dependencies_from_resolvents.find(r.from_resolvent()))
+ if (ignore_dependencies_from_resolvents.end() != ignore_dependencies_from_resolvents.find(r.from_resolvent()))
+ return;
+
+ /* what sort of dep are we? */
+ LabelsClassifier classifier;
+ for (DependenciesLabelSequence::ConstIterator l(r.sanitised_dependency().active_dependency_labels()->begin()),
+ l_end(r.sanitised_dependency().active_dependency_labels()->end()) ;
+ l != l_end ; ++l)
+ (*l)->accept(classifier);
+
+ if (classifier.build || classifier.run)
nag->add_edge(r.from_resolvent(), resolvent);
+ else if (classifier.post)
+ {
+ /* we won't add a backwards edge, since most post deps dep upon
+ * the thing requiring them anyway */
+ // nag->add_edge(resolvent, r.from_resolvent());
+ }
+ else
+ throw InternalError(PALUDIS_HERE, "No classification");
}
void visit(const SetReason & r)
diff --git a/paludis/resolver/resolver_TEST_simple.cc b/paludis/resolver/resolver_TEST_simple.cc
index b0c2954..3634f65 100644
--- a/paludis/resolver/resolver_TEST_simple.cc
+++ b/paludis/resolver/resolver_TEST_simple.cc
@@ -112,5 +112,55 @@ namespace test_cases
);
}
} test_build_deps;
+
+ struct TestRunDeps : ResolverSimpleTestCase
+ {
+ TestRunDeps() : ResolverSimpleTestCase("run-deps") { }
+
+ void run()
+ {
+ std::tr1::shared_ptr<const Resolved> resolved(get_resolved("run-deps/target"));
+
+ check_resolved(resolved,
+ n::display_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("run-deps/a-dep"))
+ .change(QualifiedPackageName("run-deps/b-dep"))
+ .change(QualifiedPackageName("run-deps/z-dep"))
+ .change(QualifiedPackageName("run-deps/target"))
+ .finished()),
+ n::taken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+ }
+ } test_run_deps;
+
+ struct TestPostDeps : ResolverSimpleTestCase
+ {
+ TestPostDeps() : ResolverSimpleTestCase("post-deps") { }
+
+ void run()
+ {
+ std::tr1::shared_ptr<const Resolved> resolved(get_resolved("post-deps/target"));
+
+ check_resolved(resolved,
+ n::display_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("post-deps/a-dep"))
+ .change(QualifiedPackageName("post-deps/b-dep"))
+ .change(QualifiedPackageName("post-deps/target"))
+ .change(QualifiedPackageName("post-deps/z-dep"))
+ .finished()),
+ n::taken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+ }
+ } test_post_deps;
}
diff --git a/paludis/resolver/resolver_TEST_simple_setup.sh b/paludis/resolver/resolver_TEST_simple_setup.sh
index c025889..4c9d0aa 100755
--- a/paludis/resolver/resolver_TEST_simple_setup.sh
+++ b/paludis/resolver/resolver_TEST_simple_setup.sh
@@ -60,5 +60,75 @@ SLOT="0"
DEPENDENCIES=""
END
+# run-deps
+echo 'run-deps' >> metadata/categories.conf
+
+mkdir -p 'packages/run-deps/target'
+cat <<END > packages/run-deps/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="run: run-deps/a-dep run-deps/b-dep run-deps/z-dep"
+END
+
+mkdir -p 'packages/run-deps/a-dep'
+cat <<END > packages/run-deps/a-dep/a-dep-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
+mkdir -p 'packages/run-deps/b-dep'
+cat <<END > packages/run-deps/b-dep/b-dep-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
+mkdir -p 'packages/run-deps/z-dep'
+cat <<END > packages/run-deps/z-dep/z-dep-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
+# post-deps
+echo 'post-deps' >> metadata/categories.conf
+
+mkdir -p 'packages/post-deps/target'
+cat <<END > packages/post-deps/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="post: post-deps/a-dep post-deps/b-dep post-deps/z-dep"
+END
+
+mkdir -p 'packages/post-deps/a-dep'
+cat <<END > packages/post-deps/a-dep/a-dep-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
+mkdir -p 'packages/post-deps/b-dep'
+cat <<END > packages/post-deps/b-dep/b-dep-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
+mkdir -p 'packages/post-deps/z-dep'
+cat <<END > packages/post-deps/z-dep/z-dep-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
cd ..