summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-02-22 00:55:59 +0100
committerJudd Vinet <judd@archlinux.org>2006-02-22 00:55:59 +0100
commit77061889797cdddab49f587e9e0011f2e47b8c85 (patch)
treebf19c6365242ec9976d9fa842fdd93023274af18 /lib
parent910fd6a687db751a7b95829c2b028d6c5d60c3e8 (diff)
downloadpacman-77061889797cdddab49f587e9e0011f2e47b8c85.tar.gz
pacman-77061889797cdddab49f587e9e0011f2e47b8c85.tar.xz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/conflict.c22
1 files changed, 20 insertions, 2 deletions
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)) {