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 12:37:23 +0200
committerErich Eckner <git@eckner.net>2018-09-13 12:37:23 +0200
commitbf1267babf5e4eb34d1b397e2b7ae03c0d0d7f54 (patch)
tree7aa01d702985cc92105eb808ba7c2c6a4981a62b /bin
parent5b18b6f2cfe011660f2c49b69caf91092b32b0fb (diff)
bin/get-assignment: delete all but one toolchain build-assignment if any toolchain build-assignment is to be built
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-assignment87
1 files changed, 81 insertions, 6 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index f9913a4..0df5693 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -147,8 +147,6 @@ if [ -n "${currently_building}" ]; then
hand_out_assignment "${currently_building}"
fi
-# TODO: currently, toolchain packages ARE HANDED OUT IN PARALLEL - THIS SHOULD NOT BE!
-
# a package with [all dependencies met or which is part of a loop]
# and which is currently not being built, ordered by:
# 1: we requested it
@@ -159,7 +157,7 @@ fi
next_building=$(
# shellcheck disable=SC2016
{
- for suffix in '' '_copy'; do
+ for suffix in '' '_2' '_3' '_4'; do
printf 'CREATE TEMPORARY TABLE `considered_build_assignments%s` (' \
"${suffix}"
printf '`id` BIGINT,'
@@ -195,7 +193,7 @@ next_building=$(
printf ' AND `architectures`.`name` = from_base64("%s");\n' \
"${arch}"
- printf 'INSERT IGNORE INTO `considered_build_assignments_copy` (`id`)'
+ printf 'INSERT IGNORE INTO `considered_build_assignments_2` (`id`)'
printf ' SELECT `considered_build_assignments`.`id`'
printf ' FROM `considered_build_assignments`;\n'
@@ -210,13 +208,90 @@ next_building=$(
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 'SELECT 1 FROM `considered_build_assignments_2`'
+ printf ' JOIN `build_assignments`'
+ printf ' ON `build_assignments`.`id`=`considered_build_assignments_2`.`id`'
+ mysql_join_build_assignments_package_sources
+ printf ' JOIN `toolchain_order`'
+ printf ' ON `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
+ printf ');\n'
+
+ printf 'DELETE `considered_build_assignments_2`'
+ printf ' FROM `considered_build_assignments_2`;\n'
+ for suffix in '_2' '_3' '_4'; do
+ printf 'INSERT IGNORE INTO `considered_build_assignments%s` (`id`)' \
+ "${suffix}"
+ printf ' SELECT `considered_build_assignments`.`id`'
+ printf ' FROM `considered_build_assignments`;\n'
+ done
+
+ # delete all but one package from considered list iff any toolchain
+ # package is on that list
+ # the order is:
+ # - does not exist blocked before exists blocked
+ # - unbuilt before built
+ # - exists unblocked before does not exist unblocked
+ printf 'DELETE `considered_build_assignments`'
+ printf ' FROM `considered_build_assignments`'
+ printf ' WHERE EXISTS ('
+ printf 'SELECT 1 FROM `considered_build_assignments_2`'
printf ' JOIN `build_assignments`'
- printf ' ON `build_assignments`.`id`=`considered_build_assignments_copy`.`id`'
+ printf ' ON `build_assignments`.`id`=`considered_build_assignments_2`.`id`'
mysql_join_build_assignments_package_sources
printf ' JOIN `toolchain_order`'
printf ' ON `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
printf ');\n'
+ printf 'INSERT IGNORE INTO `considered_build_assignments` (`id`)'
+ printf 'SELECT `considered_build_assignments_2`.`id`'
+ printf ' FROM `considered_build_assignments_2`'
+ printf ' JOIN `build_assignments`'
+ printf ' ON `build_assignments`.`id`=`considered_build_assignments_2`.`id`'
+ mysql_join_build_assignments_package_sources
+ printf ' ORDER BY'
+ # does it exist toolchain-blocked?
+ printf ' EXISTS ('
+ printf 'SELECT 1'
+ printf ' FROM `toolchain_order` AS `late`'
+ printf ' JOIN `toolchain_order` AS `early`'
+ printf ' ON `late`.`pkgbase`!=`early`.`pkgbase`'
+ printf ' AND `late`.`number`>`early`.`number`'
+ printf ' JOIN `package_sources` AS `e_ps`'
+ printf ' ON `e_ps`.`pkgbase`=`early`.`pkgbase`'
+ mysql_join_package_sources_build_assignments 'e_ps' 'e_ba'
+ printf ' JOIN `considered_build_assignments_3` AS `e_cba`'
+ printf ' ON `e_cba`.`id`=`e_ba`.`id`'
+ printf ' WHERE `late`.`pkgbase`=`package_sources`.`pkgbase`'
+ printf '),'
+ printf ' `tc_q`.`exists_blocked`,'
+ # does it exist built?
+ printf ' EXISTS ('
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages_in_repositories`'
+ mysql_join_binary_packages_in_repositories_repositories
+ printf ' AND `repositories`.`is_on_master_mirror`'
+ mysql_join_repositories_architectures
+ printf ' AND `architectures`.`name`=from_base64("%s")' \
+ "${arch}"
+ printf ' WHERE `binary_packages`.`build_assignment`=`build_assignments`.`id`'
+ printf '),'
+ # does it exist not toolchain-blocked?
+ printf ' EXISTS ('
+ printf 'SELECT 1'
+ printf ' FROM `toolchain_order` AS `late`'
+ printf ' WHERE NOT EXISTS ('
+ printf 'SELECT 1'
+ printf ' FROM `toolchain_order` AS `early`'
+ printf ' JOIN `package_sources` AS `e_ps`'
+ printf ' ON `e_ps`.`pkgbase`=`early`.`pkgbase`'
+ mysql_join_package_sources_build_assignments 'e_ps' 'e_ba'
+ printf ' JOIN `considered_build_assignments_4` AS `e_cba`'
+ printf ' ON `e_ba`.`id`=`e_cba`.`id`'
+ printf ' WHERE `late`.`pkgbase`!=`early`.`pkgbase`'
+ printf ' AND `late`.`number`>`early`.`number`'
+ printf ')'
+ printf ' AND `late`.`pkgbase`=`package_sources`.`pkgbase`'
+ printf ') DESC'
+ printf ' LIMIT 1;\n'
# delete all currently building packages from considered list
printf 'DELETE `considered_build_assignments`'