From ae247cfa1d9ae8cea8f7fb5b599d4a56241ab77e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 20 Jun 2019 10:37:41 +0200 Subject: bin/build-packages: fixing sources should not happen in the try-to-fix-the-build loop --- bin/build-packages | 128 ++++++++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 66 deletions(-) (limited to 'bin/build-packages') diff --git a/bin/build-packages b/bin/build-packages index 1fd0904..fbd88dd 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -418,68 +418,6 @@ while [ "${count}" -ne 0 ] && \ echo 'preparing' > "${tmp_dir}/.ping-build-master" - if echo "${straw}" | \ - grep -qF ':mirrored_source:'; then - # maybe a missing source is/was the problem? - if makepkg --verifysource 2>/dev/null; then - # nope, sources are fine - continue - fi - # try to download them from sources.archlinux.org/sources/$repo/$source - source_name=$( - makepkg --printsrcinfo | \ - sed -n ' - /^\s*\(epoch\|pkg\(base\|ver\|rel\)\) = /{s|^\s\+||;p} - /^pkgname = /q - ' | \ - sed ' - s|^pkgbase = \(.*\)$|0 \1-| - s|^epoch = \(.*\)$|1 \1:| - s|^pkgver = \(.*\)$|2 \1-| - s|^pkgrel = \([^.]*\)\(\..*\)\?$|3 \1.src.tar.gz| - ' | \ - sort -k1n,1 | \ - sed ' - s|^[0-9] || - :a - N - s|\n[0-9] \(\S\+\)$|\1| - ta - ' - ) - if ! wget -q --timeout=15 -nc -nd "https://sources.archlinux.org/sources/${git_repo}/${source_name}"; then - # we can't improve anything - continue - fi - # shellcheck disable=SC2046 - tar -xz --overwrite \ - -f "${source_name}" \ - --exclude PKGBUILD \ - $( - if [ -n "${PKGBUILD_mod}" ]; then - git -C "${repo_paths__archlinux32}/${PKGBUILD_mod%/*}" archive "${mod_git_revision}" -- . | \ - tar -t | \ - sed 's/^/--exclude /' - fi - ) \ - --strip-components=1 \ - || true - fi - - if echo "${straw}" | \ - grep -qF ':mirrored_source_by_hash:'; then - # maybe a missing source is/was the problem? - if makepkg --verifysource 2>/dev/null; then - # nope, sources are fine - continue - fi - # download it from sources.archlinux32.org by its hash - if ! download_sources_by_hash; then - # we can't improve anything, if no source was downloadable - continue - fi - fi - outerParameters="-r ${archbuild_chroots}" if echo "${straw}" | \ grep -qF ':clean_chroot:'; then @@ -548,14 +486,15 @@ while [ "${count}" -ne 0 ] && \ echo 'checking-source' > "${tmp_dir}/.ping-build-master" success=false verifysource_trial=0 - while [ ${verifysource_trial} -lt 3 ]; do + while [ ${verifysource_trial} -lt 5 ]; do verifysource_trial=$((verifysource_trial + 1)) if CARCH="${arch}" makepkg --verifysource 2> "${tmp_dir}/verifysource.log"; then success=true break fi + + # receive specific missing keys if [ ${verifysource_trial} -eq 1 ]; then - # receive specific missing keys missing_keys=$( sed -n ' s/^.* FAILED (unknown public key \([0-9A-F]\{16\}\)).*$/0x\1/ @@ -570,9 +509,10 @@ while [ "${count}" -ne 0 ] && \ fi verifysource_trial=$((verifysource_trial + 1)) fi + + # download the repository key from github if [ ${verifysource_trial} -eq 2 ]; then if grep -q ' FAILED (unknown public key \([0-9A-F]\{16\}\))' -- "${tmp_dir}/verifysource.log"; then - # download the repository key from github # TODO: get the name of the key file from its finger print or # some other information inside the repository if makepkg --printsrcinfo | \ @@ -586,8 +526,64 @@ while [ "${count}" -ne 0 ] && \ continue fi fi + verifysource_trial=$((verifysource_trial + 1)) + fi + + # try to download source from sources.archlinux.org/sources/$repo/$source + if [ ${verifysource_trial} -eq 3 ]; then + if echo "${straw}" | \ + grep -qF ':mirrored_source:'; then + source_name=$( + makepkg --printsrcinfo | \ + sed -n ' + /^\s*\(epoch\|pkg\(base\|ver\|rel\)\) = /{s|^\s\+||;p} + /^pkgname = /q + ' | \ + sed ' + s|^pkgbase = \(.*\)$|0 \1-| + s|^epoch = \(.*\)$|1 \1:| + s|^pkgver = \(.*\)$|2 \1-| + s|^pkgrel = \([^.]*\)\(\..*\)\?$|3 \1.src.tar.gz| + ' | \ + sort -k1n,1 | \ + sed ' + s|^[0-9] || + :a + N + s|\n[0-9] \(\S\+\)$|\1| + ta + ' + ) + if wget -q --timeout=15 -nc -nd "https://sources.archlinux.org/sources/${git_repo}/${source_name}"; then + # shellcheck disable=SC2046 + tar -xz --overwrite \ + -f "${source_name}" \ + --exclude PKGBUILD \ + $( + if [ -n "${PKGBUILD_mod}" ]; then + git -C "${repo_paths__archlinux32}/${PKGBUILD_mod%/*}" archive "${mod_git_revision}" -- . | \ + tar -t | \ + sed 's/^/--exclude /' + fi + ) \ + --strip-components=1 \ + || true + continue + fi + fi + verifysource_trial=$((verifysource_trial + 1)) + fi + + # try to download source from sources.archlinux32.org by its hash + if [ ${verifysource_trial} -eq 4 ]; then + if echo "${straw}" | \ + grep -qF ':mirrored_source_by_hash:'; then + if download_sources_by_hash; then + continue + fi + fi + verifysource_trial=$((verifysource_trial + 1)) fi - break done rm "${tmp_dir}/verifysource.log" -- cgit v1.2.3-54-g00ecf