[pacman-dev] [PATCH] Print the package arch using the %a format specifier.
Jonathan Sköld
arch at skold.dev
Mon Sep 20 18:33:25 UTC 2021
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