From 5c404268d965d9ca012e4819ac0c2f289a4c768c Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 18 Feb 2012 16:31:37 +1000 Subject: Add information on how an installed package was validated When installing a package, store information on which validation method was used and output this on "pacman -Qi" operations. e.g. Validated By : SHA256 Sum Possible values are Unknown, None, MD5 Sum, SHA256 Sum, Signature. Dan: just a few very minor tweaks. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- src/pacman/package.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/pacman/package.c b/src/pacman/package.c index 54c035c3..6e4901d1 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -77,6 +77,7 @@ static void optdeplist_display(const char *title, void dump_pkg_full(alpm_pkg_t *pkg, int extra) { const char *reason; + alpm_list_t *validation = NULL; time_t bdate, idate; char bdatestr[50] = "", idatestr[50] = ""; const char *label; @@ -108,6 +109,27 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) break; } + if(from == PKG_FROM_LOCALDB) { + alpm_pkgvalidation_t v = alpm_pkg_get_validation(pkg); + if(v) { + if(v & ALPM_PKG_VALIDATION_NONE) { + validation = alpm_list_add(validation, _("None")); + } else { + 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")); + } + } + } else { + validation = alpm_list_add(validation, _("Unknown")); + } + } + if(extra || from == PKG_FROM_LOCALDB) { /* compute this here so we don't get a pause in the middle of output */ requiredby = alpm_pkg_compute_requiredby(pkg); @@ -173,6 +195,9 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) } alpm_siglist_cleanup(&siglist); } + if(from == PKG_FROM_LOCALDB) { + list_display(_("Validated By :"), validation); + } string_display(_("Description :"), alpm_pkg_get_desc(pkg)); /* Print additional package info if info flag passed more than once */ @@ -184,6 +209,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra) printf("\n"); FREELIST(requiredby); + alpm_list_free(validation); } static const char *get_backup_file_status(const char *root, -- cgit v1.2.3-24-g4f1b