[pacman-contrib] [PATCH] updpkgsums: don't try to add nonexistent checksums
Eli Schwartz
eschwartz at archlinux.org
Fri May 21 04:16:41 UTC 2021
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 <eschwartz at archlinux.org>
---
src/updpkgsums.sh.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/updpkgsums.sh.in b/src/updpkgsums.sh.in
index 41965f5..e5dbd2b 100644
--- a/src/updpkgsums.sh.in
+++ b/src/updpkgsums.sh.in
@@ -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) {
--
2.31.1
More information about the pacman-contrib
mailing list