Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/offload-build.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/offload-build.in')
-rw-r--r--src/offload-build.in22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/offload-build.in b/src/offload-build.in
index 027bad3..7a8c1fd 100644
--- a/src/offload-build.in
+++ b/src/offload-build.in
@@ -6,15 +6,24 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
+_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
+# shellcheck source=src/lib/common.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
+# shellcheck source=src/lib/util/makepkg.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/makepkg.sh
+
source /usr/share/makepkg/util/config.sh
+# Deprecation warning
+if [[ -z $_DEVTOOLS_COMMAND ]]; then
+ warning "${0##*/} is deprecated and will be removed. Use 'pkgctl build --offload' instead"
+fi
# global defaults suitable for use by Arch staff
repo=extra
arch=x86_64
server=build.archlinux.org
-
-die() { printf "error: $1\n" "${@:2}"; exit 1; }
+rsyncopts=(-e ssh -c -h -L --progress --partial -y)
usage() {
cat <<- _EOF_
@@ -79,7 +88,7 @@ load_makepkg_config
# transferred, including local sources, install scripts, and changelogs.
export TEMPDIR=$(mktemp -d --tmpdir offload-build.XXXXXXXXXX)
export SRCPKGDEST=${TEMPDIR}
-makepkg --source || die "unable to make source package"
+makepkg_source_package || die "unable to make source package"
# Temporary cosmetic workaround makepkg if SRCDEST is set somewhere else
# but an empty src dir is created in PWD. Remove once fixed in makepkg.
@@ -91,6 +100,7 @@ mapfile -t files < <(
# shellcheck disable=SC2145
cat "$SRCPKGDEST"/*"$SRCEXT" |
ssh $server '
+ export TERM="'"${TERM}"'"
temp="${XDG_CACHE_HOME:-$HOME/.cache}/offload-build" &&
mkdir -p "$temp" &&
temp=$(mktemp -d -p "$temp") &&
@@ -106,14 +116,16 @@ mapfile -t files < <(
if [[ -f /usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf ]]; then
makepkg_config="/usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf"
fi &&
- makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
+ while read -r file; do
+ [[ -f "${file}" ]] && printf "%s\n" "${file}" ||:
+ done < <(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...'
- scp "${files[@]/#/$server:}" "${TEMPDIR}/"
+ rsync "${rsyncopts[@]}" "${files[@]/#/$server:}" "${TEMPDIR}/" || die
mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/"
mv "${TEMPDIR}/PKGBUILD" "${PWD}/"
else