FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 08-11-2012, 11:52 AM
Allan McRae
 
Default Display optdep install status in package query output

On 11/08/12 21:48, Allan McRae wrote:
> Indicate which optional dependencies are installed when viewing
> local package information (-Qi).
>
> Signed-off-by: Allan McRae <allan@archlinux.org>
> ---
>
> Example output:
>
>> ./src/pacman/pacman -Qi git
> Name : git
> ...
> Optional Deps : tk: gitk and git gui [installed]
> perl-libwww: git svn
> perl-term-readkey: git svn
> perl-mime-tools: git send-email
> perl-net-smtp-ssl: git send-email TLS support
> perl-authen-sasl: git send-email TLS support
> python2: various helper scripts [installed]
> subversion: git svn [installed]
> cvsps: git cvsimport
>
>
> src/pacman/package.c | 21 +++++++++++++++------
> 1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/src/pacman/package.c b/src/pacman/package.c
> index 77d58e1..3556a81 100644
> --- a/src/pacman/package.c
> +++ b/src/pacman/package.c
> @@ -33,6 +33,7 @@
> #include "package.h"
> #include "util.h"
> #include "conf.h"
> +#include "db.h"

Obviously no need for that include. Removed on my working branch.

> #define CLBUF_SIZE 4096
>
> @@ -54,15 +55,22 @@ static void deplist_display(const char *title,
> /** Turn a optdepends list into a text list.
> * @param optdeps a list with items of type alpm_depend_t
> */
> -static void optdeplist_display(const char *title,
> - alpm_list_t *optdeps, unsigned short cols)
> +static void optdeplist_display(alpm_pkg_t *pkg, unsigned short cols)
> {
> alpm_list_t *i, *text = NULL;
> - for(i = optdeps; i; i = alpm_list_next(i)) {
> + for(i = alpm_pkg_get_optdepends(pkg); i; i = alpm_list_next(i)) {
> alpm_depend_t *optdep = i->data;
> - text = alpm_list_add(text, alpm_dep_compute_string(optdep));
> + char *depstring = alpm_dep_compute_string(optdep);
> + if(alpm_pkg_get_origin(pkg) == ALPM_PKG_FROM_LOCALDB) {
> + if(alpm_db_get_pkg(alpm_get_localdb(config->handle), optdep->name)) {
> + const char *installed = _(" [installed]");
> + depstring = realloc(depstring, strlen(depstring) + strlen(installed) + 1);
> + strcpy(depstring + strlen(depstring), installed);
> + }
> + }
> + text = alpm_list_add(text, depstring);
> }
> - list_display_linebreak(title, text, cols);
> + list_display_linebreak(_("Optional Deps :"), text, cols);
> FREELIST(text);
> }
>
> @@ -148,7 +156,8 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
> list_display(_("Groups :"), alpm_pkg_get_groups(pkg), cols);
> deplist_display(_("Provides :"), alpm_pkg_get_provides(pkg), cols);
> deplist_display(_("Depends On :"), alpm_pkg_get_depends(pkg), cols);
> - optdeplist_display(_("Optional Deps :"), alpm_pkg_get_optdepends(pkg), cols);
> + optdeplist_display(pkg, cols);
> +
> if(extra || from == ALPM_PKG_FROM_LOCALDB) {
> list_display(_("Required By :"), requiredby, cols);
> }
>
 

Thread Tools




All times are GMT. The time now is 03:53 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org