summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2016-05-23 08:27:29 -0400
committerAndrew Gregory <andrew.gregory.8@gmail.com>2017-05-08 23:27:40 -0400
commitf31792adb5fc9ba9a4c6f14a6520282702f17b71 (patch)
treeb0dc04d61414606dc31a16bb006f4be81e65a28a /test
parentf84d0a8282543d2fd6fe0e8c3986ec17292bdf2a (diff)
downloadpacman-f31792adb5fc9ba9a4c6f14a6520282702f17b71.tar.xz
recursedeps: include cyclic dependencies
Cyclic dependencies (A depends on B, B depends on A) were not selected because neither package could be removed individually, so can_remove_package would always return false for both. By preselecting all dependencies then filtering back out any dependencies still required by any packages that will not be uninstalled, groups of unneeded cyclic dependencies can be found. Fixes FS#41031 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> (cherry picked from commit 6ac2ee21b30f3c5f331d19349f96bb8e5b020b47)
Diffstat (limited to 'test')
-rw-r--r--test/pacman/tests/TESTS1
-rw-r--r--test/pacman/tests/remove-recursive-cycle.py41
2 files changed, 42 insertions, 0 deletions
diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
index 9c330203..45ebabb2 100644
--- a/test/pacman/tests/TESTS
+++ b/test/pacman/tests/TESTS
@@ -109,6 +109,7 @@ TESTS += test/pacman/tests/querycheck002.py
TESTS += test/pacman/tests/querycheck_fast_file_type.py
TESTS += test/pacman/tests/reason001.py
TESTS += test/pacman/tests/remove-assumeinstalled.py
+TESTS += test/pacman/tests/remove-recursive-cycle.py
TESTS += test/pacman/tests/remove001.py
TESTS += test/pacman/tests/remove002.py
TESTS += test/pacman/tests/remove010.py
diff --git a/test/pacman/tests/remove-recursive-cycle.py b/test/pacman/tests/remove-recursive-cycle.py
new file mode 100644
index 00000000..b9864c87
--- /dev/null
+++ b/test/pacman/tests/remove-recursive-cycle.py
@@ -0,0 +1,41 @@
+self.description = "Recursively remove a package with cyclical dependencies"
+
+lpkg1 = pmpkg('pkg1')
+self.addpkg2db('local', lpkg1)
+lpkg1.depends = [ 'dep1' ]
+
+lpkg2 = pmpkg('pkg2')
+self.addpkg2db('local', lpkg2)
+lpkg2.depends = [ 'dep3' ]
+
+# cyclic dependency 1
+ldep1 = pmpkg('dep1')
+self.addpkg2db('local', ldep1)
+ldep1.depends = [ 'dep2', 'dep3', 'dep4' ]
+ldep1.reason = 1
+
+# cyclic dependency 2
+ldep2 = pmpkg('dep2')
+self.addpkg2db('local', ldep2)
+ldep2.depends = [ 'dep1' ]
+ldep2.reason = 1
+
+# dependency required by another package
+ldep3 = pmpkg('dep3')
+self.addpkg2db('local', ldep3)
+ldep3.reason = 1
+
+# explicitly installed dependency
+ldep4 = pmpkg('dep4')
+self.addpkg2db('local', ldep4)
+ldep4.reason = 0
+
+self.args = "-Rs pkg1"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg2")
+self.addrule("PKG_EXIST=dep3")
+self.addrule("PKG_EXIST=dep4")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=dep1")
+self.addrule("!PKG_EXIST=dep2")