[pacman-dev] [PATCH v2 2/2] Add [ignored] to -Qu output for packages in repos that are not Usage = Upgrade

Allan McRae allan at archlinux.org
Thu Jan 10 03:59:21 UTC 2019

List all available updates in -Qu output, but include [ignored] beside
those that will not be updated in a -Su operation due to thier repo Usage
value (in addition to those that are Ignored).

Fixes FS#59854.

The following people provided initial patches to print [ignored] on -Qu
operations, which highlighted a larger problem to be fixed first:

With-thanks-to: morganamilo <morganamilo at gmail.com>
With-thanks-to: Michael Straube <michael.straube at posteo.de>

Signed-off-by: Allan McRae <allan at archlinux.org>
 src/pacman/query.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/pacman/query.c b/src/pacman/query.c
index 9ac6e930..3e728257 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -325,10 +325,14 @@ static int display(alpm_pkg_t *pkg)
 					colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
 			if(config->op_q_upgrade) {
+				int usage;
 				alpm_pkg_t *newpkg = alpm_sync_get_new_version(pkg, alpm_get_syncdbs(config->handle));
+				alpm_db_t *db = alpm_pkg_get_db(newpkg);
+				alpm_db_get_usage(db, &usage);
 				printf(" -> %s%s%s", colstr->version, alpm_pkg_get_version(newpkg), colstr->nocolor);
-				if(alpm_pkg_should_ignore(config->handle, pkg)) {
+				if(alpm_pkg_should_ignore(config->handle, pkg) || !(usage & ALPM_DB_USAGE_UPGRADE)) {
 					printf(" %s", _("[ignored]"));

More information about the pacman-dev mailing list