summaryrefslogtreecommitdiff
path: root/bin/get-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-16 11:14:03 +0100
committerErich Eckner <git@eckner.net>2018-02-16 11:14:03 +0100
commitd2e0ef2a558e27e07150f239d91e4c29ce822426 (patch)
treef11a28ba418ecd8fae69fa7fcd3bd6a2623a8dfd /bin/get-assignment
parentd7a7e5cebf55c13ab3522e6ec17e11cba878da73 (diff)
downloadbuilder-d2e0ef2a558e27e07150f239d91e4c29ce822426.tar.xz
bin/mysql-functions: mysql_join_*_* new
Diffstat (limited to 'bin/get-assignment')
-rwxr-xr-xbin/get-assignment34
1 files changed, 15 insertions, 19 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index a7eec2d..1edcffb 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -45,11 +45,10 @@ hand_out_assignment() {
'pkgbase' 'git_revision' 'mod_git_revision'
printf '`upstream_repositories`.`name`,`binary_packages`.`sub_pkgrel`'
printf ' FROM `upstream_repositories`'
- printf ' JOIN `%s` ON `%s`.`%s`=`%s`.`id`' \
- 'package_sources' 'package_sources' 'upstream_package_repository' 'upstream_repositories' \
- 'build_assignments' 'build_assignments' 'package_source' 'package_sources' \
- 'binary_packages' 'binary_packages' 'build_assignment' 'build_assignments' \
- 'repositories' 'binary_packages' 'repository' 'repositories'
+ mysql_join_upstream_repositories_package_sources
+ mysql_join_package_sources_build_assignments
+ mysql_join_build_assignments_binary_packages
+ mysql_join_binary_packages_repositories
printf ' WHERE `repositories`.`name`="build-list"'
printf ' AND `package_sources`.`%s`=from_base64("%s")' \
'pkgbase' "$(printf '%s' "$1" | base64 -w0)" \
@@ -80,8 +79,8 @@ hand_out_assignment() {
printf ' SET `currently_building` = ('
printf ' SELECT `build_assignments`.`id`'
printf ' FROM `build_assignments`'
- printf ' JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id`'
- printf ' JOIN `upstream_repositories` ON `package_sources`.`upstream_package_repository`=`upstream_repositories`.`id`'
+ mysql_join_build_assignments_package_sources
+ mysql_join_package_sources_upstream_repositories
printf ' WHERE'
printf ' `package_sources`.`%s` = from_base64("%s") AND' \
'pkgbase' "$(printf '%s' "$1" | base64 -w0)" \
@@ -94,8 +93,8 @@ hand_out_assignment() {
"$(printf '%s' "${slave}" | base64 -w0)"
printf 'UPDATE `build_assignments`'
- printf ' JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id`'
- printf ' JOIN `upstream_repositories` ON `package_sources`.`upstream_package_repository`=`upstream_repositories`.`id`'
+ mysql_join_build_assignments_package_sources
+ mysql_join_package_sources_upstream_repositories
printf ' SET `build_assignments`.`priority`=0'
printf ' WHERE'
printf ' `package_sources`.`%s` = from_base64("%s") AND' \
@@ -150,10 +149,9 @@ currently_building=$(
{
printf 'SELECT '
mysql_query_select_pkgbase_and_revision
- printf ' JOIN `%s` ON `%s`.`%s`=`%s`.`id`' \
- 'build_slaves' 'build_slaves' 'currently_building' 'build_assignments' \
- 'binary_packages' 'binary_packages' 'build_assignment' 'build_assignments' \
- 'repositories' 'binary_packages' 'repository' 'repositories'
+ mysql_join_build_assignments_build_slaves
+ mysql_join_build_assignments_binary_packages
+ mysql_join_binary_packages_repositories
printf ' WHERE `build_slaves`.`name`=from_base64("%s")' \
"$(printf '%s' "${slave}" | base64 -w0)"
printf ' AND `repositories`.`name`="build-list"'
@@ -189,9 +187,8 @@ next_building=$(
mysql_query_is_part_of_loop '`build_assignments`.`id`'
printf ' AS `part_of_loop`,'
mysql_query_select_pkgbase_and_revision
- printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \
- 'binary_packages' 'build_assignments' 'binary_packages' 'build_assignment' \
- 'repositories' 'repositories' 'binary_packages' 'repository'
+ mysql_join_build_assignments_binary_packages
+ mysql_join_binary_packages_repositories
printf ' WHERE `repositories`.`name`="build-list"'
printf ' AND NOT EXISTS ('
printf ' SELECT *'
@@ -231,9 +228,8 @@ count_pending=$(
{
printf 'SELECT count(*)'
printf ' FROM `build_assignments`'
- printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \
- 'binary_packages' 'build_assignments' 'binary_packages' 'build_assignment' \
- 'repositories' 'repositories' 'binary_packages' 'repository'
+ mysql_join_build_assignments_binary_packages
+ mysql_join_binary_packages_repositories
printf ' WHERE `repositories`.`name`="build-list"'
printf ' AND `build_assignments`.`is_blocked` IS NULL'
printf ';\n'