From ef7cbbb771d8e6bbdd0fda0d3ddd4364856aa17b Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Tue, 4 Jul 2006 17:48:15 +0000 Subject: bugfix: when looking at provides, defer to the new, to-be-installed package's provisios instead of the the existing package's --- lib/libalpm/deps.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 3b4ea1d9..978ffb68 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -290,11 +290,27 @@ PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages) } } } - /* check other targets */ - for(k = packages; k && !found; k = k->next) { - pmpkg_t *p = (pmpkg_t *)k->data; - /* see if the package names match OR if p provides depend.name */ - if(!strcmp(p->name, depend.name) || _alpm_list_is_strin(depend.name, p->provides)) { + /* check database for provides matches */ + if(!found) { + PMList *m; + k = _alpm_db_whatprovides(db, depend.name); + for(m = k; m && !found; m = m->next) { + /* look for a match that isn't one of the packages we're trying + * to install. this way, if we match against a to-be-installed + * package, we'll defer to the NEW one, not the one already + * installed. */ + pmpkg_t *p = m->data; + PMList *n; + int skip = 0; + for(n = packages; n && !skip; n = n->next) { + pmpkg_t *ptp = n->data; + if(!strcmp(ptp->name, p->name)) { + skip = 1; + } + } + if(skip) { + continue; + } if(depend.mod == PM_DEP_MOD_ANY) { /* accept any version */ found = 1; @@ -317,13 +333,13 @@ PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages) FREE(ver); } } + FREELISTPTR(k); } - /* check database for provides matches */ - if(!found){ - k = _alpm_db_whatprovides(db, depend.name); - if(k) { - /* grab the first one (there should only really be one, anyway) */ - pmpkg_t *p = k->data; + /* check other targets */ + for(k = packages; k && !found; k = k->next) { + pmpkg_t *p = (pmpkg_t *)k->data; + /* see if the package names match OR if p provides depend.name */ + if(!strcmp(p->name, depend.name) || _alpm_list_is_strin(depend.name, p->provides)) { if(depend.mod == PM_DEP_MOD_ANY) { /* accept any version */ found = 1; @@ -345,7 +361,6 @@ PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages) } FREE(ver); } - FREELISTPTR(k); } } /* else if still not found... */ -- cgit v1.2.3-24-g4f1b