diff options
author | Dan McGee <dan@archlinux.org> | 2009-10-07 21:52:09 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-03-23 22:24:14 -0500 |
commit | cdbb90aceb288034dbf4f228fc4c49da1e2ed0c0 (patch) | |
tree | 4762094260856cb5ed34f72adbba8ae8eb90f513 /src | |
parent | ad4efa539de1e8e9e51baee82efeafde9fb24380 (diff) |
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 <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/package.c | 16 | ||||
-rw-r--r-- | src/pacman/package.h | 2 | ||||
-rw-r--r-- | src/pacman/sync.c | 6 |
3 files changed, 13 insertions, 11 deletions
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 diff --git a/src/pacman/package.h b/src/pacman/package.h index 5b0e02c9..006ea1c9 100644 --- a/src/pacman/package.h +++ b/src/pacman/package.h @@ -23,7 +23,7 @@ #include <alpm.h> void dump_pkg_full(pmpkg_t *pkg, int level); -void dump_pkg_sync(pmpkg_t *pkg, const char *treename); +void dump_pkg_sync(pmpkg_t *pkg, const char *treename, int level); void dump_pkg_backups(pmpkg_t *pkg); void dump_pkg_files(pmpkg_t *pkg, int quiet); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 3b4adaaa..1abb98fa 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -453,7 +453,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) pmpkg_t *pkg = alpm_list_getdata(k); if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) { - dump_pkg_sync(pkg, alpm_db_get_name(db)); + dump_pkg_sync(pkg, alpm_db_get_name(db), config->op_s_info); foundpkg = 1; break; } @@ -474,7 +474,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) pmpkg_t *pkg = alpm_list_getdata(k); if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) { - dump_pkg_sync(pkg, alpm_db_get_name(db)); + dump_pkg_sync(pkg, alpm_db_get_name(db), config->op_s_info); foundpkg = 1; break; } @@ -492,7 +492,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) pmdb_t *db = alpm_list_getdata(i); for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) { - dump_pkg_sync(alpm_list_getdata(j), alpm_db_get_name(db)); + dump_pkg_sync(alpm_list_getdata(j), alpm_db_get_name(db), config->op_s_info); } } } |