[pacman-dev] [PATCH] Print replacements when using -Sup

Allan McRae allan at archlinux.org
Tue Mar 29 06:41:42 UTC 2016


When printing a list of URLs of packages to be updated, pacman was ignoring any
replacements that would be made in the update process.

Fixes FS#35812

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 src/pacman/callback.c                                      | 12 ++++++++----
 test/pacman/tests/TESTS                                    |  1 +
 .../tests/sync-sysupgrade-print-replaced-packages.py       | 14 ++++++++++++++
 3 files changed, 23 insertions(+), 4 deletions(-)
 create mode 100644 test/pacman/tests/sync-sysupgrade-print-replaced-packages.py

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 1e1a4cd..ab3e14f 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -375,10 +375,14 @@ void cb_event(alpm_event_t *event)
 void cb_question(alpm_question_t *question)
 {
 	if(config->print) {
-		if(question->type == ALPM_QUESTION_INSTALL_IGNOREPKG) {
-			question->any.answer = 1;
-		} else {
-			question->any.answer = 0;
+		switch(question->type) {
+			case ALPM_QUESTION_INSTALL_IGNOREPKG:
+			case ALPM_QUESTION_REPLACE_PKG:
+				question->any.answer = 1;
+				break;
+			default:
+				question->any.answer = 0;
+				break;
 		}
 		return;
 	}
diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
index 9c33020..62d1f2a 100644
--- a/test/pacman/tests/TESTS
+++ b/test/pacman/tests/TESTS
@@ -161,6 +161,7 @@ TESTS += test/pacman/tests/sync-nodepversion03.py
 TESTS += test/pacman/tests/sync-nodepversion04.py
 TESTS += test/pacman/tests/sync-nodepversion05.py
 TESTS += test/pacman/tests/sync-nodepversion06.py
+TESTS += test/pacman/tests/sync-sysupgrade-print-replaced-packages.py
 TESTS += test/pacman/tests/sync-update-assumeinstalled.py
 TESTS += test/pacman/tests/sync-update-package-removing-required-provides.py
 TESTS += test/pacman/tests/sync001.py
diff --git a/test/pacman/tests/sync-sysupgrade-print-replaced-packages.py b/test/pacman/tests/sync-sysupgrade-print-replaced-packages.py
new file mode 100644
index 0000000..1325c6c
--- /dev/null
+++ b/test/pacman/tests/sync-sysupgrade-print-replaced-packages.py
@@ -0,0 +1,14 @@
+self.description = "Print replacements when using -Sup"
+
+
+lp = pmpkg("a", "1-1")
+self.addpkg2db("local", lp)
+
+sp = pmpkg("b", "2-2")
+sp.replaces = ["a"]
+self.addpkg2db("sync", sp)
+
+self.args = "-Sup"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PACMAN_OUTPUT=%s-%s" % (sp.name, sp.version))
-- 
2.7.4


More information about the pacman-dev mailing list