All tests pass.
Signed-off-by: Bryan Ischo <[email protected]>
---
lib/libalpm/alpm.h | 2 +-
lib/libalpm/deps.c | 4 +---
pactest/tests/provision020.py | 2 +-
pactest/tests/provision022.py | 2 +-
pactest/tests/sync1008.py | 2 +-
pactest/tests/sync300.py | 2 +-
src/pacman/callback.c | 25 +++++++++++++++++++++++++
7 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index eda35d3..6105737 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -377,7 +377,7 @@ typedef enum _pmtransconv_t {
PM_TRANS_CONV_CONFLICT_PKG = 0x04,
PM_TRANS_CONV_CORRUPTED_PKG = 0x08,
PM_TRANS_CONV_LOCAL_NEWER = 0x10,
- /* 0x20 flag can go here */
+ PM_TRANS_CONV_REMOVE_PKGS = 0x20,
PM_TRANS_CONV_REMOVE_HOLDPKG = 0x40
} pmtransconv_t;
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index cc20e40..cd0c359 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -745,9 +745,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, alpm_list_t **list,
should be removed from the transaction */
if(unresolvable != NULL) {
int remove_unresolved = 0;
- /* Assume for the time being that the user does not want to remove
- the unresolved packages. A prompt to allow the user to specify
- that they should be removed will be added in a future change. */
+ QUESTION(handle->trans, PM_TRANS_CONV_REMOVE_PKGS, unresolvable, NULL, NULL, &remove_unresolved);
if (remove_unresolved) {
/* Need to remove all packages which are:
- unresolvable, OR
diff --git a/pactest/tests/provision020.py b/pactest/tests/provision020.py
index 7cb0a01..c9c0ac3 100644
--- a/pactest/tests/provision020.py
+++ b/pactest/tests/provision020.py
@@ -10,6 +10,6 @@
self.args = "-S %s" % p.name
-self.addrule("PACMAN_RETCODE=1")
+self.addrule("PACMAN_RETCODE=0")
self.addrule("!PKG_EXIST=pkg1")
self.addrule("PKG_EXIST=pkg2")
diff --git a/pactest/tests/provision022.py b/pactest/tests/provision022.py
index 4883d42..190a8b6 100644
--- a/pactest/tests/provision022.py
+++ b/pactest/tests/provision022.py
@@ -10,6 +10,6 @@
self.args = "-S %s" % p.name
-self.addrule("PACMAN_RETCODE=1")
+self.addrule("PACMAN_RETCODE=0")
self.addrule("!PKG_EXIST=pkg1")
self.addrule("PKG_EXIST=pkg2")
diff --git a/pactest/tests/sync1008.py b/pactest/tests/sync1008.py
index a606459..90c61df 100644
--- a/pactest/tests/sync1008.py
+++ b/pactest/tests/sync1008.py
@@ -14,6 +14,6 @@
self.args = "-S pkg"
-self.addrule("PACMAN_RETCODE=1")
+self.addrule("PACMAN_RETCODE=0")
self.addrule("!PKG_EXIST=pkg")
self.addrule("!PKG_EXIST=cpkg")
diff --git a/pactest/tests/sync300.py b/pactest/tests/sync300.py
index 31b520a..36d6758 100644
--- a/pactest/tests/sync300.py
+++ b/pactest/tests/sync300.py
@@ -9,6 +9,6 @@
self.args = "-S %s" % sp1.name
-self.addrule("PACMAN_RETCODE=1")
+self.addrule("PACMAN_RETCODE=0")
self.addrule("!PKG_EXIST=pkg1")
self.addrule("!PKG_EXIST=pkg2")
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 9f1cca8..94c7818 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -274,6 +274,31 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
(char *)data2,
(char *)data2);
break;
+ case PM_TRANS_CONV_REMOVE_PKGS:
+ {
+ /* Allocate a buffer big enough to hold all of the
+ package names */
+ char *packagenames;
+ alpm_list_t *unresolved = (alpm_list_t *) data1;
+ alpm_list_t *i;
+ int len = 1, /* for trailing \0 */ where = 0, count = 0;
+ for (i = unresolved; i; i = i->next) {
+ count += 1;
+ len += 3 /* for \t, comma, and \n */ +
+ strlen(alpm_pkg_get_name(i->data));
+ }
+ packagenames = (char *) malloc(len);
+ for (i = unresolved; i; i = i->next) {
+ where += snprintf(&(packagenames[where]), len - where, "\t%s%s\n",
+ alpm_pkg_get_name(i->data), (i->next) ? "," : "");
+ }
+ *response = yesno(_(":: the following package%s cannot be upgraded due to unresolvable "
+ "dependencies:\n%s\nDo you want to skip %s package%s for this upgrade?"),
+ (count > 1) ? "s" : "", packagenames, (count > 1) ? "these" : "this",
+ (count > 1) ? "s" : "");
+ free(packagenames);
+ }
+ break;
case PM_TRANS_CONV_LOCAL_NEWER:
if(!config->op_s_downloadonly) {
*response = yesno(_(":: %s-%s: local version is newer. Upgrade anyway?"),
_______________________________________________
pacman-dev mailing list
[email protected]
http://archlinux.org/mailman/listinfo/pacman-dev