diff options
author | Nagy Gabor <ngaba@petra.hos.u-szeged.hu> | 2007-08-12 23:41:30 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-11-18 19:37:16 +0100 |
commit | 55a7455135e2d8f2e118928f634dc7976ab6c8b4 (patch) | |
tree | 90b75507b12c531bab5fdbbc5836ccaebcb16690 /lib | |
parent | 8f824e70bbaf9cb2b72103fe378d93e3ded8cdee (diff) | |
download | pacman-55a7455135e2d8f2e118928f634dc7976ab6c8b4.tar.gz pacman-55a7455135e2d8f2e118928f634dc7976ab6c8b4.tar.xz |
libalpm/deps.c : improves IgnorePkg handling in resolvedeps.
resolvedeps will now search for other satisfiers
when we don't let it add a package from IgnorePkg.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/deps.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 4d3dbe98..6aaf4bd8 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -681,8 +681,19 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, /* find the package in one of the repositories */ /* check literals */ for(j = dbs_sync; j && !found; j = j->next) { - if((sync = _alpm_db_get_pkgfromcache(j->data, missdep->name))) { - found = alpm_depcmp(sync, missdep); + sync = _alpm_db_get_pkgfromcache(j->data, missdep->name); + if(!sync) { + continue; + } + found = alpm_depcmp(sync, missdep); + if(!found) { + continue; + } + /* If package is in the ignorepkg list, ask before we pull it */ + if(_alpm_pkg_should_ignore(sync)) { + pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL); + QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &found); + _alpm_pkg_free(dummypkg); } } /*TODO this autoresolves the first 'satisfier' package... we should fix this @@ -691,7 +702,18 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, for(j = dbs_sync; j && !found; j = j->next) { for(k = _alpm_db_get_pkgcache(j->data); k && !found; k = k->next) { sync = k->data; + if(!sync) { + continue; + } found = alpm_depcmp(sync, missdep); + if(!found) { + continue; + } + if(_alpm_pkg_should_ignore(sync)) { + pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL); + QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &found); + _alpm_pkg_free(dummypkg); + } } } @@ -712,37 +734,13 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, } pm_errno = PM_ERR_UNSATISFIED_DEPS; goto error; - } - /* check pmo_ignorepkg and pmo_s_ignore to make sure we haven't pulled in - * something we're not supposed to. - */ - int usedep = 1; - if(_alpm_pkg_should_ignore(sync)) { - pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL); - QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep); - _alpm_pkg_free(dummypkg); - } - if(usedep) { + } else { _alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n", alpm_pkg_get_name(sync), alpm_pkg_get_name(syncpkg)); *list = alpm_list_add(*list, sync); if(_alpm_resolvedeps(local, dbs_sync, sync, list, trans, data)) { goto error; } - } else { - _alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\"\n"), miss->target); - if(data) { - if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) { - _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t)); - FREELIST(*data); - pm_errno = PM_ERR_MEMORY; - goto error; - } - *miss = *(pmdepmissing_t *)i->data; - *data = alpm_list_add(*data, miss); - } - pm_errno = PM_ERR_UNSATISFIED_DEPS; - goto error; } } |