From 1e5a9f812fd8576d5791ed45a2a05bb9a01e78e2 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 18 Jun 2019 16:02:23 +0200 Subject: bin/get-assignment: resolve cross-architecture-blocking of toolchain packages --- bin/get-assignment | 112 ++++++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 53 deletions(-) (limited to 'bin/get-assignment') diff --git a/bin/get-assignment b/bin/get-assignment index e3cf9a3..3a24c76 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -310,63 +310,70 @@ next_building=$( printf ' JOIN `toolchain_architectures`' printf ' ON `build_assignments`.`architecture`=`toolchain_architectures`.`id`;\n' +# TODO: this is somewhat inaccurate: We keep one build assignment per architecture +# but actually, any should interfere with each other architecture, too ... 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? - 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 '),' - # 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`' - printf ' JOIN `architecture_compatibilities`' - printf ' ON `repositories`.`architecture`=`architecture_compatibilities`.`runs_on`' - printf ' AND `architecture_compatibilities`.`build_slave_compatible`' - printf ' JOIN `architectures`' - printf ' ON `architectures`.`id`=`architecture_compatibilities`.`built_for`' - printf ' AND `architectures`.`name`=from_base64("%s")' \ - "${arch}" - mysql_join_binary_packages_in_repositories_binary_packages - 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 `sub_query`.`ba_id`' + printf ' FROM (' + printf 'SELECT' + printf ' `considered_build_assignments_2`.`id` AS `ba_id`,' + printf '`build_assignments`.`architecture`' + 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? + printf ' EXISTS (' printf 'SELECT 1' - printf ' FROM `toolchain_order` AS `early`' + 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_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' + 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 '),' + # 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`' + printf ' JOIN `architecture_compatibilities`' + printf ' ON `repositories`.`architecture`=`architecture_compatibilities`.`runs_on`' + printf ' AND `architecture_compatibilities`.`build_slave_compatible`' + printf ' JOIN `architectures`' + printf ' ON `architectures`.`id`=`architecture_compatibilities`.`built_for`' + printf ' AND `architectures`.`name`=from_base64("%s")' \ + "${arch}" + mysql_join_binary_packages_in_repositories_binary_packages + 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 ') AS `sub_query`' + printf ' GROUP BY `sub_query`.`architecture`;\n' # delete all currently building packages from considered list printf 'DELETE `considered_build_assignments`' @@ -388,7 +395,6 @@ next_building=$( printf ' GROUP BY `failed_builds`.`build_assignment`' printf ') AS `latest_failed_builds`' printf ' ON `latest_failed_builds`.`build_assignment`=`build_assignments`.`id`' -# TODO: it looks, like i686/gcc currently can block pentium4/gcc - this should not be! printf ' LEFT JOIN (' # Does this job wait for something else in `toolchain_order`? printf 'SELECT ' -- cgit v1.2.3-70-g09d2