summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorBryan Ischo <bryan@ischo.com>2009-02-22 23:25:32 +1300
committerDan McGee <dan@archlinux.org>2009-02-23 20:37:14 -0600
commitf57f8d33862050acc8d131710c100ba47877e675 (patch)
tree3fd183a6a7d9ed8756a2b30ebe1522ea34ba6edd /lib/libalpm
parent02685504012a4880e599b15f1060f6bd0bf48797 (diff)
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>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/deps.c34
-rw-r--r--lib/libalpm/deps.h2
-rw-r--r--lib/libalpm/sync.c4
3 files changed, 28 insertions, 12 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index ebcd18dd..694e5be5 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -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);
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index 07270957..eb1400bd 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -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);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index eefca7f9..709a36dc 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -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);