index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-06-12 13:17:26 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-12 13:17:26 +0200 |
commit | bbafb7963717b0a6b131f4acc789e695660b19c9 (patch) | |
tree | 1c2878e97e2b334816df918639e33a12fa5bd429 /bin/get-assignment | |
parent | 86d1ff61a057e1aeb3d335b079a08c6dc77b2b09 (diff) |
-rwxr-xr-x | bin/get-assignment | 43 |
diff --git a/bin/get-assignment b/bin/get-assignment index 4252765..f74820f 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -98,6 +98,12 @@ clean_up() { tmp_dir=$(mktemp -d 'tmp.get-assignment.XXXXXXXXXX' --tmpdir) trap clean_up EXIT +arch=$( + printf '%s' "$1" | \ + base64 -w0 +) +shift + # if we're building something already, hand it out (again) currently_building=$( # shellcheck disable=SC2016 @@ -107,10 +113,16 @@ currently_building=$( mysql_join_build_assignments_build_slaves mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories + printf ' JOIN `architecture_compatibilities`' + printf ' ON `architecture_compatibilities`.`built_for`=`build_assignments`.`architecture`' + printf ' JOIN `architectures`' + printf ' ON `architecture_compatibilities`.`runs_on`=`architectures`.`id`' printf ' WHERE `build_slaves`.`id`=from_base64("%s")' \ "$(printf '%s' "${slave_id}" | base64 -w0)" - printf ' AND `repositories`.`name`="build-list"' + printf ' AND `binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_build_list}" + printf ' AND `architectures`.`name` = from_base64("%s")' \ + "${arch}" printf ' LIMIT 1;\n' } | \ mysql_run_query @@ -123,9 +135,10 @@ fi # 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 -# 2: its priority -# 3: is not yet built -# 4: was built the longest time ago +# 2: architecture matches +# 3: its priority +# 4: is not yet built +# 5: was built the longest time ago next_building=$( # shellcheck disable=SC2016 { @@ -148,11 +161,13 @@ next_building=$( mysql_join_build_assignments_package_sources mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories + printf ' JOIN `architecture_compatibilities`' + printf ' ON `architecture_compatibilities`.`built_for`=`build_assignments`.`architecture`' + printf ' JOIN `architectures`' + printf ' ON `architecture_compatibilities`.`runs_on`=`architectures`.`id`' printf ' LEFT' mysql_join_build_assignments_failed_builds - printf ' WHERE `repositories`.`name`="build-list"' - printf ' AND NOT EXISTS (' + printf ' WHERE NOT EXISTS (' printf ' SELECT 1' printf ' FROM `build_slaves`' printf ' WHERE `build_slaves`.`currently_building`=`build_assignments`.`id`' @@ -169,8 +184,18 @@ next_building=$( printf ' OR NOT ' mysql_query_has_pending_dependencies '`build_assignments`.`id`' printf ')' + printf ' AND `binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_build_list}" + printf ' AND `architectures`.`name` = from_base64("%s")' \ + "${arch}" printf ' GROUP BY `build_assignments`.`id`' - printf ' ORDER BY `requested` DESC, `priority` DESC, `last_trial`, `part_of_loop`, `build_assignments`.`id`' + printf ' ORDER BY' + printf ' `requested` DESC,' + printf ' `architectures`.`id`=`build_assignments`.`architecture` DESC,' + printf ' `priority` DESC,' + printf ' `last_trial`,' + printf ' `part_of_loop`,' + printf ' `build_assignments`.`id`' printf ' LIMIT 1' printf ') AS `q`;\n' } | \ |