[pacman-dev] [PATCH] Do not remove conflict by default

Nagy Gabor ngaba at bibl.u-szeged.hu
Mon Aug 31 22:17:59 UTC 2009


>From 66cb7b5d48ae173944531318022d351f4e503172 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Date: Mon, 31 Aug 2009 23:54:51 +0200
Subject: [PATCH] Do not remove conflict by default

When a conflict is detected, pacman asks if the user wants to remove
the conflicting package.  In many cases this is a bad idea.  e.g.

udev conflicts with initscripts (initscripts<2009.07).
Remove initscripts [Y/n]

This changes the query to [y/N].

The --noconfirm behavior has been also changed, because it chooses the
default answer. Since the yes answer is more interesting in our pactests
dealing with conflicts, I inserted '--ask=4' to all of them with one
exception: sync042.py tests the no answer.

Original-work-by: Allan McRae <allan at archlinux.org>
Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
---
 pactest/tests/sync042.py  |    6 +++---
 pactest/tests/sync043.py  |    2 +-
 pactest/tests/sync044.py  |    2 +-
 pactest/tests/sync1004.py |    2 +-
 pactest/tests/sync890.py  |    2 +-
 pactest/tests/sync892.py  |    2 +-
 pactest/tests/sync893.py  |    2 +-
 pactest/tests/sync895.py  |    2 +-
 pactest/tests/sync896.py  |    2 +-
 pactest/tests/sync897.py  |    2 +-
 pactest/tests/sync899.py  |    2 +-
 pactest/tests/sync900.py  |    2 +-
 pactest/tests/sync901.py  |    2 +-
 pactest/tests/sync992.py  |    2 +-
 pactest/tests/sync999.py  |    2 +-
 src/pacman/callback.c     |    4 ++--
 16 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/pactest/tests/sync042.py b/pactest/tests/sync042.py
index 0aa7e37..7c3498d 100644
--- a/pactest/tests/sync042.py
+++ b/pactest/tests/sync042.py
@@ -9,6 +9,6 @@ self.addpkg2db("local", lp);
 
 self.args = "-S %s" % sp.name
 
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=pkg1")
-self.addrule("!PKG_EXIST=pkg2")
+self.addrule("PACMAN_RETCODE=1")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/pactest/tests/sync043.py b/pactest/tests/sync043.py
index 1302bf0..eb2f570 100644
--- a/pactest/tests/sync043.py
+++ b/pactest/tests/sync043.py
@@ -10,7 +10,7 @@ self.addpkg2db("local", lp1);
 lp1 = pmpkg("pkg3")
 self.addpkg2db("local", lp1);
 
-self.args = "-S %s" % sp.name
+self.args = "-S %s --ask=4" % sp.name
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync044.py b/pactest/tests/sync044.py
index c4ff154..0c8fd2e 100644
--- a/pactest/tests/sync044.py
+++ b/pactest/tests/sync044.py
@@ -11,7 +11,7 @@ sp3 = pmpkg("pkg3")
 sp3.conflicts = ["pkg1"]
 self.addpkg2db("sync", sp3);
 
