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:
Diffstat (limited to 'bin/get-assignment')
-rwxr-xr-xbin/get-assignment43
1 files changed, 34 insertions, 9 deletions
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'
} | \