[pacman-dev] [PATCH] Introduce -Qlq

Dan McGee dpmcgee at gmail.com
Mon May 11 22:40:56 EDT 2009


On Sun, May 10, 2009 at 3:04 PM, Nagy Gabor <ngaba at bibl.u-szeged.hu> wrote:
> >From 054eae27537989dee76a06fac882fb38702144d5 Mon Sep 17 00:00:00 2001
> From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
> Date: Sun, 10 May 2009 22:41:29 +0200
> Subject: [PATCH] Introduce -Qlq
>
> With --quiet flag, -Ql doesn't print the package name only lists files.
> I made --quiet documentation up-to-date (I also added -Sgq/-Qgq).
>
> Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>

Thanks! I like this, and thanks for updating the docs.

One small point- does anyone see a good reason to keep the version
information on a -Qo operation? It is the only user of the quiet flag
that prints it, and it would be more consistent to not show it. I'm
going to go ahead and change that.

> ---
>  doc/pacman.8.txt     |   18 ++++++++++++------
>  src/pacman/package.c |    8 ++++++--
>  src/pacman/package.h |    2 +-
>  src/pacman/query.c   |    2 +-
>  4 files changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
> index 95880a2..cc3d396 100644
> --- a/doc/pacman.8.txt
> +++ b/doc/pacman.8.txt
> @@ -204,9 +204,13 @@ Query Options[[QO]]
>        This is useful in combination with '\--info' and '\--list'.
>
>  *-q, \--quiet*::
> -       Show less information for certain query operations. Search will only show
> -       package names and not version, group, and description information; a bare
> -       query will only show package names rather than names and versions.
> +       Show less information for certain query operations. (This is useful when
> +       pacman's output is processed in a script.) Search will only show package
> +       names and not version, group, and description information; owns will
> +       only show package names and versions instead of "file is owned by pkg"
> +       messages; group will only show package names and omit group names; list
> +       will only show files and omit package names; a bare query will only
> +       show package names rather than names and versions.
>
>  *-s, \--search* <'regexp'>::
>        This will search each locally-installed package for names or
> @@ -284,9 +288,11 @@ linkman:pacman.conf[5].
>        downloaded at a later time, using a program like wget.
>
>  *-q, \--quiet*::
> -       Show less information for certain sync operations. Search will only show
> -       package names and not version, group, and description information; list
> -       will only show package names and omit databases and versions.
> +       Show less information for certain sync operations. (This is useful when
> +       pacman's output is processed in a script.) Search will only show package
> +       names and not repo, version, group, and description information; list
> +       will only show package names and omit databases and versions; group will
> +       only show package names and omit group names.
>
>  *-s, \--search* <'regexp'>::
>        This will search each package in the sync databases for names or
> diff --git a/src/pacman/package.c b/src/pacman/package.c
> index b23c577..da2feb5 100644
> --- a/src/pacman/package.c
> +++ b/src/pacman/package.c
> @@ -205,7 +205,7 @@ void dump_pkg_backups(pmpkg_t *pkg)
>
>  /* List all files contained in a package
>  */
> -void dump_pkg_files(pmpkg_t *pkg)
> +void dump_pkg_files(pmpkg_t *pkg, int quiet)
>  {
>        const char *pkgname, *root, *filestr;
>        alpm_list_t *i, *pkgfiles;
> @@ -216,7 +216,11 @@ void dump_pkg_files(pmpkg_t *pkg)
>
>        for(i = pkgfiles; i; i = alpm_list_next(i)) {
>                filestr = alpm_list_getdata(i);
> -               fprintf(stdout, "%s %s%s\n", pkgname, root, filestr);
> +               if(!quiet){
> +                       fprintf(stdout, "%s %s%s\n", pkgname, root, filestr);
> +               } else {
> +                       fprintf(stdout, "%s%s\n", root, filestr);
> +               }
>        }
>
>        fflush(stdout);
> diff --git a/src/pacman/package.h b/src/pacman/package.h
> index 14bc7d6..aede2a1 100644
> --- a/src/pacman/package.h
> +++ b/src/pacman/package.h
> @@ -25,7 +25,7 @@ void dump_pkg_full(pmpkg_t *pkg, int level);
>  void dump_pkg_sync(pmpkg_t *pkg, const char *treename);
>
>  void dump_pkg_backups(pmpkg_t *pkg);
> -void dump_pkg_files(pmpkg_t *pkg);
> +void dump_pkg_files(pmpkg_t *pkg, int quiet);
>  void dump_pkg_changelog(pmpkg_t *pkg);
>
>  #endif /* _PM_PACKAGE_H */
> diff --git a/src/pacman/query.c b/src/pacman/query.c
> index 2cb86a9..0b8406d 100644
> --- a/src/pacman/query.c
> +++ b/src/pacman/query.c
> @@ -320,7 +320,7 @@ static void display(pmpkg_t *pkg)
>                }
>        }
>        if(config->op_q_list) {
> -               dump_pkg_files(pkg);
> +               dump_pkg_files(pkg, config->quiet);
>        }
>        if(config->op_q_changelog) {
>                dump_pkg_changelog(pkg);
> --
> 1.6.0.3
>
>
>
>
>
> _______________________________________________
> pacman-dev mailing list
> pacman-dev at archlinux.org
> http://www.archlinux.org/mailman/listinfo/pacman-dev
>


More information about the pacman-dev mailing list