diff options
author | Dave Reisner <d@falconindy.com> | 2010-12-08 19:42:27 -0500 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2010-12-08 20:55:31 -0500 |
commit | c2d67feae0688c1ba601722edfd3024bc364ce51 (patch) | |
tree | 15d01fe03dab75e7b5a8a38b2c699472d8de8151 | |
parent | 7807fc424fc66ce701646b962092376031ea31cb (diff) | |
download | expac-c2d67feae0688c1ba601722edfd3024bc364ce51.tar.xz |
if no targets are provided on a search, dump the entire DB(s)
-rw-r--r-- | expac.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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); } |