From 6924d3996cd9b22e0ff81b4c53e0aedc64997a16 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Jul 2023 10:32:11 +0200 Subject: extract_source_directory: trying to handle upstream-packages curl error --- lib/common-functions | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/common-functions b/lib/common-functions index b1a39e3..58b1080 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -464,14 +464,23 @@ extract_source_directory() { local mod_revision="$4" local output="$5" local sub_pkgrel="$6" - + local res + local tmptarfile + local pkgtarfile if [ -n "${revision}" ] \ && [ "${revision}" != '0000000000000000000000000000000000000000' ]; then local pkgbase_translated pkgbase_translated=$(gitlab_project_name_to_path "${pkgbase}") - curl -LSs "https://buildmaster.archlinux32.org/upstream-packages/${pkgbase_translated}-${revision}.tar.gz" \ - | tar -xz --strip-components=1 -C "${output}" -- "${pkgbase_translated}-${revision}" + tmptarfile=$(mktemp 'tmp.upstream-package.XXXXXXXXXX') + pkgtarfile="${tmp_dir}/${tmptarfile}" + curl -o "$pkgtarfile" -fLSs "https://buildmaster.archlinux32.org/upstream-packages/${pkgbase_translated}-${revision}.tar.gz" + res=$? + if [ "$res" -ne 0 ]; then + >&2 echo 'Download upstream-package from upstream via buildmaster cache failed. Curl exit code was $res.' + return 1 + fi + tar -xz -f "${pkgtarfile}" --strip-components=1 -C "${output}" -- "${pkgbase_translated}-${revision}" printf '\n' >> \ "${output}/PKGBUILD" fi -- cgit v1.2.3-70-g09d2