summaryrefslogtreecommitdiff
path: root/offload-build.in
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2020-03-01 22:47:03 +0100
committerLevente Polyak <anthraxx@archlinux.org>2020-03-09 23:27:03 +0100
commit5b1123e11f2b1de97196138ccfd63824955e30d8 (patch)
tree19301996fe0e2ddb03989206492e41a18ff3adf8 /offload-build.in
parenta0f79fcce0b58b4fb126a452a3a2b4414611c9c9 (diff)
downloaddevtools32-5b1123e11f2b1de97196138ccfd63824955e30d8.tar.xz
offload-build: retrieve the PKGBUILD in case makepkg changes it via pkgver
Building a package may change the PKGBUILD during update_pkgver. Let's retrieve the PKGBUILD after building to ensure we have the very same file as the one we used to build the package. Otherwise this may lead to the inability to distribute the package during commitpkg in case the expected and the actual hashsum mismatch.
Diffstat (limited to 'offload-build.in')
-rwxr-xr-xoffload-build.in12
1 files changed, 8 insertions, 4 deletions
diff --git a/offload-build.in b/offload-build.in
index 33c82a0..92f400c 100755
--- a/offload-build.in
+++ b/offload-build.in
@@ -81,12 +81,13 @@ fi
archbuild_cmd=("${repo}${archbuild_arch:+-$archbuild_arch}-build" "$@")
-trap 'rm -rf $SRCPKGDEST' EXIT INT TERM QUIT
+trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT
# Use a source-only tarball as an intermediate to transfer files. This
# guarantees the checksums are okay, and guarantees that all needed files are
# transferred, including local sources, install scripts, and changelogs.
-export SRCPKGDEST=$(mktemp -d)
+export TEMPDIR=$(mktemp -d --tmpdir offload-build.XXXXXXXXXX)
+export SRCPKGDEST=${TEMPDIR}
makepkg --source || die "unable to make source package"
# Temporary cosmetic workaround makepkg if SRCDEST is set somewhere else
@@ -114,14 +115,17 @@ mapfile -t files < <(
if [[ -f /usr/share/devtools/makepkg-'"${repo}"'-'"${arch}"'.conf ]]; then
makepkg_config="/usr/share/devtools/makepkg-'"${repo}"'-'"${arch}"'.conf"
fi &&
- makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist
+ makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
+ printf "%s\n" "${temp}/PKGBUILD"
')
if (( ${#files[@]} )); then
printf '%s\n' '' '-> copying files...'
load_makepkg_config
- scp "${files[@]/#/$server:}" "${PKGDEST:-${PWD}}/"
+ scp "${files[@]/#/$server:}" "${TEMPDIR}/"
+ mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/"
+ mv "${TEMPDIR}/PKGBUILD" "${PWD}/"
else
exit 1
fi