summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-01-28 05:48:51 +0100
committerJudd Vinet <judd@archlinux.org>2006-01-28 05:48:51 +0100
commitf3c5f9b4d1eaa34c0d3893e985900b908f0b08b0 (patch)
tree05e50e63f3e18d00e63b2ec8a25bfa87284ab40b /lib/libalpm/sync.c
parent25a9e070e85cf2d8d007b3fb3b221d91ec079f3b (diff)
downloadpacman-f3c5f9b4d1eaa34c0d3893e985900b908f0b08b0.tar.gz
pacman-f3c5f9b4d1eaa34c0d3893e985900b908f0b08b0.tar.xz
Search through package provides if no literal matches are found when scanning for targets with -S
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 9e23bb31..889c5936 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -39,6 +39,7 @@
#include "cache.h"
#include "deps.h"
#include "conflict.h"
+#include "provide.h"
#include "trans.h"
#include "sync.h"
#include "versioncmp.h"
@@ -285,7 +286,14 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
if(strcmp(dbs->treename, targline) == 0) {
spkg = db_get_pkgfromcache(dbs, targ);
if(spkg == NULL) {
- RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
+ /* Search provides */
+ PMList *p = _alpm_db_whatprovides(dbs, targ);
+ if(p == NULL) {
+ RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
+ }
+ spkg = db_get_pkgfromcache(dbs, p->data);
+ p->data = NULL;
+ FREELIST(p);
}
}
}
@@ -295,12 +303,24 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
pmdb_t *dbs = j->data;
spkg = db_get_pkgfromcache(dbs, targ);
}
+ if(spkg == NULL) {
+ /* Search provides */
+ for(j = dbs_sync; j && !spkg; j = j->next) {
+ pmdb_t *dbs = j->data;
+ PMList *p = _alpm_db_whatprovides(dbs, targ);
+ if(p) {
+ spkg = db_get_pkgfromcache(dbs, p->data);
+ p->data = NULL;
+ FREELIST(p);
+ }
+ }
+ }
}
if(spkg == NULL) {
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
- local = db_get_pkgfromcache(db_local, name);
+ local = db_get_pkgfromcache(db_local, spkg->name);
if(local) {
cmp = versioncmp(local->version, spkg->version);
if(cmp > 0) {