index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | src/lib/common.sh | 8 | ||||
-rw-r--r-- | src/offload-build.in | 16 |
diff --git a/src/lib/common.sh b/src/lib/common.sh index 7d04c25..641dea5 100644 --- a/src/lib/common.sh +++ b/src/lib/common.sh @@ -354,6 +354,14 @@ is_debug_package() { [[ ${pkgdesc} == "Detached debugging symbols for "* && ${pkgbase}-debug = "${pkgname}" ]] } +# Proxy function to check if a file exists. Using [[ -f ... ]] directly is not +# always wanted because we might want to expand bash globs first. This way we +# can pass unquoted globs to is_globfile() and have them expanded as function +# arguments before being checked. +is_globfile() { + [[ -f $1 ]] +} + join_by() { local IFS="$1" shift diff --git a/src/offload-build.in b/src/offload-build.in index b272a74..f231ed1 100644 --- a/src/offload-build.in +++ b/src/offload-build.in @@ -107,6 +107,7 @@ mapfile -t files < <( cd "$temp" && { bsdtar --strip-components 1 -xvf - && + export LOGDEST="" && script -qefc "'"${archbuild_cmd[@]@Q}"'" /dev/null && printf "%s\n" "" "-> build complete" && printf "\t%s\n" "$temp"/* @@ -120,14 +121,25 @@ mapfile -t files < <( [[ -f "${file}" ]] && printf "%s\n" "${file}" ||: done < <(makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist) && printf "%s\n" "${temp}/PKGBUILD" + + find "${temp}" -name "*.log" ') if (( ${#files[@]} )); then - printf '%s\n' '' '-> copying files...' + msg 'Downloading files...' rsync "${rsyncopts[@]}" "${files[@]/#/$server:}" "${TEMPDIR}/" || die - mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/" + + if is_globfile "${TEMPDIR}"/*.log; then + mv "${TEMPDIR}"/*.log "${LOGDEST:-${PWD}}/" + fi + # missing PKGBUILD download means the build failed + if [[ ! -f "${TEMPDIR}/PKGBUILD" ]]; then + error "Build failed, check logs in ${LOGDEST:-${PWD}}" + exit 1 + fi mv "${TEMPDIR}/PKGBUILD" "${PWD}/" + mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/" else exit 1 fi |