libxbps: ABI/API break due to hash function changes

This commit is contained in:
Duncan Overbruck
2020-02-10 01:54:52 +01:00
parent aa4d726dca
commit 0d90534236
18 changed files with 141 additions and 118 deletions

View File

@@ -55,7 +55,8 @@ struct xentry {
TAILQ_ENTRY(xentry) entries;
uint64_t mtime;
uint64_t size;
char *file, *type, *target, *hash;
char *file, *type, *target;
char sha256[XBPS_SHA256_SIZE];
ino_t inode;
};
@@ -317,6 +318,7 @@ ftw_cb(const char *fpath, const struct stat *sb, const struct dirent *dir UNUSED
xbps_dictionary_t fileinfo = NULL;
const char *filep = NULL;
char *buf, *p, *p2, *dname;
char sha256[XBPS_SHA256_SIZE];
ssize_t r;
/* Ignore metadata files generated by xbps-src and destdir */
@@ -480,12 +482,9 @@ ftw_cb(const char *fpath, const struct stat *sb, const struct dirent *dir UNUSED
}
assert(xe->type);
if ((p = xbps_file_hash(fpath)) == NULL)
die("failed to process hash for %s:", fpath);
xbps_dictionary_set_cstring(fileinfo, "sha256", p);
free(p);
if ((xe->hash = xbps_file_hash(fpath)) == NULL)
if (!xbps_file_sha256(xe->sha256, sizeof sha256, fpath))
die("failed to process hash for %s:", fpath);
xbps_dictionary_set_cstring(fileinfo, "sha256", xe->sha256);
xbps_dictionary_set_uint64(fileinfo, "inode", sb->st_ino);
xe->inode = sb->st_ino;
@@ -607,8 +606,8 @@ process_xentry(const char *key, const char *mutable_files)
xbps_dictionary_set_cstring(d, "file", p);
if (xe->target)
xbps_dictionary_set_cstring(d, "target", xe->target);
if (xe->hash)
xbps_dictionary_set_cstring(d, "sha256", xe->hash);
if (*xe->sha256)
xbps_dictionary_set_cstring(d, "sha256", xe->sha256);
if (xe->mtime)
xbps_dictionary_set_uint64(d, "mtime", xe->mtime);
if (xe->size)