mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Enabled new interactive prompt and updated some tests
Enabled a new prompt to ask the user if they'd like to remove unresolvable packages from the transaction rather than failing it. Many pactest tests that used to fail now return success codes, because pacman now issues a prompt allowing the user to cancel rather than failing many transactions, and the pactest scripts always choose to cancel with no error rather than failing. The only net effect is that the return status of pacman is now 0 in cases where it used to be nonzero. Signed-off-by: Bryan Ischo <bryan@ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
c8a41b7d6d
commit
0268550401
@ -371,7 +371,8 @@ typedef enum _pmtransconv_t {
|
||||
PM_TRANS_CONV_REPLACE_PKG = 0x02,
|
||||
PM_TRANS_CONV_CONFLICT_PKG = 0x04,
|
||||
PM_TRANS_CONV_CORRUPTED_PKG = 0x08,
|
||||
PM_TRANS_CONV_LOCAL_NEWER = 0x10
|
||||
PM_TRANS_CONV_LOCAL_NEWER = 0x10,
|
||||
PM_TRANS_CONV_REMOVE_PKGS = 0x20,
|
||||
} pmtransconv_t;
|
||||
|
||||
/* Transaction Progress */
|
||||
|
@ -531,8 +531,8 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *exclud
|
||||
!_alpm_pkg_find(excluding, pkg->name)) {
|
||||
if(_alpm_pkg_should_ignore(pkg)) {
|
||||
int install;
|
||||
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
|
||||
tpkg, NULL, &install);
|
||||
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
|
||||
pkg, tpkg, NULL, &install);
|
||||
if(!install) {
|
||||
continue;
|
||||
}
|
||||
@ -609,7 +609,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *pkg,
|
||||
if(!spkg) {
|
||||
pm_errno = PM_ERR_UNSATISFIED_DEPS;
|
||||
char *missdepstring = alpm_dep_compute_string(missdep);
|
||||
_alpm_log(PM_LOG_ERROR, _("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
||||
_alpm_log(PM_LOG_WARNING, _("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
||||
missdepstring, tpkg->name);
|
||||
free(missdepstring);
|
||||
if(data) {
|
||||
|
@ -442,13 +442,27 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||
dependencies not already on the list */
|
||||
}
|
||||
|
||||
/* If there were unresolvable top-level packages, fail the
|
||||
transaction. */
|
||||
/* If there were unresolvable top-level packages, prompt the user to
|
||||
see if they'd like to ignore them rather than failing the sync */
|
||||
if(unresolvable != NULL) {
|
||||
int remove_unresolvable = 0;
|
||||
QUESTION(handle->trans, PM_TRANS_CONV_REMOVE_PKGS, unresolvable,
|
||||
NULL, NULL, &remove_unresolvable);
|
||||
if (remove_unresolvable) {
|
||||
/* User wants to remove the unresolvable packages from the
|
||||
transaction, so simply drop the unresolvable list. The
|
||||
packages will be removed from the actual transaction when
|
||||
the transaction packages are replaced with a
|
||||
dependency-reordered list below */
|
||||
alpm_list_free(unresolvable);
|
||||
unresolvable = NULL;
|
||||
}
|
||||
else {
|
||||
/* pm_errno is set by resolvedeps */
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add all packages which were "pulled" (i.e. weren't already in the
|
||||
transaction) to the transaction in pmsyncpkg_t structures */
|
||||
|
@ -10,6 +10,6 @@ self.addpkg2db("local", lp)
|
||||
|
||||
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")
|
||||
|
@ -10,6 +10,6 @@ self.addpkg2db("local", lp)
|
||||
|
||||
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")
|
||||
|
@ -14,6 +14,6 @@ self.addpkg2db("sync1", sp3)
|
||||
|
||||
self.args = "-S pkg"
|
||||
|
||||
self.addrule("PACMAN_RETCODE=1")
|
||||
self.addrule("PACMAN_RETCODE=0")
|
||||
self.addrule("!PKG_EXIST=pkg")
|
||||
self.addrule("!PKG_EXIST=cpkg")
|
||||
|
@ -9,6 +9,6 @@ self.addpkg2db("sync", sp2)
|
||||
|
||||
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")
|
||||
|
@ -270,6 +270,22 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
|
||||
(char *)data2,
|
||||
(char *)data2);
|
||||
break;
|
||||
case PM_TRANS_CONV_REMOVE_PKGS:
|
||||
{
|
||||
alpm_list_t *unresolved = (alpm_list_t *) data1;
|
||||
alpm_list_t *namelist = NULL, *i;
|
||||
for (i = unresolved; i; i = i->next) {
|
||||
namelist = alpm_list_add(namelist,
|
||||
(char *)alpm_pkg_get_name(i->data));
|
||||
}
|
||||
printf(":: the following package(s) cannot be upgraded due to "
|
||||
"unresolvable dependencies:\n");
|
||||
list_display(" ", namelist);
|
||||
*response = yesno(_("\nDo you want to skip the above "
|
||||
"package(s) for this upgrade?"));
|
||||
alpm_list_free(namelist);
|
||||
}
|
||||
break;
|
||||
case PM_TRANS_CONV_LOCAL_NEWER:
|
||||
if(!config->op_s_downloadonly) {
|
||||
*response = yesno(_(":: %s-%s: local version is newer. Upgrade anyway?"),
|
||||
|
Loading…
Reference in New Issue
Block a user