index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-04-18 15:05:39 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-04-18 15:05:39 +0200 |
commit | d790eef548b958e4e81c91bda739833eed57f83f (patch) | |
tree | 6ace8a7c59311db855f1d0607119ccac17aadff4 /bin/build-master-status-from-mysql | |
parent | 51f204a4a030cd183388e25f276d5e36742943fd (diff) |
-rwxr-xr-x | bin/build-master-status-from-mysql | 145 |
diff --git a/bin/build-master-status-from-mysql b/bin/build-master-status-from-mysql deleted file mode 100755 index 4b00278..0000000 --- a/bin/build-master-status-from-mysql +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/sh - -# report about status of build master - according to mysql database - -# shellcheck source=../conf/default.conf -. "${0%/*}/../conf/default.conf" - -# TODO: add all (necessary) features from build-master-status - -tmp_dir=$(mktemp -d 'tmp.build-master-status-from-mysql.XXXXXXXXXX' --tmpdir) -trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT - -# do not block if locked -exec 9> "${sanity_check_lock_file}" -if ! flock -n 9; then - >&2 echo 'Mysql-Sanity check skipped, cannot acquire lock.' - exit -fi - -# shellcheck disable=SC2119 -mysql_cleanup - -{ - mysql_sanity_check || true -} | \ - sed ' - s,^-.*$,<font color="#FF0000">\0</font>, - s,^+.*$,<font color="#00FF00">\0</font>, - s/$/<br>/ - 1 i <html><head><title>sanity of the buildmaster'"'"'s mysql database</title></head><body> - $ a </body></html> - ' | \ - sponge "${webserver_directory}/mysql-sanity.html" - -if [ -s "${webserver_directory}/mysql-sanity.html" ] && \ - [ ! -s "${work_dir}/build-master-sanity" ]; then - printf 'girls, my database is dirty again ...\n' | \ - irc_say - echo 'build master is insane' > \ - "${work_dir}/build-master-sanity" -fi - -if [ ! -s "${work_dir}/build-master-sanity" ]; then - # shellcheck disable=SC2016 - { - printf 'INSERT IGNORE INTO `statistics` (' - printf '`%s`,' \ - 'stable_packages_count' \ - 'pending_tasks_count' \ - 'pending_packages_count' \ - 'staging_packages_count' \ - 'testing_packages_count' \ - 'tested_packages_count' \ - 'broken_tasks_count' \ - 'dependency_loops_count' \ - 'dependency_looped_tasks_count' \ - 'locked_tasks_count' \ - 'blocked_tasks_count' \ - 'next_tasks_count' | \ - sed 's/,$//' - printf ') VALUES (' - # stable_packages_count - printf '(SELECT COUNT(DISTINCT `binary_packages`.`id`) FROM' - printf ' `binary_packages`' - mysql_join_binary_packages_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`="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_repositories - printf ' WHERE `repositories`.`name`="build-list"),' - # pending_packages_count - printf '(SELECT COUNT(DISTINCT `binary_packages`.`id`) FROM' - printf ' `binary_packages`' - mysql_join_binary_packages_repositories - printf ' WHERE `repositories`.`name`="build-list"),' - # staging_packages_count - printf '(SELECT COUNT(DISTINCT `binary_packages`.`id`) FROM' - printf ' `binary_packages`' - mysql_join_binary_packages_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`="staging"),' - # testing_packages_count - printf '(SELECT COUNT(DISTINCT `binary_packages`.`id`) FROM' - printf ' `binary_packages`' - mysql_join_binary_packages_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`="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_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`="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_repositories - printf ' WHERE `repositories`.`name`="build-list"' - printf ' AND `build_assignments`.`is_broken`),' - # dependency_loops_count - printf '(SELECT COUNT(DISTINCT `build_dependency_loops`.`loop`) FROM' - printf ' `build_dependency_loops`),' - # dependency_looped_tasks_count - printf '(SELECT COUNT(DISTINCT `build_dependency_loops`.`build_assignment`) FROM' - printf ' `build_dependency_loops`),' - # locked_tasks_count - printf '(SELECT COUNT(DISTINCT `build_slaves`.`currently_building`) FROM' - printf ' `build_slaves`' - mysql_join_build_slaves_build_assignments - mysql_join_build_assignments_binary_packages - mysql_join_binary_packages_repositories - printf ' WHERE `repositories`.`name`="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_repositories - printf ' WHERE `repositories`.`name`="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_repositories - printf ' WHERE `repositories`.`name`="build-list"' - printf ' AND NOT EXISTS (' - printf 'SELECT * FROM `dependencies`' - mysql_join_dependencies_dependency_types - printf ' AND `dependency_types`.`relevant_for_binary_packages`' - mysql_join_dependencies_install_target_providers - mysql_join_install_target_providers_binary_packages '' 'prov_bp' - mysql_join_binary_packages_repositories 'prov_bp' 'prov_r' - printf ' WHERE `prov_r`.`name`="build-list"' - printf ' AND `dependencies`.`dependent`=`binary_packages`.`id`' - printf '))' - printf ');\n' - } | \ - mysql_run_query -fi |