[pacman-dev] [PATCH] pactree: removed 'provision' from linear output

Allan McRae allan at archlinux.org
Mon Feb 3 23:22:02 EST 2014


On 03/02/14 21:53, Pierre Neidhardt wrote:
> Linear output is especially useful when piped to other commands, e.g.
> 
>   $ pacman -Qi $(pactree -l pacman) >/dev/null
> 

I think we should change this to a useful command.  How about:

$ pactree -lu pacman | pacman -Qqkk -


I'll make the adjustment as I pull.

> The above command would previously show errors on packages with provisions.
> 
> Signed-off-by: Pierre Neidhardt <ambrevar at gmail.com>
> ---
>  src/util/pactree.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/util/pactree.c b/src/util/pactree.c
> index 4192999..6c620aa 100644
> --- a/src/util/pactree.c
> +++ b/src/util/pactree.c
> @@ -363,10 +363,13 @@ static void print_text(const char *pkg, const char *provision,
>  	}
>  
>  	/* print tip */
> +	/* If style->provides is empty (e.g. when using linear style), we do not
> +	 * want to print the provided package. This makes output easier to parse and
> +	 * to reuse. */
>  	if(!pkg && provision) {
>  		printf("%s%s%s%s [unresolvable]%s\n", tip, color->leaf1,
>  				provision, color->branch1, color->off);
> -	} else if(provision && strcmp(pkg, provision) != 0) {
> +	} else if(provision && strcmp(pkg, provision) != 0 && *(style->provides) != '\0') {
>  		printf("%s%s%s%s%s %s%s%s\n", tip, color->leaf1, pkg,
>  				color->leaf2, style->provides, color->leaf1, provision,
>  				color->off);
> 



More information about the pacman-dev mailing list