summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-27 07:41:51 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-03-27 07:41:51 +0000
commitc0cf6c422d96893436912d12dd651f3f971070ed (patch)
tree9c207025ac819707f906eb6623eb089024d1eeb0 /lib
parente39d05b31b67c9cbc3379d44751fb6f3403c3911 (diff)
made 'provides' actually work when updating 'requiredby' fields from deps
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/add.c16
-rw-r--r--lib/libalpm/remove.c6
2 files changed, 14 insertions, 8 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index b2cacf81..0bbf0755 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -98,9 +98,10 @@ int add_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name)
if(strcmp(pkg->name, info->name) == 0) {
if(rpmvercmp(pkg->version, info->version) < 0) {
- _alpm_log(PM_LOG_WARNING, "replacing older version of %s in target list", pkg->name);
+ _alpm_log(PM_LOG_WARNING, "replacing older version of %s %s by %s in target list", pkg->name, pkg->version, info->version);
FREEPKG(j->data);
j->data = info;
+ return(0);
} else {
pm_errno = PM_ERR_TRANS_DUP_TARGET;
goto error;
@@ -372,6 +373,7 @@ int add_commit(pmdb_t *db, pmtrans_t *trans)
if(splitdep(lp->data, &depend)) {
continue;
}
+
/* ORE
same thing here: we should browse the cache instead of using db_scan */
depinfo = db_scan(db, depend.name, INFRQ_DESC|INFRQ_DEPENDS);
@@ -382,15 +384,15 @@ int add_commit(pmdb_t *db, pmtrans_t *trans)
cache, thus eliminating the need for db_scan(DEPENDS) */
PMList *provides = _alpm_db_whatprovides(db, depend.name);
if(provides) {
+ PMList *p;
/* use the first one */
- depinfo = db_scan(db, ((pmpkg_t *)provides->data)->name, INFRQ_DEPENDS);
+ depinfo = db_scan(db, ((pmpkg_t *)provides->data)->name, INFRQ_DESC|INFRQ_DEPENDS);
+ for(p = provides; p; p = p->next) {
+ p->data = NULL;
+ }
+ FREELIST(provides);
if(depinfo == NULL) {
- PMList *lp;
/* wtf */
- for(lp = provides; lp; lp = lp->next) {
- lp->data = NULL;
- }
- FREELIST(provides);
continue;
}
} else {
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 8f778576..b6e2452b 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -228,11 +228,15 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
/* look for a provides package */
PMList *provides = _alpm_db_whatprovides(db, depend.name);
if(provides) {
+ PMList *p;
/* TODO: should check _all_ packages listed in provides, not just
* the first one.
*/
/* use the first one */
- depinfo = db_scan(db, provides->data, INFRQ_DEPENDS);
+ depinfo = db_scan(db, ((pmpkg_t *)provides->data)->name, INFRQ_DESC|INFRQ_DEPENDS);
+ for(p = provides; p; p = p->next) {
+ p->data = NULL;
+ }
FREELIST(provides);
if(depinfo == NULL) {
/* wtf */