From 77061889797cdddab49f587e9e0011f2e47b8c85 Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Tue, 21 Feb 2006 23:55:59 +0000 Subject: conflict checks: when doing db-vs-target checks, opt to use the NEWER, to-be-installed package instead of the local db version if there's one available --- lib/libalpm/conflict.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/conflict.c') diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index a2f85153..f30a427b 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -132,12 +132,30 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages) } /* CHECK 3: check database against targets */ for(k = _alpm_db_get_pkgcache(db); k; k = k->next) { + PMList *conflicts = NULL; + int usenewconflicts = 0; + info = k->data; if(!strcmp(info->name, tp->name)) { /* a package cannot conflict with itself -- that's just not nice */ continue; } - for(j = info->conflicts; j; j = j->next) { + /* If this package (*info) is also in our packages PMList, use the + * conflicts list from the new package, not the old one (*info) + */ + for(j = packages; j; j = j->next) { + pmpkg_t *pkg = j->data; + if(!strcmp(pkg->name, info->name)) { + /* Use the new, to-be-installed package's conflicts */ + conflicts = pkg->conflicts; + usenewconflicts = 1; + } + } + if(!usenewconflicts) { + /* Use the old package's conflicts, it's the only set we have */ + conflicts = info->conflicts; + } + for(j = conflicts; j; j = j->next) { if(!strcmp((char *)j->data, tp->name)) { _alpm_log(PM_LOG_DEBUG, "db vs targs: found %s as a conflict for %s", info->name, tp->name); @@ -150,7 +168,7 @@ PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages) } else { /* see if the db package conflicts with something we provide */ PMList *m; - for(m = info->conflicts; m; m = m->next) { + for(m = conflicts; m; m = m->next) { PMList *n; for(n = tp->provides; n; n = n->next) { if(!strcmp(m->data, n->data)) { -- cgit v1.2.3-54-g00ecf