diff options
author | Erich Eckner <git@eckner.net> | 2018-06-05 14:07:29 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-05 14:07:29 +0200 |
commit | 3fb49965d3b08d9c91c011760beb3da300cf1796 (patch) | |
tree | 3fcc39f3a5250a21d7a9816879a768df302ae4e9 /bin | |
parent | cd115d4c0ae628eaeff85516ca2119904683873f (diff) | |
download | builder-3fb49965d3b08d9c91c011760beb3da300cf1796.tar.xz |
bin/build-master-status: use ids instead of select queries
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/build-master-status | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/bin/build-master-status b/bin/build-master-status index 9636722..e74d4b4 100755 --- a/bin/build-master-status +++ b/bin/build-master-status @@ -144,51 +144,54 @@ if [ ! -s "${work_dir}/build-master-sanity" ]; then printf ' `binary_packages`' mysql_join_binary_packages_binary_packages_in_repositories mysql_join_binary_packages_in_repositories_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`="stable"),' + # shellcheck disable=SC2154 + printf ' WHERE `repositories`.`stability`=%s),' \ + "${repository_stability_ids__stable}" # pending_tasks_count printf '(SELECT COUNT(DISTINCT `build_assignments`.`id`) FROM' printf ' `build_assignments`' mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `repositories`.`name`="build-list"),' + printf ' WHERE `binary_packages_in_repositories`.`repository`=%s),' \ + "${repository_ids__any_build_list}" # pending_packages_count printf '(SELECT COUNT(DISTINCT `binary_packages`.`id`) FROM' printf ' `binary_packages`' mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `repositories`.`name`="build-list"),' + printf ' WHERE `binary_packages_in_repositories`.`repository`=%s),' \ + "${repository_ids__any_build_list}" # staging_packages_count printf '(SELECT COUNT(DISTINCT `binary_packages`.`id`) FROM' printf ' `binary_packages`' mysql_join_binary_packages_binary_packages_in_repositories mysql_join_binary_packages_in_repositories_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`="staging"),' + # shellcheck disable=SC2154 + printf ' WHERE `repositories`.`stability`=%s),' \ + "${repository_stability_ids__staging}" # testing_packages_count printf '(SELECT COUNT(DISTINCT `binary_packages`.`id`) FROM' printf ' `binary_packages`' mysql_join_binary_packages_binary_packages_in_repositories mysql_join_binary_packages_in_repositories_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`="testing"' + # shellcheck disable=SC2154 + printf ' WHERE `repositories`.`stability`=%s' \ + "${repository_stability_ids__testing}" printf ' AND NOT `binary_packages`.`is_tested`),' # tested_packages_count printf '(SELECT COUNT(DISTINCT `binary_packages`.`id`) FROM' printf ' `binary_packages`' mysql_join_binary_packages_binary_packages_in_repositories mysql_join_binary_packages_in_repositories_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`="testing"' + printf ' WHERE `repositories`.`stability`=%s' \ + "${repository_stability_ids__testing}" printf ' AND `binary_packages`.`is_tested`),' # broken_tasks_count printf '(SELECT COUNT(DISTINCT `build_assignments`.`id`) FROM' printf ' `build_assignments`' mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `repositories`.`name`="build-list"' + printf ' WHERE `binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_build_list}" printf ' AND `build_assignments`.`is_broken`),' # dependency_loops_count printf '(SELECT COUNT(DISTINCT `build_dependency_loops`.`loop`) FROM' @@ -202,23 +205,23 @@ if [ ! -s "${work_dir}/build-master-sanity" ]; then mysql_join_build_slaves_build_assignments mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `repositories`.`name`="build-list"),' + printf ' WHERE `binary_packages_in_repositories`.`repository`=%s),' \ + "${repository_ids__any_build_list}" # blocked_tasks_count printf '(SELECT COUNT(DISTINCT `build_assignments`.`id`) FROM' printf ' `build_assignments`' mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `repositories`.`name`="build-list"' + printf ' WHERE `binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_build_list}" printf ' AND `build_assignments`.`is_blocked` IS NOT NULL),' # next_tasks_count printf '(SELECT COUNT(DISTINCT `build_assignments`.`id`) FROM' printf ' `build_assignments`' mysql_join_build_assignments_binary_packages mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `repositories`.`name`="build-list"' + printf ' WHERE `binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_build_list}" printf ' AND (' printf 'NOT EXISTS (' printf 'SELECT 1 FROM `dependencies`' @@ -227,8 +230,8 @@ if [ ! -s "${work_dir}/build-master-sanity" ]; then mysql_join_dependencies_install_target_providers mysql_join_install_target_providers_binary_packages '' 'prov_bp' mysql_join_binary_packages_binary_packages_in_repositories 'prov_bp' 'prov_bpir' - mysql_join_binary_packages_in_repositories_repositories 'prov_bpir' 'prov_r' - printf ' WHERE `prov_r`.`name`="build-list"' + printf ' WHERE `prov_bpir`.`repository`=%s' \ + "${repository_ids__any_build_list}" printf ' AND `dependencies`.`dependent`=`binary_packages`.`id`' printf ') OR EXISTS (' printf 'SELECT 1 FROM `build_dependency_loops`' |