-self.args = "-S pkg2"
+self.args = "-S pkg2 --ask=4"
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("!PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync1004.py b/pactest/tests/sync1004.py
index f87bbe9..a9cee49 100644
--- a/pactest/tests/sync1004.py
+++ b/pactest/tests/sync1004.py
@@ -11,7 +11,7 @@ self.addpkg2db("sync", sp2)
 lp = pmpkg("depend")
 self.addpkg2db("local", lp)
 
-self.args = "-S pkg1 pkg2"
+self.args = "-S pkg1 pkg2 --ask=4"
 
 self.addrule("PACMAN_RETCODE=1")
 self.addrule("PKG_EXIST=depend")
diff --git a/pactest/tests/sync890.py b/pactest/tests/sync890.py
index 75947e9..e8380b7 100644
--- a/pactest/tests/sync890.py
+++ b/pactest/tests/sync890.py
@@ -12,7 +12,7 @@ lp2.conflicts = ["pkg3"]
 for p in lp1, lp2:
 	self.addpkg2db("local", p)
 
-self.args = "-S %s" % sp.name
+self.args = "-S %s --ask=4" % sp.name
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync892.py b/pactest/tests/sync892.py
index 04cc79c..dfd889e 100644
--- a/pactest/tests/sync892.py
+++ b/pactest/tests/sync892.py
@@ -16,7 +16,7 @@ lp2.conflicts = ["pkg3"]
 for p in lp1, lp2:
 	self.addpkg2db("local", p)
 
-self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+self.args = "-S %s --ask=4" % " ".join([p.name for p in sp1, sp2])
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("!PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync893.py b/pactest/tests/sync893.py
index 1c8494a..e96bb7b 100644
--- a/pactest/tests/sync893.py
+++ b/pactest/tests/sync893.py
@@ -13,7 +13,7 @@ self.addpkg2db("local", lp1)
 lp2 = pmpkg("pkg2")
 self.addpkg2db("local", lp2)
 
-self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+self.args = "-S %s --ask=4" % " ".join([p.name for p in sp1, sp2])
 
 self.addrule("PACMAN_RETCODE=1")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync895.py b/pactest/tests/sync895.py
index 1b348c1..fd98786 100644
--- a/pactest/tests/sync895.py
+++ b/pactest/tests/sync895.py
@@ -12,7 +12,7 @@ lp2 = pmpkg("pkg2")
 lp2.depends = ["foo"]
 self.addpkg2db("local", lp2)
 
-self.args = "-S %s" % sp.name
+self.args = "-S %s --ask=4" % sp.name
 
 self.addrule("PACMAN_RETCODE=1")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync896.py b/pactest/tests/sync896.py
index a89b5c7..492bd7b 100644
--- a/pactest/tests/sync896.py
+++ b/pactest/tests/sync896.py
@@ -13,7 +13,7 @@ lp2 = pmpkg("pkg2")
 lp2.depends = ["foo"]
 self.addpkg2db("local", lp2)
 
-self.args = "-S %s" % sp.name
+self.args = "-S %s --ask=4" % sp.name
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("!PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync897.py b/pactest/tests/sync897.py
index f7bd3d7..8a1c5a7 100644
--- a/pactest/tests/sync897.py
+++ b/pactest/tests/sync897.py
@@ -16,7 +16,7 @@ self.addpkg2db("local", lp2)
 lp3 = pmpkg("pkg3")
 self.addpkg2db("local", lp3)
 
-self.args = "-Su"
+self.args = "-Su --ask=4"
 
 self.addrule("PACMAN_RETCODE=1")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync899.py b/pactest/tests/sync899.py
index a561ae6..fd30805 100644
--- a/pactest/tests/sync899.py
+++ b/pactest/tests/sync899.py
@@ -11,7 +11,7 @@ self.addpkg2db("local", lp1)
 lp2 = pmpkg("pkg2")
 self.addpkg2db("local", lp2)
 
-self.args = "-Su"
+self.args = "-Su --ask=4"
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync900.py b/pactest/tests/sync900.py
index 16dfee1..744fad0 100644
--- a/pactest/tests/sync900.py
+++ b/pactest/tests/sync900.py
@@ -16,7 +16,7 @@ lp2 = pmpkg("pkg2")
 lp2.depends = ["foo"]
 self.addpkg2db("local", lp2)
 
-self.args = "-S %s" % sp.name
+self.args = "-S %s --ask=4" % sp.name
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("!PKG_EXIST=foo")
diff --git a/pactest/tests/sync901.py b/pactest/tests/sync901.py
index bb420b7..f583453 100644
--- a/pactest/tests/sync901.py
+++ b/pactest/tests/sync901.py
@@ -16,7 +16,7 @@ lp2 = pmpkg("pkg2")
 lp2.depends = ["foo"]
 self.addpkg2db("local", lp2)
 
-self.args = "-S %s" % sp.name
+self.args = "-S %s --ask=4" % sp.name
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=foo")
diff --git a/pactest/tests/sync992.py b/pactest/tests/sync992.py
index a7ad111..63faaab 100644
--- a/pactest/tests/sync992.py
+++ b/pactest/tests/sync992.py
@@ -15,7 +15,7 @@ for p in sp1, sp2, sp3:
 lp1 = pmpkg("pkg2", "0.1-1")
 self.addpkg2db("local", lp1)
 
-self.args = "-S %s" % " ".join([p.name for p in sp1, sp2])
+self.args = "-S %s --ask=4" % " ".join([p.name for p in sp1, sp2])
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/pactest/tests/sync999.py b/pactest/tests/sync999.py
index 69089fa..89447ca 100644
--- a/pactest/tests/sync999.py
+++ b/pactest/tests/sync999.py
@@ -14,7 +14,7 @@ self.addpkg2db("local", lp1)
 lp2 = pmpkg("pkg2")
 self.addpkg2db("local", lp2)
 
-self.args = "-Su"
+self.args = "-Su --ask=4"
 
 self.addrule("PACMAN_RETCODE=0")
 self.addrule("PKG_EXIST=pkg1")
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 4ec9b60..97dffc9 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -271,12 +271,12 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2, void *data3,
 			/* data parameters: package1, package2, conflict (string) */
 			/* print conflict only if it contains more information than package2 */
 			if(!strcmp(data2, data3)) {
-				*response = yesno(_(":: %s conflicts with %s. Remove %s?"),
+				*response = noyes(_(":: %s conflicts with %s. Remove %s?"),
 						(char *)data1,
 						(char *)data2,
 						(char *)data2);
 			} else {
-				*response = yesno(_(":: %s conflicts with %s (%s). Remove %s?"),
+				*response = noyes(_(":: %s conflicts with %s (%s). Remove %s?"),
 						(char *)data1,
 						(char *)data2,
 						(char *)data3,
-- 
1.6.0.3





More information about the pacman-dev mailing list