diff options
author | Jonathan Frazier <eyeswide@gmail.com> | 2013-08-04 19:37:16 -0400 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2013-08-05 18:22:09 -0400 |
commit | c860104cdeaf9329c176bfd53fcd2c8370009546 (patch) | |
tree | 5bd25cd038f5082fe27127b05feaf913ce3f0e6d | |
parent | 1a18f7816f03e2dcdc444aad8776a5d4a90bcafd (diff) | |
download | expac-c860104cdeaf9329c176bfd53fcd2c8370009546.tar.xz |
Add 'V' format for package validation methods.
-rw-r--r-- | README.pod | 2 | ||||
-rw-r--r-- | expac.c | 31 |
2 files changed, 32 insertions, 1 deletions
@@ -124,6 +124,8 @@ The format argument allows the following interpreted sequences: %h sha256sum + %V package validation method + %i has install scriptlet (only with -Q) %k download size (only with -S) @@ -38,7 +38,7 @@ #define DEFAULT_DELIM "\n" #define DEFAULT_LISTDELIM " " #define DEFAULT_TIMEFMT "%c" -#define FORMAT_TOKENS "BCDEGLMNOPRSabdhmnprsuvw%" +#define FORMAT_TOKENS "BCDEGLMNOPRSVabdhmnprsuvw%" #define SIZE_TOKENS "BKMGTPEZY\0" #ifndef PATH_MAX @@ -469,6 +469,32 @@ static alpm_list_t *get_modified_files(alpm_pkg_t *pkg) { return modified_files; } +static alpm_list_t *get_validation_method(alpm_pkg_t *pkg) { + alpm_list_t *validation = NULL; + + alpm_pkgvalidation_t v = alpm_pkg_get_validation(pkg); + + if(v == ALPM_PKG_VALIDATION_UNKNOWN) { + return alpm_list_add(validation, "Unknown"); + } + + if(v & ALPM_PKG_VALIDATION_NONE) { + return alpm_list_add(validation, "None"); + } + + if(v & ALPM_PKG_VALIDATION_MD5SUM) { + validation = alpm_list_add(validation, "MD5 Sum"); + } + if(v & ALPM_PKG_VALIDATION_SHA256SUM) { + validation = alpm_list_add(validation, "SHA256 Sum"); + } + if(v & ALPM_PKG_VALIDATION_SIGNATURE) { + validation = alpm_list_add(validation, "Signature"); + } + + return validation; +} + static int print_pkg(alpm_pkg_t *pkg, const char *format) { const char *f, *end; char fmt[64], buf[64]; @@ -587,6 +613,9 @@ static int print_pkg(alpm_pkg_t *pkg, const char *format) { case 'B': /* backup */ out += print_list(alpm_pkg_get_backup(pkg), alpm_backup_get_name, shortdeps); break; + case 'V': /* package validation */ + out += print_list(get_validation_method(pkg), NULL, false); + break; case 'M': /* modified */ { alpm_list_t *modified_files = get_modified_files(pkg); |