summaryrefslogtreecommitdiff
path: root/bin/return-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-01-18 09:19:26 +0100
committerErich Eckner <git@eckner.net>2019-01-18 09:19:26 +0100
commit7bb3c79c9c5ae4775793bb85e6540802ab400b1e (patch)
tree9254c42b46ad006871bd8690c36192ec314fbfc8 /bin/return-assignment
parentd13aac55d8128d20d7981a134ee72c69f9efb5e9 (diff)
downloadbuilder-7bb3c79c9c5ae4775793bb85e6540802ab400b1e.tar.xz
bin/return-assignment: tell the slave what build-assignment has been aborted
Diffstat (limited to 'bin/return-assignment')
-rwxr-xr-xbin/return-assignment33
1 files changed, 24 insertions, 9 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index 24764d1..a4612cf 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -32,15 +32,30 @@ fi
# aborting does not need any locks
if [ $# -eq 1 ] && \
[ "$1" = 'ABORT' ]; then
- # shellcheck disable=SC2016
- {
- printf 'UPDATE `build_slaves`'
- printf ' SET `build_slaves`.`currently_building`=NULL'
- # shellcheck disable=SC2154
- printf ' WHERE `build_slaves`.`id`=%s;\n' \
- "${slave_id}"
- } | \
- mysql_run_query 'unimportant'
+ old_pkgbase=$(
+ # shellcheck disable=SC2016
+ {
+ printf 'SELECT `package_sources`.`pkgbase`'
+ printf ' FROM `build_slaves`'
+ mysql_join_build_slaves_build_assignments
+ mysql_join_build_assignments_package_sources
+ # shellcheck disable=SC2154
+ printf ' WHERE `build_slaves`.`id`=%s;\n' \
+ "${slave_id}"
+ printf 'UPDATE `build_slaves`'
+ printf ' SET `build_slaves`.`currently_building`=NULL'
+ # shellcheck disable=SC2154
+ printf ' WHERE `build_slaves`.`id`=%s;\n' \
+ "${slave_id}"
+ } | \
+ mysql_run_query 'unimportant'
+ )
+ if [ -z "${old_pkgbase}" ]; then
+ >&2 printf 'Umm, nothing to abort for your.\n'
+ else
+ >&2 printf 'I aborted your build-assignment (%s).\n' \
+ "${old_pkgbase}"
+ fi
exit
fi