From 05f2abfba9d9e9055c5a2d0d7ae92d24f0dd1a2f Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Sun, 17 Oct 2010 19:14:41 +0200 Subject: select_display: per-database output This function is used both for provision and group selection. Now the database name will be displayed. $ pacman -S base-devel :: There are 11 members in group base-devel: :: Repository testing 1) make :: Repository core 2) autoconf 3) automake 4) bison 5) fakeroot 6) flex 7) gcc 8) libtool 9) m4 10) patch 11) pkg-config Which ones do you want to install? Enter a number (default=all): Signed-off-by: Xavier Chantry --- src/pacman/util.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/pacman') diff --git a/src/pacman/util.c b/src/pacman/util.c index 37f28528..c08ebb15 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -677,20 +677,40 @@ void display_optdepends(pmpkg_t *pkg) } } +static void display_repo_list(const char *dbname, alpm_list_t *list) +{ + const char *prefix= " "; + + printf(":: "); + printf(_("Repository %s\n"), dbname); + list_display(prefix, list); +} + void select_display(const alpm_list_t *pkglist) { const alpm_list_t *i; int nth = 1; alpm_list_t *list = NULL; char *string = NULL; + const char *dbname = NULL; for (i = pkglist; i; i = i->next) { + pmpkg_t *pkg = alpm_list_getdata(i); + pmdb_t *db = alpm_pkg_get_db(pkg); + + if(!dbname) + dbname = alpm_db_get_name(db); + if(strcmp(alpm_db_get_name(db), dbname) != 0) { + display_repo_list(dbname, list); + FREELIST(list); + dbname = alpm_db_get_name(db); + } string = NULL; - pm_asprintf(&string, "%d) %s", nth, alpm_pkg_get_name(i->data)); + pm_asprintf(&string, "%d) %s", nth, alpm_pkg_get_name(pkg)); list = alpm_list_add(list, string); nth++; } - list_display(" ", list); + display_repo_list(dbname, list); FREELIST(list); } -- cgit v1.2.3-70-g09d2