Verified Commit 80275d21 authored by Eli Schwartz's avatar Eli Schwartz Committed by Daniel M. Capella
Browse files

updpkgsums: don't try to add nonexistent checksums



In the event there are no sources, there won't be sums either. awk won't
find any to remove and replace inline, so it tries to print "" at the
end of the file, and merely adds superfluous newlines.

Abort early instead, since updpkgsums cannot be expected to process such
a file.
Signed-off-by: Eli Schwartz's avatarEli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Daniel M. Capella's avatarDaniel M. Capella <polyzen@archlinux.org>
parent b6258216
......@@ -99,6 +99,11 @@ 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'
if [[ -z $newsums ]]; then
die "$buildfile does not contain sources to update"
fi
awk -v sumtypes="$sumtypes" -v newsums="$newsums" '
$0 ~"^[[:blank:]]*(" sumtypes ")sums(_[^=]+)?=", $0 ~ "\\)[[:blank:]]*(#.*)?$" {
if (!w) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment