From ad267ce6efe34f218490c41ef92e02c1f44efeea Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 12 Sep 2018 16:36:29 +0200 Subject: bin/build-packages: transmit arch to return-assignment, so that build-assignment can be better verified --- bin/build-packages | 11 +++++++++-- bin/return-assignment | 21 +++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/build-packages b/bin/build-packages index 982a908..ecf98e7 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -683,7 +683,7 @@ while [ "${count}" -ne 0 ] && \ -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}" "${sub_pkgrel}" \ + 'return-assignment' "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" "${arch}" "${sub_pkgrel}" \ < 'package.tar' || \ err=$? case ${err} in @@ -707,6 +707,10 @@ while [ "${count}" -ne 0 ] && \ >&2 echo "'return-assignment' reports too many or missing packages." exit 1 ;; + 5) + >&2 echo "'return-assignment' was called with wrong arguments." + exit 1 + ;; *) >&2 echo "unknown return code ${err} from 'return-assignment'" wait_some_time 60 @@ -739,7 +743,7 @@ while [ "${count}" -ne 0 ] && \ -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}" 'ERROR' \ + 'return-assignment' "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" "${arch}" 'ERROR' \ < 'build-logs.gz.tar' || \ err=$? case ${err} in @@ -755,6 +759,9 @@ while [ "${count}" -ne 0 ] && \ >&2 echo 'I was too slow, the package is outdated. I will continue ...' break ;; + 4) + >&2 echo '"return-assignment" was called with wrong arguments.' + ;; *) >&2 echo "unknown return code ${err} from 'return-assignment'" wait_some_time 60 diff --git a/bin/return-assignment b/bin/return-assignment index 3f355bd..a9605b1 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -41,14 +41,14 @@ if [ $# -eq 1 ] && \ exit fi -if [ $# -ne 5 ]; then +if [ $# -ne 6 ]; then >&2 printf 'return-assignment: Wrong number of arguments (%s)\n' \ "$#" >&2 printf 'call either:\n' >&2 printf ' return-assignment ABORT\n' - >&2 printf ' return-assignment pkgbase git_revision mod_git_revision repository ERROR\n' - >&2 printf ' return-assignment pkgbase git_revision mod_git_revision repository sub-pkgrel\n' - exit 2 + >&2 printf ' return-assignment pkgbase git_revision mod_git_revision repository arch ERROR\n' + >&2 printf ' return-assignment pkgbase git_revision mod_git_revision repository arch sub-pkgrel\n' + exit 5 fi # Create a lock file and a trap. @@ -71,7 +71,7 @@ clean_up_lock_file() { trap clean_up_lock_file EXIT -if [ "$5" = 'ERROR' ]; then +if [ "$6" = 'ERROR' ]; then # the build failed on the build slave # shellcheck disable=SC2016 @@ -83,6 +83,7 @@ if [ "$5" = 'ERROR' ]; then mysql_join_package_sources_upstream_repositories mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories + mysql_join_build_assignments_architectures printf ' WHERE `build_slaves`.`id`=from_base64("%s")' \ "$( # shellcheck disable=SC2154 @@ -95,6 +96,8 @@ if [ "$5" = 'ERROR' ]; then 'mod_git_revision' "$(printf '%s' "$3" | base64 -w0)" printf ' AND `upstream_repositories`.`name`=from_base64("%s")' \ "$(printf '%s' "$4" | base64 -w0)" + printf ' AND `architectures`.`name`=from_base64("%s")' \ + "$(printf '%s' "$5" | base64 -w0)" printf ' AND `binary_packages_in_repositories`.`repository`=%s;\n' \ "${repository_ids__any_build_list}" } | \ @@ -276,6 +279,7 @@ build_assignment_id=$( mysql_join_package_sources_upstream_repositories mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories + mysql_join_build_assignments_architectures printf ' WHERE `build_slaves`.`id`=from_base64("%s")' \ "$( # shellcheck disable=SC2154 @@ -300,11 +304,16 @@ build_assignment_id=$( printf '%s' "$4" | \ base64 -w0 )" + printf ' AND `architectures`.`name`=from_base64("%s")' \ + "$( + printf '%s' "$5" | \ + base64 -w0 + )" printf ' AND `binary_packages_in_repositories`.`repository`=%s' \ "${repository_ids__any_build_list}" printf ' AND `binary_packages`.`sub_pkgrel`=from_base64("%s");\n' \ "$( - printf '%s' "$5" | \ + printf '%s' "$6" | \ base64 -w0 )" } | \ -- cgit v1.2.3-54-g00ecf