summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.pod2
-rw-r--r--expac.c31
2 files changed, 32 insertions, 1 deletions
diff --git a/README.pod b/README.pod
index 423ee7b..8e51329 100644
--- a/README.pod
+++ b/README.pod
@@ -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)
diff --git a/expac.c b/expac.c
index eba37bd..fcb0909 100644
--- a/expac.c
+++ b/expac.c
@@ -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);