index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Xavier Chantry <chantry.xavier@gmail.com> | 2010-10-17 19:14:41 +0200 |
---|---|---|
committer | Xavier Chantry <chantry.xavier@gmail.com> | 2011-01-29 19:40:08 +0100 |
commit | 05f2abfba9d9e9055c5a2d0d7ae92d24f0dd1a2f (patch) | |
tree | 5e15dc1566a5aec1f2dd513e24e565d812983bf2 | |
parent | 2dd53e50de4f80cef84cd90140c4b43633360372 (diff) |
-rw-r--r-- | src/pacman/util.c | 24 |
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); } |