summaryrefslogtreecommitdiffstats
path: root/expac.c
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-12-01 00:10:48 -0500
committerDave Reisner <d@falconindy.com>2010-12-01 00:12:36 -0500
commitf4e8889f78ea7d2c5655c45c977abf8cef6e79f7 (patch)
treed2594bb6bdcbd4bd40defa45695e36e09c8e753e /expac.c
parentd9e1761cda68b8a9a2b950aa2a4f7d9a856cc3be (diff)
downloadexpac-f4e8889f78ea7d2c5655c45c977abf8cef6e79f7.tar.xz
refactor resolve_pkg
fixes multiple issues with repo/pkg style targets and should cause these queries to run slightly faster.
Diffstat (limited to 'expac.c')
-rw-r--r--expac.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/expac.c b/expac.c
index 6582fad..6e4ddba 100644
--- a/expac.c
+++ b/expac.c
@@ -496,7 +496,7 @@ alpm_list_t *resolve_pkg(alpm_list_t *targets) {
}
} else {
for (t = targets; t; t = alpm_list_next(t)) {
- pkgname = alpm_list_getdata(t);
+ pkgname = reponame = alpm_list_getdata(t);
if (strchr(pkgname, '/')) {
strsep(&pkgname, "/");
} else {
@@ -504,19 +504,21 @@ alpm_list_t *resolve_pkg(alpm_list_t *targets) {
}
for (r = dblist; r; r = alpm_list_next(r)) {
+ pmdb_t *repo;
pmpkg_t *pkg;
- pkg = alpm_db_get_pkg(alpm_list_getdata(r), pkgname);
+ repo = alpm_list_getdata(r);
+ if (reponame && strcmp(reponame, alpm_db_get_name(repo)) != 0) {
+ continue;
+ }
+ pkg = alpm_db_get_pkg(repo, pkgname);
#ifdef _HAVE_ALPM_FIND_SATISFIER
if (!pkg) {
- pkg = alpm_find_satisfier(alpm_db_get_pkgcache(alpm_list_getdata(r)), pkgname);
+ pkg = alpm_find_satisfier(alpm_db_get_pkgcache(repo), pkgname);
}
#endif
- if (reponame && strcmp(reponame, alpm_db_get_name(alpm_list_getdata(r))) != 0) {
- continue;
- }
if (!pkg) {
if (verbose) {
fprintf(stderr, "error: package `%s' not found\n", pkgname);