From c2d67feae0688c1ba601722edfd3024bc364ce51 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 8 Dec 2010 19:42:27 -0500 Subject: if no targets are provided on a search, dump the entire DB(s) --- expac.c | 12 ++++++++++-- 1 file 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); } -- cgit v1.2.3-54-g00ecf