Added code that lists if an optional dependency of a package is installed locally and additonally prints the version number of the installed dependency. Patch for FS#13035 in the pacman bug tracker. --- src/pacman/util.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index 7f7f6a7..5c0d7f4 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -701,16 +701,31 @@ void list_display_linebreak(const char *title, const alpm_list_t *list, printf("%s\n", _("None")); } else { const alpm_list_t *i; + alpm_db_t *db_local = alpm_get_localdb(config->handle); + /* Print the first element */ - indentprint((const char *)list->data, len, maxcols); + char *pkgname = (char *)list->data; + alpm_pkg_t *lpkg = alpm_db_get_pkg(db_local, (const char *)pkgname); + indentprint((const char *)pkgname, len, maxcols); + + /* Print the version number if the package is installed locally */ + if(lpkg != NULL) { + printf(" [%s: %s]", _("installed"), alpm_pkg_get_version(lpkg)); + } printf("\n"); + /* Print the rest */ for(i = alpm_list_next(list); i; i = alpm_list_next(i)) { size_t j; for(j = 1; j <= len; j++) { printf(" "); } - indentprint((const char *)i->data, len, maxcols); + pkgname = (char *)i->data; + lpkg = alpm_db_get_pkg(db_local, (const char *)pkgname); + indentprint((const char *)pkgname, len, maxcols); + if(lpkg != NULL) { + printf(" [%s: %s]", _("installed"), alpm_pkg_get_version(lpkg)); + } printf("\n"); } } -- 1.7.12