summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier Chantry <chantry.xavier@gmail.com>2010-10-17 19:14:41 +0200
committerXavier Chantry <chantry.xavier@gmail.com>2011-01-29 19:40:08 +0100
commit05f2abfba9d9e9055c5a2d0d7ae92d24f0dd1a2f (patch)
tree5e15dc1566a5aec1f2dd513e24e565d812983bf2 /src
parent2dd53e50de4f80cef84cd90140c4b43633360372 (diff)
downloadpacman-05f2abfba9d9e9055c5a2d0d7ae92d24f0dd1a2f.tar.xz
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 <chantry.xavier@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/util.c24
1 files changed, 22 insertions, 2 deletions
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);
}