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

2009-08-30 Thread Allan McRae
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. Remove initscripts [Y/n]
util-linux-ng conflicts with e2fsprogs. Remove e2fsprogs? [Y/n]

This changes the query to [y/N].

Signed-off-by: Allan McRae 
---
 src/pacman/callback.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index e83a97d..0f52343 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -259,7 +259,7 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void 
*data2,
alpm_pkg_get_name(data2));
break;
case PM_TRANS_CONV_CONFLICT_PKG:
-   *response = yesno(_(":: %s conflicts with %s. Remove 
%s?"),
+   *response = noyes(_(":: %s conflicts with %s. Remove 
%s?"),
(char *)data1,
(char *)data2,
(char *)data2);
-- 
1.6.4.1




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

2009-08-31 Thread Nagy Gabor
>From 66cb7b5d48ae173944531318022d351f4e503172 Mon Sep 17 00:00:00 2001
From: Nagy Gabor 
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 
Signed-off-by: Nagy Gabor 
---
 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 --as

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

2009-08-30 Thread Nagy Gabor
> 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. Remove initscripts [Y/n]
> util-linux-ng conflicts with e2fsprogs. Remove e2fsprogs? [Y/n]
> 
> This changes the query to [y/N].
> 
> Signed-off-by: Allan McRae 

You need to modify "some" pactest files as well, because this patch
induces 7 unexpected fails.

Imho your noyes default behavior is better... Moreover, maybe we should
also print somehow the conflict itself in warning, because 'udev
conflicts with initscripts<2009.07' (btw, why is there 2 conflicts line
udev's PPKGBUILD?) is much different from "foo conflicts with bar"...
However, in most cases that would be redundant information, so I am
unsure. (In fact we print redundant information in case of unresolvable
dependencies, too)
 
Bye





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

2009-08-30 Thread Allan McRae

Nagy Gabor wrote:

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. Remove initscripts [Y/n]
util-linux-ng conflicts with e2fsprogs. Remove e2fsprogs? [Y/n]

This changes the query to [y/N].

Signed-off-by: Allan McRae 



You need to modify "some" pactest files as well, because this patch
induces 7 unexpected fails.
  


Hmmm... you would have thought a two character change would cause so 
much damage?  Obviously not me! :P   I will fix.



Imho your noyes default behavior is better... Moreover, maybe we should
also print somehow the conflict itself in warning, because 'udev
conflicts with initscripts<2009.07' (btw, why is there 2 conflicts line
udev's PPKGBUILD?) is much different from "foo conflicts with bar"...
However, in most cases that would be redundant information, so I am
unsure. (In fact we print redundant information in case of unresolvable
dependencies, too)


I can see adding this information would be a good idea.  I will see if I 
can do that too  (it has been a long time since I touched actual pacman 
code).


Allan







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

2009-08-31 Thread Xavier
On Mon, Aug 31, 2009 at 4:50 AM, Allan McRae wrote:
>
>> Imho your noyes default behavior is better... Moreover, maybe we should
>> also print somehow the conflict itself in warning, because 'udev
>> conflicts with initscripts<2009.07' (btw, why is there 2 conflicts line
>> udev's PPKGBUILD?) is much different from "foo conflicts with bar"...
>> However, in most cases that would be redundant information, so I am
>> unsure. (In fact we print redundant information in case of unresolvable
>> dependencies, too)
>
> I can see adding this information would be a good idea.  I will see if I can
> do that too  (it has been a long time since I touched actual pacman code).
>

Nagy and I already discussed this a bit yesterday, and he said he
would write a patch :)
But having new eyes on the code can not be a bad thing!