summaryrefslogtreecommitdiff
path: root/lib/libalpm/deps.c
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-07-04 17:48:15 +0000
committerJudd Vinet <judd@archlinux.org>2006-07-04 17:48:15 +0000
commitef7cbbb771d8e6bbdd0fda0d3ddd4364856aa17b (patch)
tree7e950d24a16489714b3b207b10997b31c1f2baee /lib/libalpm/deps.c
parent7236dd32872f0eeed21a97d15807f0ef27f45a20 (diff)
downloadpacman-ef7cbbb771d8e6bbdd0fda0d3ddd4364856aa17b.tar.xz
bugfix: when looking at provides, defer to the new, to-be-installed package's provisios instead of the the existing package's
Diffstat (limited to 'lib/libalpm/deps.c')
-rw-r--r--lib/libalpm/deps.c39
1 files changed, 27 insertions, 12 deletions
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... */