[Frugalware-git] pacman-g2: Feedback from installed packages while searching

Miklos Vajna vmiklos at frugalware.org
Thu Nov 19 12:16:53 CET 2009


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=2b0ae9d902daf5999a03548f924fbb057c237166

commit 2b0ae9d902daf5999a03548f924fbb057c237166
Author: Laszlo Papp <djszapi2 at gmail.com>
Date:   Tue Nov 17 08:51:54 2009 +0100

Feedback from installed packages while searching

* To get feedback while searching instead of using another utility for
this purpose, whether the desired packages are installed.

* The real purpose of this patch to avoid separate option to use like '-Qs'

diff --git a/src/pacman-g2/sync.c b/src/pacman-g2/sync.c
index b001aa4..030253d 100644
--- a/src/pacman-g2/sync.c
+++ b/src/pacman-g2/sync.c
@@ -48,6 +48,8 @@
#include "sync.h"
#include "conf.h"

+extern PM_DB *db_local;
+
extern config_t *config;

extern list_t *pmc_syncs;
@@ -95,13 +97,22 @@ static int sync_search(list_t *syncs, list_t *targets)
}
for(lp = ret; lp; lp = pacman_list_next(lp)) {
PM_PKG *pkg = pacman_list_getdata(lp);
+			char *name = (char *)pacman_pkg_getinfo(pkg, PM_PKG_NAME);

char *group = (char *)pacman_list_getdata(pacman_pkg_getinfo(pkg,PM_PKG_GROUPS));
-			printf("%s/%s %s %s%s%s\n    ",
+			printf("%s/%s %s %s%s%s",
(char *)pacman_db_getinfo(db, PM_DB_TREENAME),
-					(char *)pacman_pkg_getinfo(pkg, PM_PKG_NAME),
+					name,
(char *)pacman_pkg_getinfo(pkg, PM_PKG_VERSION),
(group ? "(" : ""), (group ? group : ""), (group ? ")" : ""));
+
+			PM_PKG *ipkg = pacman_db_readpkg(db_local, name);
+			if (ipkg) {
+				char *iversion = (char*)pacman_pkg_getinfo(ipkg, PM_PKG_VERSION);
+				printf(" [%s: %s]", _("installed"), iversion);
+			}
+			printf("\n    ");
+
indentprint((char *)pacman_pkg_getinfo(pkg, PM_PKG_DESC), 4);
printf("\n");
}


More information about the Frugalware-git mailing list