aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-24 17:38:39 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-24 17:47:10 +0000
commit3a26e729b21cfc1191fcb9aebded849ee995f7cd (patch)
tree2d1c1ce27401b2faf560ee9d02f339c8b9b0e21c
parent5ea403eb690cee951f52bef876c7a9c7f67acfec (diff)
downloadpaludis-3a26e729b21cfc1191fcb9aebded849ee995f7cd.tar.gz
paludis-3a26e729b21cfc1191fcb9aebded849ee995f7cd.tar.xz
Remove not necessarily allowed
-rw-r--r--paludis/resolver/decider.cc2
-rw-r--r--paludis/resolver/resolver_TEST_blockers.cc44
-rwxr-xr-xpaludis/resolver/resolver_TEST_blockers_setup.sh20
3 files changed, 65 insertions, 1 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index e29ffc5..72350c6 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -1182,7 +1182,7 @@ Decider::_try_to_find_decision_for(
/* we can't stick with our existing id, if there is one, and we can't
* fix it by installing things. this might be an error, or we might be
* able to remove things. */
- if (_installed_but_allowed_to_remove(resolvent))
+ if (resolution->constraints()->nothing_is_fine_too() && _installed_but_allowed_to_remove(resolvent))
return make_shared_ptr(new RemoveDecision(
_installed_ids(resolvent),
! resolution->constraints()->all_untaken()
diff --git a/paludis/resolver/resolver_TEST_blockers.cc b/paludis/resolver/resolver_TEST_blockers.cc
index b79c1ca..22fdd68 100644
--- a/paludis/resolver/resolver_TEST_blockers.cc
+++ b/paludis/resolver/resolver_TEST_blockers.cc
@@ -239,5 +239,49 @@ namespace test_cases
}
}
} test_target(false), test_target_exists(true);
+
+ struct BlockedAndDep : ResolverBlockersTestCase
+ {
+ const bool exists;
+ const bool allowed;
+
+ BlockedAndDep(const bool x, const bool a) :
+ ResolverBlockersTestCase("blocked and dep"
+ + std::string(x ? " exists" : "")
+ + std::string(a ? " allowed" : "")),
+ exists(x),
+ allowed(a)
+ {
+ if (allowed)
+ allowed_to_remove_names->insert(QualifiedPackageName("blocked-and-dep/both"));
+
+ if (exists)
+ install("blocked-and-dep", "both", "1");
+ }
+
+ void run()
+ {
+ std::tr1::shared_ptr<const ResolverLists> resolutions(get_resolutions("blocked-and-dep/target"));
+
+ {
+ TestMessageSuffix s("taken errors");
+ check_resolution_list(resolutions->jobs(), resolutions->taken_error_job_ids(), ResolutionListChecks()
+ .kind("unable_to_make_decision", QualifiedPackageName("blocked-and-dep/both"))
+ .finished()
+ );
+ }
+
+ {
+ TestMessageSuffix s("ordered");
+ check_resolution_list(resolutions->jobs(), resolutions->taken_job_ids(), ResolutionListChecks()
+ .kind("changes_to_make", QualifiedPackageName("blocked-and-dep/target"))
+ .finished()
+ );
+ }
+ }
+ } test_blocked_and_dep(false, false),
+ test_blocked_and_dep_exists(true, false),
+ test_blocked_and_dep_allowed(false, true),
+ test_blocked_and_dep_exists_allowed(true, true);
}
diff --git a/paludis/resolver/resolver_TEST_blockers_setup.sh b/paludis/resolver/resolver_TEST_blockers_setup.sh
index 2b270da..5b7a810 100755
--- a/paludis/resolver/resolver_TEST_blockers_setup.sh
+++ b/paludis/resolver/resolver_TEST_blockers_setup.sh
@@ -81,5 +81,25 @@ PLATFORMS="test"
SLOT="0"
END
+# blocked-and-dep
+echo 'blocked-and-dep' >> metadata/categories.conf
+
+mkdir -p 'packages/blocked-and-dep/target'
+cat <<END > packages/blocked-and-dep/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="
+ ( !blocked-and-dep/both blocked-and-dep/both )
+ "
+END
+
+mkdir -p 'packages/blocked-and-dep/both'
+cat <<END > packages/blocked-and-dep/both/both-1.exheres-0
+SUMMARY="dep"
+PLATFORMS="test"
+SLOT="0"
+END
+
cd ..