[PATCH] Resubmission: Print the package arch using the %a format specifier.

Jonathan Sköld arch at skold.dev
Tue Sep 21 18:05:26 UTC 2021


This is a resubmission of this patch, since my email got DMARC'ed the first time around.
That should hopefully be fixed now and I apologise to anyone who received this email twice.

Adds the %a format specifier to allow printing of the package arch when using --print-format.

Signed-off-by: Jonathan Sköld <arch at skold.dev>
---
 src/pacman/util.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/pacman/util.c b/src/pacman/util.c
index 5486e7a5..bb57e950 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1146,6 +1146,12 @@ void print_packages(const alpm_list_t *packages)
 		alpm_pkg_t *pkg = i->data;
 		char *string = strdup(config->print_format);
 		char *temp = string;
+		/* %a : pkgarch */
+		if(strstr(temp, "%a")) {
+			string = strreplace(temp, "%a", alpm_pkg_get_arch(pkg));
+			free(temp);
+			temp = string;
+		}
 		/* %n : pkgname */
 		if(strstr(temp, "%n")) {
 			string = strreplace(temp, "%n", alpm_pkg_get_name(pkg));
-- 
2.33.0



More information about the pacman-dev mailing list