made 'provides' actually work when updating 'requiredby' fields from deps

This commit is contained in:
Aurelien Foret 2005-03-27 07:41:51 +00:00
parent e39d05b31b
commit c0cf6c422d
2 changed files with 14 additions and 8 deletions

View file

@ -98,9 +98,10 @@ int add_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name)
if(strcmp(pkg->name, info->name) == 0) { if(strcmp(pkg->name, info->name) == 0) {
if(rpmvercmp(pkg->version, info->version) < 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); FREEPKG(j->data);
j->data = info; j->data = info;
return(0);
} else { } else {
pm_errno = PM_ERR_TRANS_DUP_TARGET; pm_errno = PM_ERR_TRANS_DUP_TARGET;
goto error; goto error;
@ -372,6 +373,7 @@ int add_commit(pmdb_t *db, pmtrans_t *trans)
if(splitdep(lp->data, &depend)) { if(splitdep(lp->data, &depend)) {
continue; continue;
} }
/* ORE /* ORE
same thing here: we should browse the cache instead of using db_scan */ same thing here: we should browse the cache instead of using db_scan */
depinfo = db_scan(db, depend.name, INFRQ_DESC|INFRQ_DEPENDS); 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) */ cache, thus eliminating the need for db_scan(DEPENDS) */
PMList *provides = _alpm_db_whatprovides(db, depend.name); PMList *provides = _alpm_db_whatprovides(db, depend.name);
if(provides) { if(provides) {
PMList *p;
/* use the first one */ /* 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);
if(depinfo == NULL) { for(p = provides; p; p = p->next) {
PMList *lp; p->data = NULL;
/* wtf */
for(lp = provides; lp; lp = lp->next) {
lp->data = NULL;
} }
FREELIST(provides); FREELIST(provides);
if(depinfo == NULL) {
/* wtf */
continue; continue;
} }
} else { } else {

View file

@ -228,11 +228,15 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
/* look for a provides package */ /* look for a provides package */
PMList *provides = _alpm_db_whatprovides(db, depend.name); PMList *provides = _alpm_db_whatprovides(db, depend.name);
if(provides) { if(provides) {
PMList *p;
/* TODO: should check _all_ packages listed in provides, not just /* TODO: should check _all_ packages listed in provides, not just
* the first one. * the first one.
*/ */
/* use 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); FREELIST(provides);
if(depinfo == NULL) { if(depinfo == NULL) {
/* wtf */ /* wtf */