diff options
author | Allan McRae <allan@archlinux.org> | 2012-02-20 15:02:38 +1000 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-03-08 18:00:05 -0600 |
commit | f34864cc9e4e755f2add7581419f4ec1c2525fe0 (patch) | |
tree | c88fcd3ea6910c5bbb7290bb4f58adfd9336a465 /lib/libalpm | |
parent | 4773c6b66ef618f4c6345a99d9c246045e9c723b (diff) | |
download | pacman-f34864cc9e4e755f2add7581419f4ec1c2525fe0.tar.xz |
Simplify package validation info output for sync packages
Unify the output for local and sync packages by only printing a
list of possible validation types for sync packages. This also
has the advantage of not printing the very long sha256 checksum
which line wrapped on a standard width terminal.
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/be_sync.c | 24 |
1 files changed, 24 insertions, 0 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 */ |