summaryrefslogtreecommitdiffstats
path: root/expac.c
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-12-08 19:42:27 -0500
committerDave Reisner <d@falconindy.com>2010-12-08 20:55:31 -0500
commitc2d67feae0688c1ba601722edfd3024bc364ce51 (patch)
tree15d01fe03dab75e7b5a8a38b2c699472d8de8151 /expac.c
parent7807fc424fc66ce701646b962092376031ea31cb (diff)
downloadexpac-c2d67feae0688c1ba601722edfd3024bc364ce51.tar.xz
if no targets are provided on a search, dump the entire DB(s)
Diffstat (limited to 'expac.c')
-rw-r--r--expac.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/expac.c b/expac.c
index ded1432..63c2562 100644
--- a/expac.c
+++ b/expac.c
@@ -495,8 +495,15 @@ alpm_list_t *resolve_pkg(alpm_list_t *targets) {
alpm_list_t *t, *r, *ret = NULL;
if (search) {
- for (r = dblist; r; r = alpm_list_next(r)) {
- ret = alpm_list_join(ret, alpm_db_search(alpm_list_getdata(r), targets));
+ if (targets) {
+ for (r = dblist; r; r = alpm_list_next(r)) {
+ ret = alpm_list_join(ret, alpm_db_search(alpm_list_getdata(r), targets));
+ }
+ } else { /* dump full DBs */
+ for (r = dblist; r; r = alpm_list_next(r)) {
+ /* joining causes corruption on alpm_release(), so we copy */
+ ret = alpm_list_join(ret, alpm_list_copy(alpm_db_get_pkgcache(alpm_list_getdata(r))));
+ }
}
} else {
for (t = targets; t; t = alpm_list_next(t)) {
@@ -518,6 +525,7 @@ alpm_list_t *resolve_pkg(alpm_list_t *targets) {
pkg = alpm_db_get_pkg(repo, pkgname);
#ifdef _HAVE_ALPM_FIND_SATISFIER
+ /* try to resolve as provide (e.g. awk => gawk) */
if (!pkg) {
pkg = alpm_find_satisfier(alpm_db_get_pkgcache(repo), pkgname);
}