From cdbb90aceb288034dbf4f228fc4c49da1e2ed0c0 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 7 Oct 2009 21:52:09 -0500 Subject: Show 'Required By' in -Sii output Just as we do in -Qi, we can compute required by information for sync database packages. The behavior seems sane; for a given package, the -Sii required by will show all packages in *any* sync database that require it. Implements FS#16244. Signed-off-by: Dan McGee --- src/pacman/package.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/pacman/package.c') diff --git a/src/pacman/package.c b/src/pacman/package.c index 060bd438..413754c7 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -38,7 +38,9 @@ /* Display the content of a package * - * level: <0 - sync package [-Si] + * levels: + * <-1 - sync package, extra information (required by) [-Sii] + * -1 - sync package, normal level [-Si] * =0 - file query [-Qip] * 1 - localdb query, normal level [-Qi] * >1 - localdb query, extra information (backup files) [-Qii] @@ -83,7 +85,7 @@ void dump_pkg_full(pmpkg_t *pkg, int level) depstrings = alpm_list_add(depstrings, alpm_dep_compute_string(dep)); } - if(level>0) { + if(level > 0 || level < -1) { /* compute this here so we don't get a pause in the middle of output */ requiredby = alpm_pkg_compute_requiredby(pkg); } @@ -97,10 +99,8 @@ void dump_pkg_full(pmpkg_t *pkg, int level) list_display(_("Provides :"), alpm_pkg_get_provides(pkg)); list_display(_("Depends On :"), depstrings); list_display_linebreak(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg)); - /* Only applicable if installed */ - if(level > 0) { + if(level > 0 || level < -1) { list_display(_("Required By :"), requiredby); - FREELIST(requiredby); } list_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg)); list_display(_("Replaces :"), alpm_pkg_get_replaces(pkg)); @@ -142,17 +142,19 @@ void dump_pkg_full(pmpkg_t *pkg, int level) printf("\n"); FREELIST(depstrings); + FREELIST(requiredby); } /* Display the content of a sync package */ -void dump_pkg_sync(pmpkg_t *pkg, const char *treename) +void dump_pkg_sync(pmpkg_t *pkg, const char *treename, int level) { if(pkg == NULL) { return; } string_display(_("Repository :"), treename); - dump_pkg_full(pkg, -1); + /* invert the level since we are a sync package */ + dump_pkg_full(pkg, -level); } /* Display list of backup files and their modification states -- cgit v1.2.3-54-g00ecf