summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/be_sync.c24
-rw-r--r--src/pacman/package.c44
2 files changed, 42 insertions, 26 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index c4032032..6af5aacd 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -296,6 +296,29 @@ cleanup:
static int sync_db_read(alpm_db_t *db, struct archive *archive,
struct archive_entry *entry, alpm_pkg_t **likely_pkg);
+static alpm_pkgvalidation_t _sync_get_validation(alpm_pkg_t *pkg)
+{
+ if(pkg->validation) {
+ return pkg->validation;
+ }
+
+ if(pkg->md5sum) {
+ pkg->validation |= ALPM_PKG_VALIDATION_MD5SUM;
+ }
+ if(pkg->sha256sum) {
+ pkg->validation |= ALPM_PKG_VALIDATION_SHA256SUM;
+ }
+ if(pkg->base64_sig) {
+ pkg->validation |= ALPM_PKG_VALIDATION_SIGNATURE;
+ }
+
+ if(!pkg->validation) {
+ pkg->validation |= ALPM_PKG_VALIDATION_NONE;
+ }
+
+ return pkg->validation;
+}
+
static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
const char **entry_filename, alpm_pkg_t *likely_pkg)
{
@@ -337,6 +360,7 @@ static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
pkg->origin = PKG_FROM_SYNCDB;
pkg->origin_data.db = db;
pkg->ops = &default_pkg_ops;
+ pkg->ops->get_validation = _sync_get_validation;
pkg->handle = db->handle;
/* add to the collection */
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 6e4901d1..6e091d58 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -109,25 +109,23 @@ 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"));
- }
- }
+ alpm_pkgvalidation_t v = alpm_pkg_get_validation(pkg);
+ if(v) {
+ if(v & ALPM_PKG_VALIDATION_NONE) {
+ validation = alpm_list_add(validation, _("None"));
} else {
- validation = alpm_list_add(validation, _("Unknown"));
+ 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) {
@@ -176,12 +174,8 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"));
}
- if(from == PKG_FROM_SYNCDB) {
- string_display(_("MD5 Sum :"), alpm_pkg_get_md5sum(pkg));
- string_display(_("SHA256 Sum :"), alpm_pkg_get_sha256sum(pkg));
- string_display(_("Signatures :"),
- alpm_pkg_get_base64_sig(pkg) ? _("Yes") : _("None"));
- }
+ list_display(_("Validated By :"), validation);
+
if(from == PKG_FROM_FILE) {
alpm_siglist_t siglist;
int err = alpm_pkg_check_pgp_signature(pkg, &siglist);
@@ -195,9 +189,7 @@ 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 */