[pacman-dev] [PATCH] pacman: show groups once with -Sg
Dan McGee
dpmcgee at gmail.com
Tue Apr 3 08:58:43 EDT 2012
On Sun, Apr 1, 2012 at 9:16 PM, Pierre <pierre at spotify.com> wrote:
> Only displays groups that haven't appeared yet..
> Previously 'pacman -Sg' iterated over syncs, printed every group.
>
> This change does not affect '-Sgg' which still orders by sync first.
>
> To reproduce, on a current Arch Linux with [extra] and [community]:
> $ pacman -Sg|sort|uniq -c|sort -n
> [...]
> 1 xorg-fonts
> 2 vim-plugins
> 2 xfce4-goodies
>
> Signed-off-by: Pierre <pierre at spotify.com>
Looks good to me. Thanks!
> ---
> src/pacman/sync.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/pacman/sync.c b/src/pacman/sync.c
> index d782a94..7d73cc4 100644
> --- a/src/pacman/sync.c
> +++ b/src/pacman/sync.c
> @@ -418,7 +418,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
>
> static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
> {
> - alpm_list_t *i, *j, *k;
> + alpm_list_t *i, *j, *k, *s = NULL;
>
> if(targets) {
> for(i = targets; i; i = alpm_list_next(i)) {
> @@ -454,10 +454,14 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
> }
> } else {
> /* print grp names only, no package names */
> - printf("%s\n", grp->name);
> + if(!alpm_list_find_str (s, grp->name)) {
> + s = alpm_list_add (s, grp->name);
> + printf("%s\n", grp->name);
> + }
> }
> }
> }
> + alpm_list_free(s);
> }
>
> return 0;
> --
> 1.7.9.5
>
>
More information about the pacman-dev
mailing list