Sorry for the delay, I've been rather busy as of late.. Excerpts from Eli Schwartz's message of April 17, 2019 4:49:
Rather than heuristically match (md|sha)[[:digit:]]+sums or even .*sums, read makepkg's internal description of known hash algorithms, and use it to generate a search pattern. This ensures that we will always be in sync with the makepkg installed on the user's system.
Fixes support for the newly added b2sums algorithm.
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> ---
I really like the idea, but...
This depends on pacman from git master, because schema.sh does not exist in pacman 5.1.x
src/updpkgsums.sh.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/updpkgsums.sh.in b/src/updpkgsums.sh.in index 9c545ea..618f471 100644 --- a/src/updpkgsums.sh.in +++ b/src/updpkgsums.sh.in @@ -22,6 +22,11 @@ shopt -s extglob declare -r myname='updpkgsums' declare -r myver='@PACKAGE_VERSION@'
+LIBRARY=${LIBRARY:-'@datarootdir@/makepkg'}
... I don't really like using @datarootdir@ for this, since we don't necessarily know that pacman was installed to the same datarootdir that we will be installed to. Would be nicer if there was a libmakepkg.pc that pointed to the libmakepkg install dir, or at least its prefix, so we could query the system for the proper path..
+ +# Import libmakepkg +source "$LIBRARY"/util/schema.sh + usage() { printf "%s v%s\n" "${myname}" "${myver}" echo @@ -92,9 +97,10 @@ export BUILDDIR=$(mktemp -d "${TMPDIR:-/tmp}/updpkgsums.XXXXXX") newbuildfile=$(mktemp "${TMPDIR:-/tmp}/updpkgsums.XXXXXX")
trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT +sumtypes=$(IFS='|'; echo "${known_hash_algos[*]}") newsums=$(makepkg -g -p "$buildfile" "${MAKEPKG_OPTS[@]}") || die 'Failed to generate new checksums' -awk -v newsums="$newsums" ' - /^[[:blank:]]*(md|sha)[[:digit:]]+sums(_[^=]+)?=/,/\)[[:blank:]]*(#.*)?$/ { +awk -v sumtypes="$sumtypes" -v newsums="$newsums" ' + $0 ~"^[[:blank:]]*(" sumtypes ")sums(_[^=]+)?=", $0 ~ "\)[[:blank:]]*(#.*)?$" { if (!w) { print newsums w++ -- 2.21.0
-- Sincerely, Johannes Löthberg :: SA0DEM