diff options
Diffstat (limited to 'bin/build-packages')
-rwxr-xr-x | bin/build-packages | 109 |
1 files changed, 79 insertions, 30 deletions
diff --git a/bin/build-packages b/bin/build-packages index 46c1ef1..de01478 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -78,6 +78,8 @@ usage() { >&2 echo ' compile from source tarbal from sources.archlinux.org if possible' >&2 echo ' :mirrored_source_by_hash:' >&2 echo ' download sources from sources.archlinux32.org by hash if possible' + >&2 echo ' :on_x86_64:' + >&2 echo ' build any package with x86_64 arch' >&2 echo ' :without_check:' >&2 echo ' run makepkg with "--no-check"' >&2 echo ' :without_systemd_nspawn:' @@ -249,7 +251,7 @@ while [ "${count}" -ne 0 ] && \ if [ -z "${forced_package}" ]; then package=$( # shellcheck disable=SC2029 - ssh \ + ssh -o PasswordAuthentication=No \ -i "${master_build_server_identity}" \ -p "${master_build_server_port}" \ "${master_build_server_user}@${master_build_server}" \ @@ -291,6 +293,9 @@ while [ "${count}" -ne 0 ] && \ package="${package% *}" if [ "${arch}" = 'any' ]; then arch="${my_arch}" + assignment_was_any=true + else + assignment_was_any=false fi if [ -n "${diff_source_dir}" ] && @@ -298,7 +303,7 @@ while [ "${count}" -ne 0 ] && \ >&2 echo 'The prefered package was not handed out.' >&2 echo 'Because -d was given, I will abort.' # shellcheck disable=SC2029 - ssh \ + ssh -o PasswordAuthentication=No \ -i "${master_build_server_identity}" \ -p "${master_build_server_port}" \ "${master_build_server_user}@${master_build_server}" \ @@ -309,9 +314,10 @@ while [ "${count}" -ne 0 ] && \ if [ "${git_revision##*-}" = 'HEAD' ]; then git_revision=$( repo_name="${git_revision%-*}" - eval repo_path='"${repo_paths__'"${repo_name}"'}"' - if [ -z "${repo_path}" ]; then - >&2 printf 'Unknown git repository "%s".\n' "${repo_name}" + eval l_repo_path='"${repo_paths__'"${repo_name}"'}"' + # shellcheck disable=SC2154 + if [ -z "${l_repo_path}" ]; then + >&2 printf 'Unknown git repository "%s".\n' "${l_repo_name}" exit 2 fi git -C "${repo_path}" rev-parse HEAD @@ -382,7 +388,7 @@ while [ "${count}" -ne 0 ] && \ ! apply_trunk_patch "${tmp_dir}" "${diff_source_dir}"; then # report local failure (probably a missing commit) to build-master # shellcheck disable=SC2029 - ssh \ + ssh -o PasswordAuthentication=No \ -i "${master_build_server_identity}" \ -p "${master_build_server_port}" \ "${master_build_server_user}@${master_build_server}" \ @@ -458,7 +464,7 @@ while [ "${count}" -ne 0 ] && \ >&2 echo 'The prefered package was not handed out.' >&2 echo 'Because straw :without_systemd_nspawn: is active, I will abort.' # shellcheck disable=SC2029 - ssh \ + ssh -o PasswordAuthentication=No \ -i "${master_build_server_identity}" \ -p "${master_build_server_port}" \ "${master_build_server_user}@${master_build_server}" \ @@ -484,6 +490,28 @@ while [ "${count}" -ne 0 ] && \ outerParameters="${innerParameters} -fcrs --asdeps --noconfirm --holdver" middleParameters='' innerParameters='' + elif echo "${straw}" | \ + grep -qF ':on_x86_64:'; then + if [ -z "${prefered_package}" ]; then + >&2 echo 'straw :on_x86_64: only allowed with -p' + exit 2 + fi + if [ "${prefered_package}" != "${package}" ]; then + >&2 echo 'The prefered package was not handed out.' + >&2 echo 'Because straw :on_x86_64: is active, I will abort.' + # shellcheck disable=SC2029 + ssh -o PasswordAuthentication=No \ + -i "${master_build_server_identity}" \ + -p "${master_build_server_port}" \ + "${master_build_server_user}@${master_build_server}" \ + 'return-assignment' 'ABORT' + exit 2 + fi + if ! ${assignment_was_any}; then + >&2 printf 'Can only build "any" packages with :on_x86_64:, but got a "%s" package.\n' "${arch}" + exit 2 + fi + build_command='staging-x86_64-build' else build_command='staging-'"${arch}"'-build' fi @@ -650,14 +678,15 @@ while [ "${count}" -ne 0 ] && \ t s/^See ['"'"'`]\([^'"'"'`]\+\)['"'"'`]\(\s.*\)\?$/\1/ t + s/^A full log can be found at\s\+\(\S\+\)\s*$/\1/ + t d ' "${log_file}" | \ while read -r extra_log_file; do - grep -HF '' "${build_dir}/${extra_log_file}" || true - if [ -n "${extra_log_file##*/*}" ]; then + if ! grep -HF '' "${build_dir}/${extra_log_file}"; then find "${build_dir}" \ - -xdev -mindepth 2 \ - -type f -name "${extra_log_file}" \ + -xdev \ + -type f -name "${extra_log_file##*/}" \ -exec grep -HF '' {} + \ || true fi @@ -677,8 +706,20 @@ while [ "${count}" -ne 0 ] && \ # machine, if need arises in the future). Note, that it is no # error, if the above build command already produced a # compressed package. - find . -maxdepth 1 -type f -name '*.pkg.tar' \ - -execdir zstd --rm -T0 --ultra -20 '{}' -o '{}.zst' \; + # Since --ultra -20 seems too much for our i486 build vms, we + # silently fall back to lower compression levels if the higher + # level fails. + + # beware: We must remove *.pkg.tar.zst after failed + # compression attempts, otherwise future compression attempts + # will refuse to overwrite them. + + # shellcheck disable=SC2086 + for options in '-T0 --ultra -20' '--ultra -20' $(seq -19 -3); do + find . -maxdepth 1 -type f -name '*.pkg.tar' \ + -not -execdir zstd --rm ${options} '{}' -o '{}.zst' \; \ + -exec rm -f '{}.zst' \; + done # package files, that still exist, threw an error upon compression errors=$( find . -maxdepth 1 -type f -name '*.pkg.tar' @@ -697,15 +738,15 @@ while [ "${count}" -ne 0 ] && \ # compressing successful echo 'post-build' > "${tmp_dir}/.ping-build-master" >&2 printf ' ok.\n' - if [ "${build_command}" = 'makepkg' ]; then - find . -maxdepth 1 -type f -name '*.pkg.tar.zst' \ - -exec sh -c 'namcap "$1" > "$1-namcap.log"' '_' '{}' \; - else - find . -maxdepth 1 -type f -name '*.pkg.tar-namcap.log' \ - | while read -r file; do - mv "${file}" "${file%-namcap.log}.zst-namcap.log" - done - fi + find . -maxdepth 1 -type f -name '*.pkg.tar.zst' \ + -exec sh -c ' + pkg="${1%.pkg.tar.zst}" + if [ -f "${pkg}.pkg.tar-namcap.log" ]; then + mv "${pkg}.pkg.tar-namcap.log" "${pkg}.pkg.tar.zst-namcap.log" + elif [ ! -f "${pkg}.pkg.tar.zst-namcap.log" ]; then + namcap "$1" > "${pkg}.pkg.tar.zst-namcap.log" + fi + ' '_' '{}' \; tar_content_dir=$(mktemp -d "${tmp_dir}/tar-content.XXXXXX") # remove unexpected packages if [ -n "${expected_packages}" ]; then @@ -716,11 +757,19 @@ while [ "${count}" -ne 0 ] && \ } | \ sort | \ uniq -u | \ - while read -r unexpected_package; do - >&2 printf 'removing unexpected build artifact "%s"\n' \ - "${unexpected_package}" - rm "${unexpected_package}"* - done + { + removed_something_unexpected=false + while read -r unexpected_package; do + >&2 printf 'removing unexpected build artifact "%s"\n' \ + "${unexpected_package}" + rm "${unexpected_package}"* + removed_something_unexpected=true + done + if "${removed_something_unexpected}"; then + >&2 printf 'I was only expecting:\n%s\n' \ + "${expected_packages}" + fi + } fi >&2 printf 'signing package(s)\n' find . -maxdepth 1 -type f -name '*.pkg.tar.zst' \ @@ -1001,7 +1050,7 @@ while [ "${count}" -ne 0 ] && \ while ${upload_to_build_master}; do err=0 # shellcheck disable=SC2029 - ssh \ + ssh -o PasswordAuthentication=No \ -i "${master_build_server_identity}" \ -p "${master_build_server_port}" \ "${master_build_server_user}@${master_build_server}" \ @@ -1050,7 +1099,7 @@ while [ "${count}" -ne 0 ] && \ if ${upload_to_build_master}; then printf '%s@%s\n' \ "$(whoami)" \ - "$(hostname)" >> \ + "$(uname -n)" >> \ "${log}" gzip "${log}" else @@ -1064,7 +1113,7 @@ while [ "${count}" -ne 0 ] && \ while true; do err=0 # shellcheck disable=SC2029 - ssh \ + ssh -o PasswordAuthentication=No \ -i "${master_build_server_identity}" \ -p "${master_build_server_port}" \ "${master_build_server_user}@${master_build_server}" \ |