util.c: extend --print-format with "%m"

Add md5sum as printable format string.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Jelle van der Waa 2022-09-16 12:35:53 +02:00 committed by Allan McRae
parent 6968f77026
commit e210634982
2 changed files with 8 additions and 6 deletions

View file

@ -237,12 +237,12 @@ Transaction Options (apply to '-S', '-R' and '-U')
Specify a printf-like format to control the output of the '\--print' Specify a printf-like format to control the output of the '\--print'
operation. The possible attributes are: "%a" for arch, "%b" for operation. The possible attributes are: "%a" for arch, "%b" for
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename, builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%n" for "%g" for base64 encoded PGP signature, "%h" for sha256sum, "%m" for
pkgname, "%p" for packager, "%v" for pkgver, "%l" for location, "%r" md5sum, "%n" for pkgname, "%p" for packager, "%v" for pkgver, "%l" for
for repository, "%s" for size, "%C" for checkdepends, "%D" for depends, location, "%r" for repository, "%s" for size, "%C" for checkdepends,
"%G" for groups, "%H" for conflicts, "%L" for licenses, "%M" for "%D" for depends, "%G" for groups, "%H" for conflicts, "%L" for
makedepends, "%O" for optional depends, "%P" for provides and "%R" for licenses, "%M" for makedepends, "%O" for optional depends, "%P" for
replaces. provides and "%R" for replaces.
Implies '\--print'. Implies '\--print'.

View file

@ -1223,6 +1223,8 @@ void print_packages(const alpm_list_t *packages)
VAL_FROM_FORMAT_STR(temp, "%p", alpm_pkg_get_packager) VAL_FROM_FORMAT_STR(temp, "%p", alpm_pkg_get_packager)
/* %v : pkgver */ /* %v : pkgver */
VAL_FROM_FORMAT_STR(temp, "%v", alpm_pkg_get_version) VAL_FROM_FORMAT_STR(temp, "%v", alpm_pkg_get_version)
/* %m : md5sum */
VAL_FROM_FORMAT_STR(temp, "%m", alpm_pkg_get_md5sum)
/* %l : location */ /* %l : location */
if(strstr(temp, "%l")) { if(strstr(temp, "%l")) {
char *pkgloc = pkg_get_location(pkg); char *pkgloc = pkg_get_location(pkg);