Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorten Linderud <foxboron@archlinux.org>2021-12-25 15:01:15 +0100
committerLevente Polyak <anthraxx@archlinux.org>2022-01-26 21:31:21 +0100
commitec16d6e4bd127e5d8b930fe5428ed6fe502a045c (patch)
tree975ff9e19e6d2219134910df11c85cab0810affb
parentfa5afbc30b68912eb7f16d434a27faf787c3da9c (diff)
common: implement validity as a function
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--commitpkg.in9
-rw-r--r--lib/common.sh13
2 files changed, 14 insertions, 8 deletions
diff --git a/commitpkg.in b/commitpkg.in
index 9d1c3aa..465ef6b 100644
--- a/commitpkg.in
+++ b/commitpkg.in
@@ -93,14 +93,7 @@ for _arch in "${arch[@]}"; do
fullver=$(get_full_version "$_pkgname")
if pkgfile=$(find_cached_package "$_pkgname" "$fullver" "$_arch"); then
- if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then
- die "PACKAGER was not set when building package"
- fi
- hashsum=sha256sum
- pkgbuild_hash=$(awk -v"hashsum=$hashsum" -F' = ' '$1 == "pkgbuild_"hashsum {print $2}' <(bsdtar -xOqf "$pkgfile" .BUILDINFO))
- if [[ "$pkgbuild_hash" != "$($hashsum PKGBUILD|cut -d' ' -f1)" ]]; then
- die "PKGBUILD $hashsum mismatch: expected $pkgbuild_hash"
- fi
+ check_package_validity "$pkgfile"
fi
done
done
diff --git a/lib/common.sh b/lib/common.sh
index 0092a45..a3f2f26 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -189,3 +189,16 @@ find_cached_package() {
return 1
esac
}
+
+
+check_package_validity(){
+ local pkgfile=$1
+ if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then
+ die "PACKAGER was not set when building package"
+ fi
+ hashsum=sha256sum
+ pkgbuild_hash=$(awk -v"hashsum=$hashsum" -F' = ' '$1 == "pkgbuild_"hashsum {print $2}' <(bsdtar -xOqf "$pkgfile" .BUILDINFO))
+ if [[ "$pkgbuild_hash" != "$($hashsum PKGBUILD|cut -d' ' -f1)" ]]; then
+ die "PKGBUILD $hashsum mismatch: expected $pkgbuild_hash"
+ fi
+}