summaryrefslogtreecommitdiff
path: root/bin/get-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-01-19 16:12:41 +0100
committerErich Eckner <git@eckner.net>2018-01-19 16:12:41 +0100
commitc5b511e13df7a2c325cdc3f83eded38b3c15aa73 (patch)
tree556e36f38c5334703598e2df9e3c51f7c7861487 /bin/get-assignment
parentfdce669fca9dc0440280f360a7b3a5d10993b00f (diff)
downloadbuilder-c5b511e13df7a2c325cdc3f83eded38b3c15aa73.tar.xz
bin/get-assignment: mark assignment as handed out to slave in mysql database
Diffstat (limited to 'bin/get-assignment')
-rwxr-xr-xbin/get-assignment27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index f1199cc..a81a54d 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -50,6 +50,33 @@ hand_out_assignment() {
} | \
sort -u | \
sponge "${work_dir}/package-states/$1.$2.$3.$4.locked"
+ ${mysql_command} -e "$(
+ # shellcheck disable=SC2016
+ printf 'UPDATE `build_slaves`'
+ # shellcheck disable=SC2016
+ printf ' SET `currently_building` = ('
+ # shellcheck disable=SC2016
+ printf ' SELECT `build_assignments`.`id`'
+ # shellcheck disable=SC2016
+ printf ' FROM `build_assignments`'
+ # shellcheck disable=SC2016
+ printf ' JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id`'
+ # shellcheck disable=SC2016
+ printf ' JOIN `upstream_repositories` ON `package_sources`.`upstream_package_repository`=`upstream_repositories`.`id`'
+ printf ' WHERE'
+ # shellcheck disable=SC2016
+ printf ' `package_sources`.`%s` = from_base64("%s") AND' \
+ 'pkgbase' "$(printf '%s' "$1" | base64 -w0)" \
+ 'git_revision' "$(printf '%s' "$2" | base64 -w0)" \
+ 'mod_git_revision' "$(printf '%s' "$3" | base64 -w0)"
+ # shellcheck disable=SC2016
+ printf ' `upstream_repositories`.`name` = from_base64("%s")' \
+ "$(printf '%s' "$4" | base64 -w0)"
+ printf ')'
+ # shellcheck disable=SC2016
+ printf ' WHERE `build_slaves`.`name`=from_base64("%s");' \
+ "$(printf '%s' "${slave}" | base64 -w0)"
+ )"
# lock every loop this package breaks
find "${work_dir}/build-list.loops" -maxdepth 1 -regextype grep \