summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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... */