aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-09-05 12:48:24 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-09-05 13:06:40 +0100
commit95e7880705435bee4833c0bd1b8694f023038e48 (patch)
tree5d82feae790db88d5191a1562620d1a2e8fa0ab5
parent388ffabd070db3c41be152980fe2bec09cd39512 (diff)
downloadpaludis-95e7880705435bee4833c0bd1b8694f023038e48.tar.gz
paludis-95e7880705435bee4833c0bd1b8694f023038e48.tar.xz
Resolve blocker annotations cleverly
-rw-r--r--paludis/resolver/decider.cc25
-rw-r--r--paludis/resolver/resolver_TEST_blockers.cc127
-rwxr-xr-xpaludis/resolver/resolver_TEST_blockers_setup.sh84
3 files changed, 234 insertions, 2 deletions
diff --git a/paludis/resolver/decider.cc b/paludis/resolver/decider.cc
index cb4e15c..d68c3a9 100644
--- a/paludis/resolver/decider.cc
+++ b/paludis/resolver/decider.cc
@@ -662,13 +662,34 @@ Decider::_make_constraints_from_blocker(
{
const std::shared_ptr<ConstraintSequence> result(std::make_shared<ConstraintSequence>());
+ bool nothing_is_fine_too(true), force_unable(false);
+ switch (spec.block_kind())
+ {
+ case bk_weak:
+ case bk_strong:
+ case bk_uninstall_blocked_before:
+ case bk_uninstall_blocked_after:
+ break;
+
+ case bk_manual:
+ force_unable = true;
+ break;
+
+ case bk_upgrade_blocked_before:
+ nothing_is_fine_too = ! _already_met(spec);
+ break;
+
+ case last_bk:
+ break;
+ }
+
DestinationTypes destination_types(_get_destination_types_for_blocker(spec, reason));
for (EnumIterator<DestinationType> t, t_end(last_dt) ; t != t_end ; ++t)
if (destination_types[*t])
result->push_back(std::make_shared<Constraint>(make_named_values<Constraint>(
n::destination_type() = *t,
- n::force_unable() = false,
- n::nothing_is_fine_too() = true,
+ n::force_unable() = force_unable,
+ n::nothing_is_fine_too() = nothing_is_fine_too,
n::reason() = reason,
n::spec() = spec,
n::untaken() = false,
diff --git a/paludis/resolver/resolver_TEST_blockers.cc b/paludis/resolver/resolver_TEST_blockers.cc
index 3df4f44..3033b7a 100644
--- a/paludis/resolver/resolver_TEST_blockers.cc
+++ b/paludis/resolver/resolver_TEST_blockers.cc
@@ -415,5 +415,132 @@ namespace test_cases
test_self_block_x_1_w(-1, 1, false), test_self_block_x_1_s(-1, 1, true),
test_self_block_0_1_w( 0, 1, false), test_self_block_0_1_s( 0, 1, true),
test_self_block_1_1_w( 1, 1, false), test_self_block_1_1_s( 1, 1, true);
+
+ struct UninstallBlockedAfter : ResolverBlockersTestCase
+ {
+ UninstallBlockedAfter() :
+ ResolverBlockersTestCase("uninstall blocked after")
+ {
+ install("uninstall-blocked-after", "dep", "1");
+ allowed_to_remove_helper.add_allowed_to_remove_spec(parse_user_package_dep_spec("uninstall-blocked-after/dep", &env, { }));
+ }
+
+ void run()
+ {
+ std::shared_ptr<const Resolved> resolved(get_resolved("uninstall-blocked-after/target"));
+
+ check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("uninstall-blocked-after/target"))
+ .remove(QualifiedPackageName("uninstall-blocked-after/dep"))
+ .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()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+ }
+ } test_uninstall_blocked_after;
+
+ struct UninstallBlockedBefore : ResolverBlockersTestCase
+ {
+ UninstallBlockedBefore() :
+ ResolverBlockersTestCase("uninstall blocked before")
+ {
+ install("uninstall-blocked-before", "dep", "1");
+ allowed_to_remove_helper.add_allowed_to_remove_spec(parse_user_package_dep_spec("uninstall-blocked-before/dep", &env, { }));
+ }
+
+ void run()
+ {
+ std::shared_ptr<const Resolved> resolved(get_resolved("uninstall-blocked-before/target"));
+
+ check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .remove(QualifiedPackageName("uninstall-blocked-before/dep"))
+ .change(QualifiedPackageName("uninstall-blocked-before/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()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+ }
+ } test_uninstall_blocked_before;
+
+ struct UpgradeBlockedBefore : ResolverBlockersTestCase
+ {
+ UpgradeBlockedBefore() :
+ ResolverBlockersTestCase("upgrade blocked before")
+ {
+ install("upgrade-blocked-before", "dep", "1");
+ allowed_to_remove_helper.add_allowed_to_remove_spec(parse_user_package_dep_spec("upgrade-blocked-before/dep", &env, { }));
+ }
+
+ void run()
+ {
+ std::shared_ptr<const Resolved> resolved(get_resolved("upgrade-blocked-before/target"));
+
+ check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("upgrade-blocked-before/dep"))
+ .change(QualifiedPackageName("upgrade-blocked-before/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()
+ .finished()),
+ n::untaken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::untaken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .finished())
+ );
+ }
+ } test_upgrade_blocked_before;
+
+ struct Manual : ResolverBlockersTestCase
+ {
+ Manual() :
+ ResolverBlockersTestCase("manual")
+ {
+ install("manual", "dep", "1");
+ }
+
+ void run()
+ {
+ std::shared_ptr<const Resolved> resolved(get_resolved("manual/target"));
+
+ check_resolved(resolved,
+ n::taken_change_or_remove_decisions() = make_shared_copy(DecisionChecks()
+ .change(QualifiedPackageName("manual/target"))
+ .finished()),
+ n::taken_unable_to_make_decisions() = make_shared_copy(DecisionChecks()
+ .unable(QualifiedPackageName("manual/dep"))
+ .finished()),
+ n::taken_unconfirmed_decisions() = make_shared_copy(DecisionChecks()
+ .finished()),
+ n::taken_unorderable_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_manual;
}
diff --git a/paludis/resolver/resolver_TEST_blockers_setup.sh b/paludis/resolver/resolver_TEST_blockers_setup.sh
index 51813e4..1dd0f88 100755
--- a/paludis/resolver/resolver_TEST_blockers_setup.sh
+++ b/paludis/resolver/resolver_TEST_blockers_setup.sh
@@ -209,5 +209,89 @@ END
done
done
+# uninstall-blocked-after
+echo 'uninstall-blocked-after' >> metadata/categories.conf
+
+mkdir -p 'packages/uninstall-blocked-after/target'
+cat <<END > packages/uninstall-blocked-after/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="
+ ( !uninstall-blocked-after/dep[=1] [[ resolution = uninstall-blocked-after ]] )
+ "
+END
+
+mkdir -p 'packages/upgrade-blocked-after/dep'
+cat <<END > packages/uninstall-blocked-after/dep/dep-2.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
+# uninstall-blocked-before
+echo 'uninstall-blocked-before' >> metadata/categories.conf
+
+mkdir -p 'packages/uninstall-blocked-before/target'
+cat <<END > packages/uninstall-blocked-before/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="
+ ( !uninstall-blocked-before/dep[=1] [[ resolution = uninstall-blocked-before ]] )
+ "
+END
+
+mkdir -p 'packages/upgrade-blocked-before/dep'
+cat <<END > packages/uninstall-blocked-before/dep/dep-2.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
+# upgrade-blocked-before
+echo 'upgrade-blocked-before' >> metadata/categories.conf
+
+mkdir -p 'packages/upgrade-blocked-before/target'
+cat <<END > packages/upgrade-blocked-before/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="
+ ( !upgrade-blocked-before/dep[=1] [[ resolution = upgrade-blocked-before ]] )
+ "
+END
+
+mkdir -p 'packages/upgrade-blocked-before/dep'
+cat <<END > packages/upgrade-blocked-before/dep/dep-2.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
+# manual
+echo 'manual' >> metadata/categories.conf
+
+mkdir -p 'packages/manual/target'
+cat <<END > packages/manual/target/target-1.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES="
+ ( !manual/dep[=1] [[ resolution = manual ]] )
+ "
+END
+
+mkdir -p 'packages/manual/dep'
+cat <<END > packages/manual/dep/dep-2.exheres-0
+SUMMARY="target"
+PLATFORMS="test"
+SLOT="0"
+DEPENDENCIES=""
+END
+
cd ..