1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages

Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages,
except for packages explicitly listed for sync by the user.  This
eliminates many unnecessary prompts when IgnorePkg/IgnoreGroup is
used.

Signed-off-by: Bryan Ischo <bryan@ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Bryan Ischo 2009-02-22 23:25:32 +13:00 committed by Dan McGee
parent 0268550401
commit f57f8d3386
9 changed files with 209 additions and 21 deletions

View File

@ -504,8 +504,20 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
}
}
/* helper function for resolvedeps: search for dep satisfier in dbs */
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, pmpkg_t *tpkg)
/**
* helper function for resolvedeps: search for dep satisfier in dbs
*
* @param dep is the dependency to search for
* @param dbs are the databases to search
* @param excluding are the packages to exclude from the search
* @param prompt if true, will cause an unresolvable dependency to issue an
* interactive prompt asking whether the package should be removed from
* the transaction or the transaction aborted; if false, simply returns
* an error code without prompting
* @return the resolved package
**/
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
alpm_list_t *excluding, int prompt)
{
alpm_list_t *i, *j;
/* 1. literals */
@ -513,9 +525,11 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *exclud
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
if(pkg && alpm_depcmp(pkg, dep) && !_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);
int install = 0;
if (prompt) {
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, pkg,
NULL, NULL, &install);
}
if(!install) {
continue;
}
@ -530,9 +544,11 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *exclud
if(alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) &&
!_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);
int install = 0;
if (prompt) {
QUESTION(handle->trans, PM_TRANS_CONV_INSTALL_IGNOREPKG,
pkg, NULL, NULL, &install);
}
if(!install) {
continue;
}
@ -605,7 +621,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *pkg,
continue;
}
/* find a satisfier package in the given repositories */
pmpkg_t *spkg = _alpm_resolvedep(missdep, dbs_sync, *packages, tpkg);
pmpkg_t *spkg = _alpm_resolvedep(missdep, dbs_sync, *packages, 0);
if(!spkg) {
pm_errno = PM_ERR_UNSATISFIED_DEPS;
char *missdepstring = alpm_dep_compute_string(missdep);

View File

@ -47,7 +47,7 @@ pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdepend_t *dep,
void _alpm_depmiss_free(pmdepmissing_t *miss);
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, pmpkg_t *tpkg);
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, int prompt);
int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *pkg,
alpm_list_t **packages, alpm_list_t *remove, alpm_list_t **data);
int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2);

View File

@ -285,12 +285,12 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
RET_ERR(PM_ERR_PKG_REPO_NOT_FOUND, -1);
}
dep = _alpm_splitdep(targ);
spkg = _alpm_resolvedep(dep, dbs, NULL, NULL);
spkg = _alpm_resolvedep(dep, dbs, NULL, 1);
_alpm_dep_free(dep);
alpm_list_free(dbs);
} else {
dep = _alpm_splitdep(targline);
spkg = _alpm_resolvedep(dep, dbs_sync, NULL, NULL);
spkg = _alpm_resolvedep(dep, dbs_sync, NULL, 1);
_alpm_dep_free(dep);
}
FREE(targline);

View File

@ -0,0 +1,17 @@
self.description = "Sync with irrelevant ignored packages"
package1 = pmpkg("package1")
self.addpkg2db("local", package1)
package2 = pmpkg("package2")
self.addpkg2db("local", package2)
package2up = pmpkg("package2", "2.0-1")
self.addpkg2db("sync", package2up)
self.option["IgnorePkg"] = ["irrelavent"]
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=package1|1.0-1")
self.addrule("PKG_VERSION=package2|2.0-1")

View File

@ -0,0 +1,35 @@
self.description = "Sync with relevant ignored packages"
package1 = pmpkg("package1")
self.addpkg2db("local", package1)
package2 = pmpkg("package2")
self.addpkg2db("local", package2)
package3 = pmpkg("package3")
package3.depends = ["package2=1.0-1"]
self.addpkg2db("local", package3)
package4 = pmpkg("package4")
package4.depends = ["package3=1.0-1"]
self.addpkg2db("local", package4)
package2up = pmpkg("package2", "2.0-1")
self.addpkg2db("sync", package2up)
package3up = pmpkg("package3", "2.0-1")
package3up.depends = ["package2=2.0-1"]
self.addpkg2db("sync", package3up)
package4up = pmpkg("package4", "2.0-1")
package4up.depends = ["package3=2.0-1"]
self.addpkg2db("sync", package4up)
self.option["IgnorePkg"] = ["package2"]
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=package1|1.0-1")
self.addrule("PKG_VERSION=package2|1.0-1")
self.addrule("PKG_VERSION=package3|1.0-1")
self.addrule("PKG_VERSION=package4|1.0-1")

View File

