From 06ff767c12b46a69af6839bfebac7d3c6c492389 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 7 Jun 2018 15:23:26 +0200 Subject: bin/return-assignment: some style updates --- bin/return-assignment | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/bin/return-assignment b/bin/return-assignment index 3dee115..e8e998e 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -240,9 +240,9 @@ clean_up_lock_file() { } # shellcheck disable=SC2016 -infos=$( +build_assignment_id=$( { - printf 'SELECT DISTINCT `build_assignments`.`id`,`upstream_repositories`.`id` FROM `build_slaves`' + printf 'SELECT DISTINCT `build_assignments`.`id` FROM `build_slaves`' mysql_join_build_slaves_build_assignments mysql_join_build_assignments_package_sources mysql_join_package_sources_upstream_repositories @@ -255,28 +255,40 @@ infos=$( base64 -w0 )" printf ' AND `package_sources`.`%s`=from_base64("%s")' \ - 'pkgbase' "$(printf '%s' "$1" | base64 -w0)" \ - 'git_revision' "$(printf '%s' "$2" | base64 -w0)" \ - 'mod_git_revision' "$(printf '%s' "$3" | base64 -w0)" + 'pkgbase' "$( + printf '%s' "$1" | \ + base64 -w0 + )" \ + 'git_revision' "$( + printf '%s' "$2" | \ + base64 -w0 + )" \ + 'mod_git_revision' "$( + printf '%s' "$3" | \ + base64 -w0 + )" printf ' AND `upstream_repositories`.`name`=from_base64("%s")' \ - "$(printf '%s' "$4" | base64 -w0)" + "$( + printf '%s' "$4" | \ + 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" | base64 -w0)" + "$( + printf '%s' "$5" | \ + base64 -w0 + )" } | \ mysql_run_query | \ tr '\t' ' ' ) -if [ -z "${infos}" ]; then +if [ -z "${build_assignment_id}" ]; then >&2 echo 'Sorry, the sent package is outdated.' exit 2 fi -build_assignment_id="${infos%% *}" -upstream_repository_id="${infos##* }" - clean_up_tmp_dir() { cd "${base_dir}" rm -rf --one-file-system "${tmp_dir}" @@ -458,13 +470,16 @@ fi infos=$( { printf 'SELECT `t`.`id`,`t`.`name`' - printf ' FROM `repository_moves`' + printf ' FROM `build_assignments`' + mysql_join_build_assignments_package_sources + mysql_join_package_sources_upstream_repositories + mysql_join_upstream_repositories_repository_moves printf ' JOIN `repositories` as `t` ON `t`.`id`=`repository_moves`.`to_repository`' printf ' WHERE `repository_moves`.`from_repository`=%s' \ "${repository_ids__any_build_list}" - printf ' AND `repository_moves`.`upstream_package_repository`=from_base64("%s");\n' \ + printf ' AND `build_assignments`.`id`=from_base64("%s");\n' \ "$( - printf '%s' "${upstream_repository_id}" | \ + printf '%s' "${build_assignment_id}" | \ base64 -w0 )" } | \ -- cgit v1.2.3-70-g09d2