Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2024-01-03 16:21:40 +0100
committerLevente Polyak <anthraxx@archlinux.org>2024-01-10 00:14:20 +0100
commite413b65df3dcddeb94da2defb53ab17ef2a8558d (patch)
tree65ff9759733ab37d82c0315b80affcaa8683324a /src
parentef04960b98595de8f9405d0069324b6b1fddb5ba (diff)
fix(build): re-source the PKGBUILD to update changed values
During certain operations like --edit, --pkgver etc the PKGBUILD may change since last sourced. If a modified checksum of the PKGBUILD is detected, re-source it before processing. Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/lib/build/build.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/build/build.sh b/src/lib/build/build.sh
index a19dd37..5276653 100644
--- a/src/lib/build/build.sh
+++ b/src/lib/build/build.sh
@@ -134,7 +134,7 @@ pkgctl_build() {
local WORKER_SLOT=
# variables
- local _arch path pkgbase pkgrepo source
+ local _arch path pkgbase pkgrepo source pkgbuild_checksum
while (( $# )); do
case $1 in
@@ -311,6 +311,7 @@ pkgctl_build() {
. ./PKGBUILD
pkgbase=${pkgbase:-$pkgname}
pkgrepo=${REPO}
+ pkgbuild_checksum=$(b2sum PKGBUILD | awk '{print $1}')
msg "Building ${pkgbase}"
# auto-detection of build target
@@ -412,6 +413,12 @@ pkgctl_build() {
updpkgsums
fi
+ # re-source the PKGBUILD if it changed
+ if [[ ${pkgbuild_checksum} != "$(b2sum PKGBUILD | awk '{print $1}')" ]]; then
+ # shellcheck source=contrib/makepkg/PKGBUILD.proto
+ . ./PKGBUILD
+ fi
+
# execute build
for arch in "${BUILD_ARCH[@]}"; do
if [[ -n $arch ]]; then