diff options
-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); |