From 78dd15099684615e98d20dfaa2b9fbe5ca3f6e6b Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Fri, 5 Jan 2024 01:07:39 +0100 Subject: chore(offload-build): deprecate in favor of pkgctl build --offload Emit a warning when offload-build is invoked to warn about future removal. Signed-off-by: Levente Polyak --- src/offload-build.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/offload-build.in') diff --git a/src/offload-build.in b/src/offload-build.in index 027bad3..0aa2e38 100644 --- a/src/offload-build.in +++ b/src/offload-build.in @@ -8,6 +8,11 @@ source /usr/share/makepkg/util/config.sh +# Deprecation warning +if [[ -z $_DEVTOOLS_COMMAND ]]; then + colorize + warning "${0##*/} is deprecated and will be removed. Use 'pkgctl build --offload' instead" +fi # global defaults suitable for use by Arch staff repo=extra -- cgit v1.2.3-54-g00ecf From d210079037d34fd32fc9a84e490655204bae103a Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Tue, 9 Jan 2024 00:39:43 +0100 Subject: feat(util): add library function to generate source packages --- src/lib/util/makepkg.sh | 35 +++++++++++++++++++++++++++++++++++ src/offload-build.in | 11 +++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 src/lib/util/makepkg.sh (limited to 'src/offload-build.in') diff --git a/src/lib/util/makepkg.sh b/src/lib/util/makepkg.sh new file mode 100644 index 0000000..adb3af6 --- /dev/null +++ b/src/lib/util/makepkg.sh @@ -0,0 +1,35 @@ +#!/hint/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +[[ -z ${DEVTOOLS_INCLUDE_UTIL_MAKEPKG_SH:-} ]] || return 0 +DEVTOOLS_INCLUDE_UTIL_MAKEPKG_SH=1 + +_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/srcinfo.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/srcinfo.sh + + +set -e + +makepkg_source_package() { + if (( EUID != 0 )); then + [[ -z ${WORKDIR:-} ]] && setup_workdir + export WORKDIR DEVTOOLS_INCLUDE_COMMON_SH + fakeroot -- bash -$- -c "source '${BASH_SOURCE[0]}' && ${FUNCNAME[0]}" + return + fi + ( + export LIBMAKEPKG_LINT_PKGBUILD_SH=1 + lint_pkgbuild() { :; } + + export LIBMAKEPKG_SRCINFO_SH=1 + write_srcinfo() { print_srcinfo; } + + set +e -- -F --source + # shellcheck source=/usr/bin/makepkg + source "$(command -v makepkg)" + ) +} diff --git a/src/offload-build.in b/src/offload-build.in index 0aa2e38..5238129 100644 --- a/src/offload-build.in +++ b/src/offload-build.in @@ -6,11 +6,16 @@ # # 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 - colorize warning "${0##*/} is deprecated and will be removed. Use 'pkgctl build --offload' instead" fi @@ -19,8 +24,6 @@ repo=extra arch=x86_64 server=build.archlinux.org -die() { printf "error: $1\n" "${@:2}"; exit 1; } - usage() { cat <<- _EOF_ Usage: ${BASH_SOURCE[0]##*/} [--repo REPO] [--arch ARCHITECTURE] [--server SERVER] -- [ARCHBUILD_ARGS] @@ -84,7 +87,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. -- cgit v1.2.3-54-g00ecf From 0469d3c902d7b27dd56400e1fb229f47b011c4dc Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 8 Feb 2024 21:29:55 +0100 Subject: fix(build): avoid trying to download none existing debug packages Since last release, offload building now has proper error handling enabled. This unfortunately lead to a regression for packages, like any packages, where makepkg claims debug packages are available during --packagelist while none were actually built. This leads to the scp command failing when trying to download the none existing packages which ultimately leads to a termination of the build script. Fix this by filtering out package files that do not exist before trying to download them. Fixes #208 Component: pkgctl build Signed-off-by: Levente Polyak --- src/offload-build.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/offload-build.in') diff --git a/src/offload-build.in b/src/offload-build.in index 5238129..0c497b9 100644 --- a/src/offload-build.in +++ b/src/offload-build.in @@ -114,7 +114,9 @@ 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" ') -- cgit v1.2.3-54-g00ecf From db2f82bf19a4eed48a4a315cd308c3c1747d0e73 Mon Sep 17 00:00:00 2001 From: Christian Heusel Date: Sun, 11 Feb 2024 00:32:41 +0100 Subject: feat(offload-build): preserve the TERM variable Signed-off-by: Christian Heusel --- src/offload-build.in | 1 + 1 file changed, 1 insertion(+) (limited to 'src/offload-build.in') diff --git a/src/offload-build.in b/src/offload-build.in index 0c497b9..8992c23 100644 --- a/src/offload-build.in +++ b/src/offload-build.in @@ -99,6 +99,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") && -- cgit v1.2.3-54-g00ecf From 39eaeaa4b2e021ec44cc63c70493f9c9ef0c8ba4 Mon Sep 17 00:00:00 2001 From: Orhun Parmaksız Date: Mon, 7 Aug 2023 14:29:30 +0300 Subject: feat(offload-build): use rsync instead of scp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit simply replaces the usage of `scp` with `rsync` for faster file transfer. Signed-off-by: Orhun Parmaksız --- src/offload-build.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/offload-build.in') diff --git a/src/offload-build.in b/src/offload-build.in index 8992c23..7a8c1fd 100644 --- a/src/offload-build.in +++ b/src/offload-build.in @@ -23,6 +23,7 @@ fi repo=extra arch=x86_64 server=build.archlinux.org +rsyncopts=(-e ssh -c -h -L --progress --partial -y) usage() { cat <<- _EOF_ @@ -124,7 +125,7 @@ mapfile -t files < <( 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 -- cgit v1.2.3-54-g00ecf