summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-06-19 13:14:33 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2020-07-02 18:57:11 +0200
commit3e39efa31da463ca05016513835d9a5388f80f90 (patch)
tree6d15cc8cf75f3bffe05e698f8b96625c0bc42787 /test
parent289ee74dd23cba7e08b08c6c3602bcf4bf8167bc (diff)
Delay removals due to Conflicts until Depends are resolved
Marking a package for removal is fine if we know that we have to remove that package, but if we are in an alternative branch we might not go this route in the end and hence have a package pointlessly marked for removal which isn't questioned later on. We check if we are allowed to remove that package to avoid working on the positive dependencies if not, but we mark them for removal only after all the other dependencies are successfully resolved. In an ideal world we would let the problemResolver do its job on them, but the resolver might decide against doing the removal exploring another option like the next alternative, which might be a good idea, but is not the behaviour we had before, so that is the best we can do for now without changing the resolver drastically.
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-bug-960705-propagate-protected-to-satisfied-conflict2
-rwxr-xr-xtest/integration/test-resolver-delays-remove-decisions74
2 files changed, 75 insertions, 1 deletions
diff --git a/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict b/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict
index e793193c3..ad1501b66 100755
--- a/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict
+++ b/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict
@@ -17,7 +17,7 @@ setupaptarchive
testsuccessequal "Reading package lists...
Building dependency tree...
- Removing: systemd-sysv as upgrade is not an option for runit-init:amd64 (1)
+ Removing: systemd-sysv:amd64 as upgrade is not an option for runit-init:amd64 (1)
MarkDelete systemd-sysv:amd64 < 1 @ii mK > FU=0
MarkInstall runit-init:amd64 < none -> 1 @un puN > FU=1
Starting pkgProblemResolver with broken count: 1
diff --git a/test/integration/test-resolver-delays-remove-decisions b/test/integration/test-resolver-delays-remove-decisions
new file mode 100755
index 000000000..3321ed3a7
--- /dev/null
+++ b/test/integration/test-resolver-delays-remove-decisions
@@ -0,0 +1,74 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertinstalledpackage 'stuff' 'all' '1'
+
+insertpackage 'unstable' 'foobar' 'all' '1' 'Depends: foo | bar'
+insertpackage 'unstable' 'foo' 'all' '1' 'Conflicts: stuff
+Depends: foo-dep'
+insertpackage 'unstable' 'foo-dep' 'all' '1' 'Depends: uninstallable'
+
+insertpackage 'unstable' 'bar' 'all' '1'
+
+setupaptarchive
+
+# We are needlessly removing "stuff" if we don't delay its marking here
+# as we do not question the remove later on
+testsuccessequal "Reading package lists...
+Building dependency tree...
+ MarkInstall foobar:amd64 < none -> 1 @un puN Ib > FU=1
+ Installing foo:amd64 as Depends of foobar:amd64
+ Delayed Removing: stuff:amd64 as upgrade is not an option for foo:amd64 (1)
+ MarkInstall foo:amd64 < none -> 1 @un uN Ib > FU=0
+ Installing foo-dep:amd64 as Depends of foo:amd64
+ foo-dep:amd64 Depends on uninstallable:amd64 < none @un H > can't be satisfied!
+ foo:amd64 Depends on foo-dep:amd64 < none @un H > can't be satisfied! (dep)
+ Installing bar:amd64 as Depends of foobar:amd64
+ MarkInstall bar:amd64 < none -> 1 @un uN > FU=0
+Starting pkgProblemResolver with broken count: 0
+Starting 2 pkgProblemResolver with broken count: 0
+Done
+The following additional packages will be installed:
+ bar
+The following NEW packages will be installed:
+ bar foobar
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1 unstable [all])
+Inst foobar (1 unstable [all])
+Conf bar (1 unstable [all])
+Conf foobar (1 unstable [all])" apt install foobar -s -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1
+
+insertinstalledpackage 'uninstallable' 'all' '1'
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+ MarkInstall foobar:amd64 < none -> 1 @un puN Ib > FU=1
+ Installing foo:amd64 as Depends of foobar:amd64
+ Delayed Removing: stuff:amd64 as upgrade is not an option for foo:amd64 (1)
+ MarkInstall foo:amd64 < none -> 1 @un uN Ib > FU=0
+ Installing foo-dep:amd64 as Depends of foo:amd64
+ MarkInstall foo-dep:amd64 < none -> 1 @un uN > FU=0
+ MarkDelete stuff:amd64 < 1 @ii mK > FU=0
+Starting pkgProblemResolver with broken count: 0
+Starting 2 pkgProblemResolver with broken count: 0
+Done
+The following additional packages will be installed:
+ foo foo-dep
+The following packages will be REMOVED:
+ stuff
+The following NEW packages will be installed:
+ foo foo-dep foobar
+ MarkDelete stuff:amd64 < 1 @ii K > FU=1
+0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.
+Remv stuff [1]
+Inst foo-dep (1 unstable [all])
+Inst foo (1 unstable [all])
+Inst foobar (1 unstable [all])
+Conf foo-dep (1 unstable [all])
+Conf foo (1 unstable [all])
+Conf foobar (1 unstable [all])" apt install foobar -s -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1