Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/get-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-05-03 10:26:11 +0200
committerErich Eckner <git@eckner.net>2019-05-03 10:26:11 +0200
commitd773295186e25eff1b873a4b717e42f5c09bbaf7 (patch)
tree033f3a30b348c99c71df500cf5a1672bbd190eee /bin/get-assignment
parentc029ba59be3c1934a54e874a4b3e33e4ff89ea42 (diff)
bin/get-assignment: accellerate query by using temporary table holding the architectures with toolchain build orders
Diffstat (limited to 'bin/get-assignment')
-rwxr-xr-xbin/get-assignment50
1 files changed, 26 insertions, 24 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index f6491fc..91bb407 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -257,24 +257,29 @@ next_building=$(
# delete all non-toolchain packages from considered list iff any
# toolchain package is on that list
- printf 'DELETE `considered_build_assignments`'
+ printf 'CREATE TEMPORARY TABLE `toolchain_architectures` ('
+ printf '`id` SMALLINT NOT NULL,'
+ printf 'PRIMARY KEY (`id`)'
+ printf ');\n'
+ printf 'INSERT IGNORE INTO `toolchain_architectures` (`id`)'
+ printf ' SELECT `build_assignments`.`architecture`'
printf ' FROM `considered_build_assignments`'
printf ' JOIN `build_assignments`'
printf ' ON `build_assignments`.`id`=`considered_build_assignments`.`id`'
mysql_join_build_assignments_package_sources
- printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1'
- printf ' FROM `toolchain_order`'
- printf ' WHERE `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
- printf ') AND EXISTS ('
- printf 'SELECT 1'
- 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 ' JOIN `toolchain_order`'
- printf ' ON `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
- printf ');\n'
+ printf ' JOIN `toolchain_order`'
+ printf ' ON `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`;\n'
+
+ printf 'DELETE `considered_build_assignments`'
+ printf ' FROM `toolchain_architectures`'
+ printf ' JOIN `build_assignments`'
+ printf ' ON `build_assignments`.`architecture`=`toolchain_architectures`.`id`'
+ printf ' JOIN `considered_build_assignments`'
+ printf ' ON `build_assignments`.`id`=`considered_build_assignments`.`id`'
+ mysql_join_build_assignments_package_sources
+ printf ' LEFT JOIN `toolchain_order`'
+ printf ' ON `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
+ printf ' WHERE `toolchain_order`.`number` IS NULL;\n'
printf 'DELETE `considered_build_assignments_2`'
printf ' FROM `considered_build_assignments_2`;\n'
@@ -293,21 +298,18 @@ next_building=$(
# - exists unblocked before does not exist unblocked
printf 'DELETE `considered_build_assignments`'
printf ' FROM `considered_build_assignments`'
-# TODO: this should be architecture specific
- printf ' WHERE EXISTS ('
- printf 'SELECT 1'
- 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 ' JOIN `toolchain_order`'
- printf ' ON `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
- printf ');\n'
+ printf ' JOIN `build_assignments`'
+ printf ' ON `build_assignments`.`id`=`considered_build_assignments`.`id`'
+ printf ' JOIN `toolchain_architectures`'
+ printf ' ON `build_assignments`.`architecture`=`toolchain_architectures`.`id`;\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`'
+ printf ' JOIN `toolchain_architectures`'
+ printf ' ON `build_assignments`.`architecture`=`toolchain_architectures`.`id`'
mysql_join_build_assignments_package_sources
printf ' ORDER BY'
# does it exist toolchain-blocked?