aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-14 19:38:05 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-14 19:38:05 +0100
commitbad0e1b891c786bf1373194fda7bdd67af7196f2 (patch)
treef88dae3262b8200eb195f8b31636d5a473618bbe
parente555408334b6179a8a7cb5efa06f5d548cc58a68 (diff)
downloadpaludis-bad0e1b891c786bf1373194fda7bdd67af7196f2.tar.gz
paludis-bad0e1b891c786bf1373194fda7bdd67af7196f2.tar.xz
Better blocker handling
-rw-r--r--paludis/resolver/lineariser.cc20
-rw-r--r--paludis/resolver/resolver_TEST_blockers.cc45
-rwxr-xr-xpaludis/resolver/resolver_TEST_blockers_setup.sh55
3 files changed, 112 insertions, 8 deletions
diff --git a/paludis/resolver/lineariser.cc b/paludis/resolver/lineariser.cc
index ccc2b27..f0b8916 100644
--- a/paludis/resolver/lineariser.cc
+++ b/paludis/resolver/lineariser.cc
@@ -248,12 +248,20 @@ namespace
(*l)->accept(classifier);
if (classifier.build || classifier.run)
- nag->add_edge(r.from_resolvent(), resolvent, make_named_values<NAGEdgeProperties>(
- n::build() = classifier.build,
- n::build_all_met() = r.already_met() || ! classifier.build,
- n::run() = classifier.run,
- n::run_all_met() = r.already_met() || ! classifier.run
- ));
+ {
+ bool arrow(true);
+ if (r.sanitised_dependency().spec().if_block())
+ if (! r.sanitised_dependency().spec().if_block()->strong())
+ arrow = false;
+
+ if (arrow)
+ nag->add_edge(r.from_resolvent(), resolvent, make_named_values<NAGEdgeProperties>(
+ n::build() = classifier.build,
+ n::build_all_met() = r.already_met() || ! classifier.build,
+ n::run() = classifier.run,
+ n::run_all_met() = r.already_met() || ! classifier.run
+ ));
+ }
else if (classifier.post)
{
/* we won't add a backwards edge, since most post deps dep upon
diff --git a/paludis/resolver/resolver_TEST_blockers.cc b/paludis/resolver/resolver_TEST_blockers.cc
index 38539b8..0cdd1f4 100644
--- a/paludis/resolver/resolver_TEST_blockers.cc
+++ b/paludis/resolver/resolver_TEST_blockers.cc
@@ -57,8 +57,8 @@ namespace
{
struct ResolverBlockersTestCase : ResolverTestCase
{
- ResolverBlockersTestCase(const std::string & s) :
- ResolverTestCase("blockers", s, "exheres-0", "exheres")
+ ResolverBlockersTestCase(const std::string & s, const std::string & e = "exheres-0") :
+ ResolverTestCase("blockers", s, e, "exheres")
{
}
};
@@ -232,5 +232,46 @@ namespace test_cases
test_blocked_and_dep_exists(true, false),
test_blocked_and_dep_allowed(false, true),
test_blocked_and_dep_exists_allowed(true, true);
+
+ struct BlockAndDepCycle : ResolverBlockersTestCase
+ {
+ BlockAndDepCycle() :
+ ResolverBlockersTestCase("block and dep cycle", "0")
+ {
+ install("block-and-dep-cycle", "target", "0");
+ }
+
+ void run()
+ {
+ std::tr1::shared_ptr<const Resolved> resolved(get_resolved("block-and-dep-cycle/target"));
+
+ check_resolved(resolved,
+ n::display_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("block-and-dep-cycle/dep"))
+ .change(QualifiedPackageName("block-and-dep-cycle/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_block_and_dep_cycle;
+
+ struct HardBlockAndDepCycle : ResolverBlockersTestCase
+ {
+ HardBlockAndDepCycle() :
+ ResolverBlockersTestCase("hard block and dep cycle", "0")
+ {
+ install("hard-block-and-dep-cycle", "target", "0");
+ }
+
+ void run()
+ {
+ TEST_CHECK_THROWS(get_resolved("hard-block-and-dep-cycle/target"), Exception);
+ }
+ } test_hard_block_and_dep_cycle;
}
diff --git a/paludis/resolver/resolver_TEST_blockers_setup.sh b/paludis/resolver/resolver_TEST_blockers_setup.sh
index 5b7a810..1381960 100755
--- a/paludis/resolver/resolver_TEST_blockers_setup.sh
+++ b/paludis/resolver/resolver_TEST_blockers_setup.sh
@@ -14,6 +14,11 @@ cd repo
echo "repo" > profiles/repo_name
: > metadata/categories.conf
+: > profiles/categories
+cat <<'END' > profiles/profile/make.defaults
+ARCH=test
+END
+
# hard
echo 'hard' >> metadata/categories.conf
@@ -101,5 +106,55 @@ PLATFORMS="test"
SLOT="0"
END
+# block-and-dep-cycle
+echo 'block-and-dep-cycle' >> metadata/categories.conf
+
+mkdir -p 'packages/block-and-dep-cycle/target'
+cat <<END > packages/block-and-dep-cycle/target/target-1.ebuild
+EAPI="2"
+DESCRIPTION="target"
+KEYWORDS="test"
+SLOT="0"
+DEPEND="
+ block-and-dep-cycle/dep
+ "
+END
+
+mkdir -p 'packages/block-and-dep-cycle/dep'
+cat <<END > packages/block-and-dep-cycle/dep/dep-1.ebuild
+EAPI="2"
+DESCRIPTION="dep"
+KEYWORDS="test"
+SLOT="0"
+DEPEND="
+ !=block-and-dep-cycle/target-0
+ "
+END
+
+# hard-block-and-dep-cycle
+echo 'hard-block-and-dep-cycle' >> metadata/categories.conf
+
+mkdir -p 'packages/hard-block-and-dep-cycle/target'
+cat <<END > packages/hard-block-and-dep-cycle/target/target-1.ebuild
+EAPI="2"
+DESCRIPTION="target"
+KEYWORDS="test"
+SLOT="0"
+DEPEND="
+ hard-block-and-dep-cycle/dep
+ "
+END
+
+mkdir -p 'packages/hard-block-and-dep-cycle/dep'
+cat <<END > packages/hard-block-and-dep-cycle/dep/dep-1.ebuild
+EAPI="2"
+DESCRIPTION="dep"
+KEYWORDS="test"
+SLOT="0"
+DEPEND="
+ !!=hard-block-and-dep-cycle/target-0
+ "
+END
+
cd ..