diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2005-04-24 13:17:39 +0200 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-04-24 13:17:39 +0200 |
commit | 85203ff6755de92b56b6858db938bcf6f5ce6104 (patch) | |
tree | cc21d99f5ce75b98afe6a61f719692956f1092ff | |
parent | 95fac9cdb267b6a0f2aba6684ae6f58404caf763 (diff) | |
download | pacman-85203ff6755de92b56b6858db938bcf6f5ce6104.tar.gz pacman-85203ff6755de92b56b6858db938bcf6f5ce6104.tar.xz |
use the cache instead of calling db_scan()
-rw-r--r-- | lib/libalpm/deps.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 4439ba8d..a543277a 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -375,14 +375,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) k = _alpm_db_whatprovides(db, depend.name); if(k) { /* grab the first one (there should only really be one, anyway) */ - pmpkg_t *p = db_scan(db, ((pmpkg_t *)k->data)->name, INFRQ_DESC); - if(p == NULL) { - /* wtf */ - _alpm_log(PM_LOG_ERROR, "%s supposedly provides %s, but it was not found in db", - ((pmpkg_t *)k->data)->name, depend.name); - FREELISTPTR(k); - continue; - } + pmpkg_t *p = k->data; if(depend.mod == PM_DEP_MOD_ANY) { /* accept any version */ found = 1; @@ -404,8 +397,8 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages) } FREE(ver); } + FREELISTPTR(k); } - FREELISTPTR(k); } /* else if still not found... */ if(!found) { @@ -516,7 +509,7 @@ PMList* removedeps(pmdb_t *db, PMList *targs) pmpkg_t *dep; int needed = 0; splitdep(j->data, &depend); - dep = db_scan(db, depend.name, INFRQ_DESC | INFRQ_DEPENDS); + dep = db_get_pkgfromcache(db, depend.name); if(pkg_isin(dep, targs)) { continue; } @@ -527,17 +520,19 @@ PMList* removedeps(pmdb_t *db, PMList *targs) } /* see if other packages need it */ for(k = dep->requiredby; k && !needed; k = k->next) { - pmpkg_t *dummy = db_scan(db, k->data, INFRQ_DESC); + pmpkg_t *dummy = db_get_pkgfromcache(db, k->data); if(!pkg_isin(dummy, targs)) { needed = 1; } } if(!needed) { + char *name; + asprintf(&name, "%s-%s", dep->name, dep->version); /* add it to the target list */ - pkg_free(dep); - dep = db_scan(db, depend.name, INFRQ_ALL); + db_read(db, name, INFRQ_ALL, dep); newtargs = pm_list_add(newtargs, dep); newtargs = removedeps(db, newtargs); + FREE(name); } } } |