Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-13 10:53:26 +0200
committerErich Eckner <git@eckner.net>2018-09-13 10:53:26 +0200
commit8fa8cbc82caca22006b1cedc06eb1c164d829d7c (patch)
tree3c52e11525c998636fdfd6e2895409629a701945 /bin
parent84fb0312c4caa2f445fe95f46ce9896d2a2f3945 (diff)
bin/get-assignment: do not hand out non-toolchain build_assignments as long as toolchain build_assignments are pending
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-assignment32
1 files changed, 28 insertions, 4 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index b5dd33d..d0f1569 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -161,10 +161,13 @@ next_building=$(
{
mysql_query_create_toolchain_order
- printf 'CREATE TEMPORARY TABLE `considered_build_assignments` ('
- printf '`id` BIGINT,'
- printf ' UNIQUE KEY `id`(`id`)'
- printf ');\n'
+ for suffix in '' '_copy'; do
+ printf 'CREATE TEMPORARY TABLE `considered_build_assignments%s` (' \
+ "${suffix}"
+ printf '`id` BIGINT,'
+ printf ' UNIQUE KEY `id`(`id`)'
+ printf ');\n'
+ done
printf 'INSERT IGNORE INTO `considered_build_assignments` (`id`)'
printf ' SELECT `build_assignments`.`id`'
@@ -194,6 +197,27 @@ next_building=$(
printf ' AND `architectures`.`name` = from_base64("%s");\n' \
"${arch}"
+ printf 'INSERT IGNORE INTO `considered_build_assignments_copy` (`id`)'
+ printf ' SELECT `considered_build_assignments`.`id`'
+ printf ' FROM `considered_build_assignments`;\n'
+
+ # delete all non-toolchain packages from considered list iff any
+ # toolchain package is on that list
+ printf 'DELETE `considered_build_assignments`'
+ printf ' FROM `considered_build_assignments`'
+ printf ' WHERE NOT EXISTS ('
+ printf 'SELECT 1 FROM `toolchain_order`'
+ printf ' WHERE `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
+ printf ') AND EXISTS ('
+ printf 'SELECT 1 FROM `considered_build_assignments_copy`'
+ printf ' JOIN `build_assignments`'
+ printf ' ON `build_assignments`.`id`=`considered_build_assignments_copy`.`id`'
+ mysql_join_build_assignments_package_sources
+ printf ' JOIN `toolchain_order`'
+ printf ' ON `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
+ printf ');\n'
+
+ # delete all currently building packages from considered list
printf 'DELETE `considered_build_assignments`'
printf ' FROM `considered_build_assignments`'
mysql_join_build_assignments_build_slaves 'considered_build_assignments'