summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-05-30 16:03:54 +0200
committerErich Eckner <git@eckner.net>2017-05-31 08:44:23 +0200
commit3ac9afc8b8539a096fb43ef58c8b364461690c83 (patch)
tree09bc0d6a2261671f7e7d9847629e24f4fc123085
parent52a7ca3d04df689df8c414fa57bcac7770d01338 (diff)
downloadbuilder-3ac9afc8b8539a096fb43ef58c8b364461690c83.tar.xz
bin/build-packages: download mirrored source from sources.archlinux.org if available
-rwxr-xr-xbin/build-packages93
1 files changed, 54 insertions, 39 deletions
diff --git a/bin/build-packages b/bin/build-packages
index 4ec11ee..1788f8b 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -136,47 +136,62 @@ while [ ${count} -ne 0 ]; do
cd "${PKGBUILD%/*}"
apply_package_customizations
success=false
- for parameters in '' '-c'; do
- rm -f *.pkg.tar.xz{,.sig}
- if staging-i686-build ${parameters}; then
- # build successful
- ls -1 *.pkg.tar.xz | \
- xargs -rn1 gpg --local-user="${package_key}" --detach-sign
- tar -cf 'package.tar' *.pkg.tar.xz{,.sig}
- while true; do
- err=0
- ssh \
- -i "${master_build_server_identity}" \
- -p "${master_build_server_port}" \
- "${master_build_server_user}@${master_build_server}" \
- 'return-assignment' "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" \
- < 'package.tar' || \
- err=$?
- case ${err} in
- 0)
- # upload successful
- break
- ;;
- 1)
- # 'return-assignment' was running already
- sleep $[15+$RANDOM%30]
- ;;
- 2)
- >&2 echo 'I was too slow, the package is outdated. I will continue ...'
- break
- ;;
- 3)
- >& echo "'return-assignment' reports a signature error."
- exit 1
- ;;
- *)
- >&2 echo "unknown return code ${err} from 'return-assignment'"
- exit 1
- esac
- done
- success=true
+ for mirrored_source in 'no' 'yes'; do
+ for parameters in '' '-c'; do
+ rm -f *.pkg.tar.xz{,.sig}
+ if staging-i686-build ${parameters}; then
+ # build successful
+ ls -1 *.pkg.tar.xz | \
+ xargs -rn1 gpg --local-user="${package_key}" --detach-sign
+ tar -cf 'package.tar' *.pkg.tar.xz{,.sig}
+ while true; do
+ err=0
+ ssh \
+ -i "${master_build_server_identity}" \
+ -p "${master_build_server_port}" \
+ "${master_build_server_user}@${master_build_server}" \
+ 'return-assignment' "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" \
+ < 'package.tar' || \
+ err=$?
+ case ${err} in
+ 0)
+ # upload successful
+ break
+ ;;
+ 1)
+ # 'return-assignment' was running already
+ sleep $[15+$RANDOM%30]
+ ;;
+ 2)
+ >&2 echo 'I was too slow, the package is outdated. I will continue ...'
+ break
+ ;;
+ 3)
+ >& echo "'return-assignment' reports a signature error."
+ exit 1
+ ;;
+ *)
+ >&2 echo "unknown return code ${err} from 'return-assignment'"
+ exit 1
+ esac
+ done
+ success=true
+ break
+ fi
+ done
+ if ${success}; then
break
fi
+ # maybe a missing source is/was the problem?
+ # try to download them from sources.archlinux.org/sources/$repo/$source
+ tmp_file="$(mktemp)"
+ mksrcinfo -o "${tmp_file}"
+ git_repo="$(find_git_repository_to_package_repository "${repository}")"
+ sed -n '/\s*source = /{s|^\s*source = ||;s|::.*$||;s|^.*/||;p}' "${tmp_file}" | \
+ while read -r source_file; do
+ wget -nc -nd "https://sources.archlinux.org/sources/${git_repo}/${source_file}" || true
+ done
+ rm -f "${tmp_file}"
done
if ! ${success}; then