diff options
author | Erich Eckner <git@eckner.net> | 2019-07-31 11:39:28 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-07-31 11:39:28 +0200 |
commit | b426ea2edda85fd4e821e106f859eb8d3688bf18 (patch) | |
tree | 330b17059d3ee018ed2c5c3151e1c97058a4eb5a /bin | |
parent | 9ce5edd59b68a3f3fe2549d26dd9e029c79bb480 (diff) | |
download | builder-b426ea2edda85fd4e821e106f859eb8d3688bf18.tar.xz |
bin/nit-picker: allow to run a single check
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/nit-picker | 98 |
1 files changed, 55 insertions, 43 deletions
diff --git a/bin/nit-picker b/bin/nit-picker index 70adcdd..f7c59f5 100755 --- a/bin/nit-picker +++ b/bin/nit-picker @@ -14,18 +14,19 @@ # - check for differences of dependencies between mysql and packages # - check for installability of packages -if [ $# -eq 1 ] && [ "x$1" = 'x-n' ]; then +if [ $# -ge 1 ] && [ "x$1" = 'x-n' ]; then >&2 echo 'not joining irc' irc=false shift else irc=true -fi - -if [ $# -ne 0 ]; then - >&2 echo 'usage: nit-picker [-n]' - >&2 echo ' -n: do not join irc' - exit 1 + # shellcheck disable=SC2016 + if [ $# -ne 0 ]; then + >&2 echo 'usage: nit-picker [-n [$single_test]]' + >&2 echo ' -n: do not join irc' + >&2 echo ' $single_test: only execute the given test' + exit 1 + fi fi clean_up() { @@ -82,41 +83,45 @@ mysql_load_min_and_max_versions while pgrep -x ii >/dev/null \ || ! ${irc}; do - # shellcheck disable=SC2016 - { - printf 'SELECT DISTINCT' - printf ' "commit",' - printf '`git_repositories`.`name`,' - printf '`git_repositories`.`head`,' - 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",' - # shellcheck disable=SC2154 - printf '"%s",' \ - "${repo_heads__archlinux32}" - printf '`package_sources`.`mod_git_revision`' - printf ' FROM `package_sources`' - printf ';\n' - - printf 'SELECT DISTINCT' - printf ' "binary-dependencies",' - mysql_package_name_query - printf ' FROM `binary_packages`' - mysql_join_binary_packages_architectures - mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `repositories`.`is_on_master_mirror`' - printf ';\n' - } | \ - mysql_run_query | \ - tr '\t' ' ' | \ - shuf | \ + if [ $# -eq 0 ]; then + # shellcheck disable=SC2016 + { + printf 'SELECT DISTINCT' + printf ' "commit",' + printf '`git_repositories`.`name`,' + printf '`git_repositories`.`head`,' + 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",' + # shellcheck disable=SC2154 + printf '"%s",' \ + "${repo_heads__archlinux32}" + printf '`package_sources`.`mod_git_revision`' + printf ' FROM `package_sources`' + printf ';\n' + + printf 'SELECT DISTINCT' + printf ' "binary-dependencies",' + mysql_package_name_query + printf ' FROM `binary_packages`' + mysql_join_binary_packages_architectures + mysql_join_binary_packages_binary_packages_in_repositories + mysql_join_binary_packages_in_repositories_repositories + printf ' WHERE `repositories`.`is_on_master_mirror`' + printf ';\n' + } | \ + mysql_run_query | \ + tr '\t' ' ' | \ + shuf + else + printf '%s\n' "$*" + fi | \ while read -r action parameters; do if ${irc} && ! pgrep -x ii >/dev/null; then break @@ -127,6 +132,7 @@ while pgrep -x ii >/dev/null \ git_rev="${parameters#${git_repo} }" git_head="${git_rev%% *}" git_rev="${git_rev#${git_head} }" + # shellcheck disable=SC2016 eval "$( printf 'git_dir="${repo_paths__%s}"\n' \ "${git_repo}" @@ -171,6 +177,7 @@ while pgrep -x ii >/dev/null \ extract_dependencies_from_package \ "${tmp_dir}/${parameters}" \ > "${tmp_dir}/pkg-deps" + # shellcheck disable=SC2016 { printf 'SELECT' printf ' `dependency_types`.`name`,' @@ -202,7 +209,9 @@ while pgrep -x ii >/dev/null \ if ! ${irc}; then diff -u --color "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps" || true fi - sleep 60 + if [ $# -eq 0 ]; then + sleep 60 + fi fi rm \ "${tmp_dir}/${parameters}" \ @@ -214,5 +223,8 @@ while pgrep -x ii >/dev/null \ ;; esac done + if [ $# -ge 1 ]; then + break + fi sleep 120 done |