index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-07-08 12:08:52 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-07-08 12:08:52 +0200 |
commit | 139a925c1aa279b80095a0abb573d35300dcaf10 (patch) | |
tree | ae039cad1ffe64c6f9d342d3d5618c326d75c96c /bin/nit-picker | |
parent | ffe16b27cc7a8af56837c437943cdec5dc179e68 (diff) |
-rwxr-xr-x | bin/nit-picker | 101 |
diff --git a/bin/nit-picker b/bin/nit-picker new file mode 100755 index 0000000..d3514ce --- /dev/null +++ b/bin/nit-picker @@ -0,0 +1,101 @@ +#!/bin/sh + +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" + +# this script shall host all the tests that are too slow to be run on +# the buildmaster (thus, it runs asynchronously and must therefor be +# resilient against transient states of the buildmaster): +# - check sanity of git +# TODO: +# - check for differences of dependencies between mysql and git +# - check for differences of dependencies between mysql and packages +# - check for installability of packages + +if pgrep -x ii; then + >&2 'ii is already running - this will not work' + exit 1 +fi + +rm -rf --one-file-system "${irc_dir}" + +ii -s irc.freenode.net -n nit-picker -f nit-picker >/dev/null 2>&1 & +ii_pid=$! + +trap 'kill "${ii_pid}"' EXIT + +# wait for nickserv complaint +while ! grep -qF 'This nickname is registered. Please choose a different nickname' "${irc_dir}/nickserv/out"; do + sleep 1 +done + +# register +printf 'identify %s\n' "${irc_password}" | \ + tee /dev/stderr | \ + sponge "${irc_dir}/nickserv/in" + +# wait for registering to succeed +while ! grep -qF 'You are now identified for' "${irc_dir}/nickserv/out"; do + sleep 1 +done + +# join channel +echo '/j #archlinux32' | \ + sponge "${irc_dir}/in" + +while [ ! -f "${irc_dir}/#archlinux32/out" ]; do + sleep 1 +done + +mysql_load_min_and_max_versions + +while pgrep -x ii >/dev/null; do + # shellcheck disable=SC2016 + { + printf 'SELECT DISTINCT' + printf ' "commit",' + printf '`git_repositories`.`name`,' + printf '`package_sources`.`git_revision`' + printf ' FROM `package_sources`' + mysql_join_package_sources_upstream_repositories + mysql_join_upstream_repositories_git_repositories + printf ';\n' + + printf 'SELECT DISTINCT' + printf ' "commit",' + printf '"archlinux32",' + printf '`package_sources`.`mod_git_revision`' + printf ' FROM `package_sources`' + printf ';\n' + } | \ + mysql_run_query | \ + tr '\t' ' ' | \ + shuf | \ + while read -r action parameters; do + printf '.' >&2 + if ! pgrep -x ii >/dev/null; then + break + fi + case "${action}" in + 'commit') # check whether a given commit is present in the git repo + git_repo="${parameters%% *}" + git_rev="${parameters#${git_repo} }" + eval "$( + printf 'git_dir="${repo_paths__%s}"\n' \ + "${git_repo}" + )" + # shellcheck disable=SC2154 + if ! git -C "${git_dir}" cat-file -t "${git_rev}" 2> /dev/null | \ + grep -qxF 'commit'; then + printf 'commit %s is missing from repository %s\n' \ + "${git_rev}" \ + "${git_repo}" + fi + ;; + *) + >&2 printf 'action "%s" is not yet implemented ...\n' "${action}" + ;; + esac + done + sleep 120 +done |