summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-08-12 03:15:15 +0200
committerDan McGee <dan@archlinux.org>2011-08-15 19:11:55 +0200
commitebb2e36cc4c40d11689a44a2503df40fa96e8fc1 (patch)
treeaa75da8cd9fc082b7b5278ed783bb8ff98f818f9 /lib/libalpm/package.c
parent31f2e0cba3281660a2a3ffc6f902a7019cb4699b (diff)
downloadpacman-ebb2e36cc4c40d11689a44a2503df40fa96e8fc1.tar.gz
pacman-ebb2e36cc4c40d11689a44a2503df40fa96e8fc1.tar.xz
Load and allow access to sha256sum
This adds a field in the package struct for this checksum type as well as allowing access via the API to it. The frontend is now able to display any read value. Note that this does not implement any use or verification of the value internally. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index e5136c77..a1bcb7a1 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -92,6 +92,7 @@ static time_t _pkg_get_builddate(alpm_pkg_t *pkg) { return pkg->builddate
static time_t _pkg_get_installdate(alpm_pkg_t *pkg) { return pkg->installdate; }
static const char *_pkg_get_packager(alpm_pkg_t *pkg) { return pkg->packager; }
static const char *_pkg_get_md5sum(alpm_pkg_t *pkg) { return pkg->md5sum; }
+static const char *_pkg_get_sha256sum(alpm_pkg_t *pkg) { return pkg->sha256sum; }
static const char *_pkg_get_arch(alpm_pkg_t *pkg) { return pkg->arch; }
static off_t _pkg_get_size(alpm_pkg_t *pkg) { return pkg->size; }
static off_t _pkg_get_isize(alpm_pkg_t *pkg) { return pkg->isize; }
@@ -139,6 +140,7 @@ struct pkg_operations default_pkg_ops = {
.get_installdate = _pkg_get_installdate,
.get_packager = _pkg_get_packager,
.get_md5sum = _pkg_get_md5sum,
+ .get_sha256sum = _pkg_get_sha256sum,
.get_arch = _pkg_get_arch,
.get_size = _pkg_get_size,
.get_isize = _pkg_get_isize,
@@ -229,6 +231,13 @@ const char SYMEXPORT *alpm_pkg_get_md5sum(alpm_pkg_t *pkg)
return pkg->ops->get_md5sum(pkg);
}
+const char SYMEXPORT *alpm_pkg_get_sha256sum(alpm_pkg_t *pkg)
+{
+ ASSERT(pkg != NULL, return NULL);
+ pkg->handle->pm_errno = 0;
+ return pkg->ops->get_sha256sum(pkg);
+}
+
const char SYMEXPORT *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg)
{
ASSERT(pkg != NULL, return NULL);
@@ -483,6 +492,7 @@ alpm_pkg_t *_alpm_pkg_dup(alpm_pkg_t *pkg)
newpkg->installdate = pkg->installdate;
STRDUP(newpkg->packager, pkg->packager, goto cleanup);
STRDUP(newpkg->md5sum, pkg->md5sum, goto cleanup);
+ STRDUP(newpkg->sha256sum, pkg->md5sum, goto cleanup);
STRDUP(newpkg->arch, pkg->arch, goto cleanup);
newpkg->size = pkg->size;
newpkg->isize = pkg->isize;
@@ -548,6 +558,7 @@ void _alpm_pkg_free(alpm_pkg_t *pkg)
FREE(pkg->url);
FREE(pkg->packager);
FREE(pkg->md5sum);
+ FREE(pkg->sha256sum);
FREE(pkg->base64_sig);
FREE(pkg->arch);
FREELIST(pkg->licenses);