[pacman-dev] [PATCH] Removed installed optional dependencies from post-installation listing

Allan McRae allan at archlinux.org
Fri Jul 12 23:41:44 EDT 2013


On 13/07/13 06:33, Drew DeVault wrote:
> Per feedback on prior patch. My only concern here is that I'm not
> particularly familiar with how localization works, and I don't know if
> my changes will affect that.
> 
> ---

Put comments like that below the "---" line here.  That means they will
not go in the final commit.

>  src/pacman/util.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/pacman/util.c b/src/pacman/util.c
> index 23c4009..ab94629 100644
> --- a/src/pacman/util.c
> +++ b/src/pacman/util.c
> @@ -1243,14 +1243,16 @@ void display_optdepends(alpm_pkg_t *pkg)
>  
>      optdeps = alpm_pkg_get_optdepends(pkg);
>  
> -    /* turn optdepends list into a text list */
> +    /* turn uninstalled optdepends list into a text list */
>      for(i = optdeps; i; i = alpm_list_next(i)) {
>          alpm_depend_t *optdep = i->data;
> -        optstrings = alpm_list_add(optstrings, make_optstring(optdep));
> +        if(alpm_db_get_pkg(alpm_get_localdb(config->handle),
> optdep->name) == 0) {
> +            optstrings = alpm_list_add(optstrings, make_optstring(optdep));
> +        }
>      }
>  
>      if(optstrings) {
> -        printf(_("Optional dependencies for %s\n"),
> alpm_pkg_get_name(pkg));
> +        printf(_("Remaining optional dependencies for %s:\n"),
> alpm_pkg_get_name(pkg));

I'd go for "Uninstalled optional ..."

>          unsigned short cols = getcols(fileno(stdout));
>          list_display_linebreak("   ", optstrings, cols);
>      }
> 

And...  this patch is a bit simple.   It results in installations that
are pending still being printed and it does not deal with new optdepends.

Adjust make_optstring to take the list of optdeps and return a list.
Then it needs to do the whole "turn optdepends list into a text list"
loop from display_optdepends and display_new_optdepends.  While making
the list, it skips both those packages that are installed and those that
will be installed at the end of the transaction  (instead of it
currently adding a status message).

This all assumes no-one speaks out against the idea.

Allan




More information about the pacman-dev mailing list