repo-add: add sha256sum values to repo database
Implements FS#23103. Also modify libalpm so it ignores this value without any warning as we know it is likely to exist. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
93591d428f
commit
a31d091fb3
2 changed files with 12 additions and 5 deletions
|
@ -418,6 +418,9 @@ static int sync_db_read(pmdb_t *db, struct archive *archive,
|
||||||
pkg->isize = atol(line);
|
pkg->isize = atol(line);
|
||||||
} else if(strcmp(line, "%MD5SUM%") == 0) {
|
} else if(strcmp(line, "%MD5SUM%") == 0) {
|
||||||
READ_AND_STORE(pkg->md5sum);
|
READ_AND_STORE(pkg->md5sum);
|
||||||
|
} else if(strcmp(line, "%SHA256SUM%") == 0) {
|
||||||
|
/* we don't do anything with this value right now */
|
||||||
|
READ_NEXT(line);
|
||||||
} else if(strcmp(line, "%REPLACES%") == 0) {
|
} else if(strcmp(line, "%REPLACES%") == 0) {
|
||||||
READ_AND_STORE_ALL(pkg->replaces);
|
READ_AND_STORE_ALL(pkg->replaces);
|
||||||
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
} else if(strcmp(line, "%DEPENDS%") == 0) {
|
||||||
|
|
|
@ -263,9 +263,6 @@ db_write_entry()
|
||||||
|
|
||||||
IFS=$OLDIFS
|
IFS=$OLDIFS
|
||||||
|
|
||||||
# get md5sum and compressed size of package
|
|
||||||
md5sum="$(openssl dgst -md5 "$pkgfile")"
|
|
||||||
md5sum="${md5sum##* }"
|
|
||||||
csize=$(@SIZECMD@ "$pkgfile")
|
csize=$(@SIZECMD@ "$pkgfile")
|
||||||
|
|
||||||
# ensure $pkgname and $pkgver variables were found
|
# ensure $pkgname and $pkgver variables were found
|
||||||
|
@ -287,6 +284,13 @@ db_write_entry()
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# compute checksums
|
||||||
|
msg2 "$(gettext "Computing checksums...")"
|
||||||
|
md5sum="$(openssl dgst -md5 "$pkgfile")"
|
||||||
|
md5sum="${md5sum##* }"
|
||||||
|
sha256sum="$(openssl dgst -sha256 "$pkgfile")"
|
||||||
|
sha256sum="${sha256sum##* }"
|
||||||
|
|
||||||
# remove an existing entry if it exists, ignore failures
|
# remove an existing entry if it exists, ignore failures
|
||||||
db_remove_entry "$pkgname"
|
db_remove_entry "$pkgname"
|
||||||
|
|
||||||
|
@ -308,9 +312,9 @@ db_write_entry()
|
||||||
[[ -n $csize ]] && echo -e "%CSIZE%\n$csize\n" >>desc
|
[[ -n $csize ]] && echo -e "%CSIZE%\n$csize\n" >>desc
|
||||||
[[ -n $size ]] && echo -e "%ISIZE%\n$size\n" >>desc
|
[[ -n $size ]] && echo -e "%ISIZE%\n$size\n" >>desc
|
||||||
|
|
||||||
# compute checksums
|
# add checksums
|
||||||
msg2 "$(gettext "Computing md5 checksums...")"
|
|
||||||
echo -e "%MD5SUM%\n$md5sum\n" >>desc
|
echo -e "%MD5SUM%\n$md5sum\n" >>desc
|
||||||
|
echo -e "%SHA256SUM%\n$sha256sum\n" >>desc
|
||||||
|
|
||||||
# add base64'd PGP signature
|
# add base64'd PGP signature
|
||||||
if [[ -f $startdir/$pkgfile.sig ]]; then
|
if [[ -f $startdir/$pkgfile.sig ]]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue