[pacman-dev] [PATCH] Put not explicitly installed packages in grey during update/install/removall

Allan McRae allan at archlinux.org
Sun Feb 2 06:28:16 EST 2014


On 02/02/14 07:41, Guillaume Bouchard wrote:
> In extended table view, packages which are not explicitly installed are
> displayed in grey. This helps understanding why
> packages are updated.
> 
> This helps the package managment workflow. During update, we can
> quickly have a look at why packages are updated and easilly track and
> remove the explicit packages which are not longer required. During
> remove, it shows all the explicit packages which are also removed by a
> cascade removal. During install, it provides a feedback on how your
> action will affect the database.
> 
> This patch created a new colstr setting and associate it with BOLDBLACK
> (i.e. grey).
> 

That colour cases the dependencies to stand out more on a terminal with
a white background.  I'd say bold would be better...

However, the colour coding really is unclear.  How do people come into
the knowledge of what it means?  For example, during an update I might
think that a new package being pulled in as a dependency so it is
highlighted.   Or is it entirely obvious and I am thinking too hard?

Allan

> Signed-off-by: Guillaume Bouchard <guillaum.bouchard at gmail.com>
> ---
>  src/pacman/conf.c |  1 +
>  src/pacman/conf.h |  1 +
>  src/pacman/util.c | 13 ++++++++++---
>  3 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/src/pacman/conf.c b/src/pacman/conf.c
> index 4b7ec05..243203f 100644
> --- a/src/pacman/conf.c
> +++ b/src/pacman/conf.c
> @@ -76,6 +76,7 @@ void enable_colors(int colors)
>  		colstr->warn    = BOLDYELLOW;
>  		colstr->err     = BOLDRED;
>  		colstr->nocolor = NOCOLOR;
> +		colstr->depend  = BOLDBLACK;
>  	}
>  }
>  
> diff --git a/src/pacman/conf.h b/src/pacman/conf.h
> index e8cac50..4af5eeb 100644
> --- a/src/pacman/conf.h
> +++ b/src/pacman/conf.h
> @@ -32,6 +32,7 @@ typedef struct __colstr_t {
>  	const char *warn;
>  	const char *err;
>  	const char *nocolor;
> +	const char *depend;
>  } colstr_t;
>  
>  typedef struct __config_t {
> diff --git a/src/pacman/util.c b/src/pacman/util.c
> index cbe371d..699d347 100644
> --- a/src/pacman/util.c
> +++ b/src/pacman/util.c
> @@ -57,7 +57,8 @@ enum {
>  	CELL_NORMAL = 0,
>  	CELL_TITLE = (1 << 0),
>  	CELL_RIGHT_ALIGN = (1 << 1),
> -	CELL_FREE = (1 << 3)
> +	CELL_FREE = (1 << 3),
> +	CELL_DEPEND = (1 << 4)
>  };
>  
>  int trans_init(alpm_transflag_t flags, int check_valid)
> @@ -488,7 +489,9 @@ static void table_print_line(const alpm_list_t *line, short col_padding,
>  
>  		if(cell->mode & CELL_TITLE) {
>  			printf("%s%*s%s", config->colstr.title, cell_width, str, config->colstr.nocolor);
> -		} else {
> +		} else if(cell->mode & CELL_DEPEND) {
> +			printf("%s%*s%s", config->colstr.depend, cell_width, str, config->colstr.nocolor);
> +	 } else {
>  			printf("%*s", cell_width, str);
>  		}
>  		need_padding = 1;
> @@ -808,7 +811,11 @@ static alpm_list_t *create_verbose_row(pm_target_t *target)
>  	} else {
>  		pm_asprintf(&str, "%s", alpm_pkg_get_name(target->remove));
>  	}
> -	add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE);
> +	if(alpm_pkg_get_reason(target->remove ? target->remove : target->install) == ALPM_PKG_REASON_DEPEND) {
> +		add_table_cell(&ret, str, CELL_DEPEND | CELL_FREE);
> +	} else {
> +		add_table_cell(&ret, str, CELL_NORMAL | CELL_FREE);
> +	}
>  
>  	/* old and new versions */
>  	pm_asprintf(&str, "%s",
> 



More information about the pacman-dev mailing list