From ec831e05f58e3db1c06aadb23a87b5b82ab3ebf3 Mon Sep 17 00:00:00 2001
From: Andrew Gregory <andrew.gregory.8@gmail.com>
Date: Sat, 18 May 2013 15:53:32 -0400
Subject: deps.c: check for indirect deps when ordering

On upgrades, indirect dependencies were not being detected if there was
a dependency in between them that was not part of the transaction.  For
example, with the dependency chain: pkg1 -> pkg2 -> pkg3, if pkg1 and
pkg3 are being upgraded but not pkg2 pacman would not order pkg1 and
pkg3 properly.

This was particularly problematic when replacements were involved
because the replaced package(s) would be removed at the start of the
transaction.  If an install script required the replacer and lacked
a direct dependency, it could fail.

Fixes FS#32764.

Partially fixes FS#23011.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
---
 test/pacman/tests/replace100.py |  2 --
 test/pacman/tests/upgrade100.py | 44 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 test/pacman/tests/upgrade100.py

(limited to 'test')

diff --git a/test/pacman/tests/replace100.py b/test/pacman/tests/replace100.py
index f94ca0f7..dcb71119 100644
--- a/test/pacman/tests/replace100.py
+++ b/test/pacman/tests/replace100.py
@@ -41,5 +41,3 @@ self.addrule("PKG_VERSION=util-linux|2.19-1")
 self.addrule("PKG_VERSION=kernel26|2.6.37.1-1")
 self.addrule("FILE_EXIST=sbin/blkid")
 self.addrule("FILE_EXIST=foundit")
-
-self.expectfailure = True
diff --git a/test/pacman/tests/upgrade100.py b/test/pacman/tests/upgrade100.py
new file mode 100644
index 00000000..3f7a0212
--- /dev/null
+++ b/test/pacman/tests/upgrade100.py
@@ -0,0 +1,44 @@
+self.description = "Indirect dependency ordering (FS#32764)"
+
+lp1 = pmpkg("fcitx-gtk2", "1.0-1");
+lp1.depends = ["gtk2"]
+self.addpkg2db("local", lp1)
+
+lp2 = pmpkg("gtk2", "1.0-1");
+lp2.depends = ["pango"]
+self.addpkg2db("local", lp2)
+
+lp3 = pmpkg("pango", "1.0-1");
+lp3.depends = ["harfbuzz"]
+self.addpkg2db("local", lp3)
+
+lp4 = pmpkg("harfbuzz", "1.0-1");
+lp4.depends = ["icu"]
+self.addpkg2db("local", lp4)
+
+lp5 = pmpkg("icu", "1.0-1");
+self.addpkg2db("local", lp5)
+
+sp1 = pmpkg("fcitx-gtk2", "1.0-2");
+sp1.depends = ["gtk2"]
+sp1.install['post_upgrade'] = "[ -f bin/harfbuzz ] && echo > found_harfbuzz"
+self.addpkg2db("sync", sp1)
+
+sp4 = pmpkg("harfbuzz", "1.0-2");
+sp4.depends = ["icu"]
+sp4.files = ["bin/harfbuzz"]
+sp4.install['post_upgrade'] = "[ -f bin/icu ] && echo > found_icu"
+self.addpkg2db("sync", sp4)
+
+sp5 = pmpkg("icu", "1.0-2");
+sp5.files = ["bin/icu"]
+self.addpkg2db("sync", sp5)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_VERSION=fcitx-gtk2|1.0-2")
+self.addrule("PKG_VERSION=harfbuzz|1.0-2")
+self.addrule("PKG_VERSION=icu|1.0-2")
+self.addrule("FILE_EXIST=found_harfbuzz")
+self.addrule("FILE_EXIST=found_icu")
-- 
cgit v1.2.3-70-g09d2