@ -0,0 +1,35 @@
self.description = "Sync with relevant ignored packages and dependency loop"
package1 = pmpkg("package1")
self.addpkg2db("local", package1)
package2 = pmpkg("package2")
self.addpkg2db("local", package2)
package3 = pmpkg("package3")
package3.depends = ["package2=1.0-1"]
self.addpkg2db("local", package3)
package4 = pmpkg("package4")
package4.depends = ["package3=1.0-1"]
self.addpkg2db("local", package4)
package2up = pmpkg("package2", "2.0-1")
self.addpkg2db("sync", package2up)
package3up = pmpkg("package3", "2.0-1")
package3up.depends = ["package2=2.0-1", "package4=2.0-1"]
self.addpkg2db("sync", package3up)
package4up = pmpkg("package4", "2.0-1")
package4up.depends = ["package3=2.0-1"]
self.addpkg2db("sync", package4up)
self.option["IgnorePkg"] = ["package2"]
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=package1|1.0-1")
self.addrule("PKG_VERSION=package2|1.0-1")
self.addrule("PKG_VERSION=package3|1.0-1")
self.addrule("PKG_VERSION=package4|1.0-1")

View File

@ -0,0 +1,46 @@
self.description = "Sync with ignore causing top-level to be ignored"
packageA1 = pmpkg("packageA1")
packageA1.depends = ["packageA2=1.0-1", "packageA3=1.0-1"];
self.addpkg2db("local", packageA1)
packageA2 = pmpkg("packageA2")
packageA2.depends = ["packageA4=1.0-1", "packageA5=1.0-1"];
self.addpkg2db("local", packageA2)
packageA3 = pmpkg("packageA3")
self.addpkg2db("local", packageA3)
packageA4 = pmpkg("packageA4")
self.addpkg2db("local", packageA4)
packageA5 = pmpkg("packageA5")
self.addpkg2db("local", packageA5)
packageA1up = pmpkg("packageA1", "2.0-1")
packageA1up.depends = ["packageA2=2.0-1", "packageA3=2.0-1"];
self.addpkg2db("sync", packageA1up)
packageA2up = pmpkg("packageA2", "2.0-1")
packageA2up.depends = ["packageA4=2.0-1", "packageA5=2.0-1"];
self.addpkg2db("sync", packageA2up)
packageA3up = pmpkg("packageA3", "2.0-1")
self.addpkg2db("sync", packageA3up)
packageA4up = pmpkg("packageA4", "2.0-1")
self.addpkg2db("sync", packageA4up)
packageA5up = pmpkg("packageA5", "2.0-1")
self.addpkg2db("sync", packageA5up)
self.option["IgnorePkg"] = ["packageA3"]
self.args = "-S packageA1"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=packageA1|1.0-1")
self.addrule("PKG_VERSION=packageA2|1.0-1")
self.addrule("PKG_VERSION=packageA3|1.0-1")
self.addrule("PKG_VERSION=packageA4|1.0-1")
self.addrule("PKG_VERSION=packageA5|1.0-1")

View File

@ -0,0 +1,46 @@
self.description = "Sync with ignore causing top-level to be included"
packageA1 = pmpkg("packageA1")
packageA1.depends = ["packageA2>=1.0-1", "packageA3=1.0-1"];
self.addpkg2db("local", packageA1)
packageA2 = pmpkg("packageA2")
packageA2.depends = ["packageA4=1.0-1", "packageA5=1.0-1"];
self.addpkg2db("local", packageA2)
packageA3 = pmpkg("packageA3")
self.addpkg2db("local", packageA3)
packageA4 = pmpkg("packageA4")
self.addpkg2db("local", packageA4)
packageA5 = pmpkg("packageA5")
self.addpkg2db("local", packageA5)
packageA1up = pmpkg("packageA1", "2.0-1")
packageA1up.depends = ["packageA2>=2.0-1", "packageA3=2.0-1"];
self.addpkg2db("sync", packageA1up)
packageA2up = pmpkg("packageA2", "2.0-1")
packageA2up.depends = ["packageA4=2.0-1", "packageA5=2.0-1"];
self.addpkg2db("sync", packageA2up)
packageA3up = pmpkg("packageA3", "2.0-1")
self.addpkg2db("sync", packageA3up)
packageA4up = pmpkg("packageA4", "2.0-1")
self.addpkg2db("sync", packageA4up)
packageA5up = pmpkg("packageA5", "2.0-1")
self.addpkg2db("sync", packageA5up)
self.option["IgnorePkg"] = ["packageA3"]
self.args = "-S packageA1 packageA2"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=packageA1|1.0-1")
self.addrule("PKG_VERSION=packageA2|2.0-1")
self.addrule("PKG_VERSION=packageA3|1.0-1")
self.addrule("PKG_VERSION=packageA4|2.0-1")
self.addrule("PKG_VERSION=packageA5|2.0-1")

View File

@ -248,15 +248,8 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
{
switch(event) {
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
if(data2) {
/* TODO we take this route based on data2 being not null? WTF */
*response = yesno(_(":: %s requires installing %s from IgnorePkg/IgnoreGroup. Install anyway?"),
alpm_pkg_get_name(data2),
alpm_pkg_get_name(data1));
} else {
*response = yesno(_(":: %s is in IgnorePkg/IgnoreGroup. Install anyway?"),
alpm_pkg_get_name(data1));
}
*response = yesno(_(":: %s is in IgnorePkg/IgnoreGroup. Install anyway?"),
alpm_pkg_get_name(data1));
break;
case PM_TRANS_CONV_REPLACE_PKG:
*response = yesno(_(":: Replace %s with %s/%s?"),