[pacman-dev] [PATCH v2] Indicate ignored packages in -Qu output

Allan McRae allan at archlinux.org
Tue Oct 15 00:56:14 EDT 2013


Add "[ignored]" in the "pacman -Qu" output after packages that have their
upgrades ignored.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

v2: check IgnoreGroup too.

 src/pacman/query.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/pacman/query.c b/src/pacman/query.c
index bd50b05..77e783c 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -317,13 +317,33 @@ static int display(alpm_pkg_t *pkg)
 	if(!config->op_q_info && !config->op_q_list
 			&& !config->op_q_changelog && !config->op_q_check) {
 		if(!config->quiet) {
+			const char *pkgname = alpm_pkg_get_name(pkg);
 			const colstr_t *colstr = &config->colstr;
-			printf("%s%s %s%s%s", colstr->title, alpm_pkg_get_name(pkg),
+
+			printf("%s%s %s%s%s", colstr->title, pkgname,
 					colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
 
 			if(config->op_q_upgrade) {
 				alpm_pkg_t *newpkg = alpm_sync_newversion(pkg, alpm_get_syncdbs(config->handle));
+				int ignored = 0;
+
 				printf(" -> %s%s%s", colstr->version, alpm_pkg_get_version(newpkg), colstr->nocolor);
+
+				/* check if package or package group is ignored */
+				if(alpm_list_find_str(alpm_option_get_ignorepkgs(config->handle), pkgname)) {
+					ignored = 1;
+				} else {
+					const alpm_list_t *g;
+					for(g = alpm_pkg_get_groups(pkg); g; g = g->next) {
+						if(alpm_list_find_str(alpm_option_get_ignoregroups(config->handle), g->data)) {
+							ignored = 1;
+						}
+					}
+				}
+
+				if(ignored == 1) {
+					printf(" %s", _("[ignored]"));
+				}
 			}
 
 			printf("\n");
-- 
1.8.4



More information about the pacman-dev mailing list