From ffce954955a8241bacefaed602283c4e27d4b652 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 25 Mar 2021 08:55:18 +0100 Subject: bin/nit-picker: code cleanup and more consistency in when to `sleep 60` and when not to --- bin/nit-picker | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'bin/nit-picker') diff --git a/bin/nit-picker b/bin/nit-picker index 24bfce5..bf3bd13 100755 --- a/bin/nit-picker +++ b/bin/nit-picker @@ -40,6 +40,12 @@ else fi fi +if [ $# -eq 0 ] && ! ${repair_dependencies}; then + single_run=false +else + single_run=true +fi + clean_up() { rm -rf --one-file-system "${tmp_dir}" } @@ -100,6 +106,9 @@ local_irc_say() { else sed 's/^/irc: /' fi + if ! ${single_run}; then + sleep 60 + fi } mysql_load_min_and_max_versions @@ -114,7 +123,9 @@ while pgrep -x ii >/dev/null \ else do_once_a_day_checks=false fi - if [ $# -eq 0 ]; then + if ${single_run}; then + printf '%s\n' "$*" + else # shellcheck disable=SC2016 { if ! "${repair_dependencies}"; then @@ -233,8 +244,6 @@ while pgrep -x ii >/dev/null \ 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 @@ -374,9 +383,6 @@ while pgrep -x ii >/dev/null \ if ! ${irc}; then diff -u --color "${tmp_dir}/db-deps" "${tmp_dir}/pkg-deps" || true fi - if [ $# -eq 0 ]; then - sleep 60 - fi fi fi rm \ @@ -450,9 +456,6 @@ while pgrep -x ii >/dev/null \ if [ -n "${error_message}" ]; then printf '%s\n' "${error_message}" \ | local_irc_say - if [ $# -eq 0 ]; then - sleep 60 - fi fi rm \ "${tmp_dir}/${parameters}" \ @@ -508,9 +511,6 @@ while pgrep -x ii >/dev/null \ )" \ | awk '{print $1 ": your slave " $2 " builds " $3 "/" $4 " for more than a day, now (" ($5-1) " day(s) " $6 ")"}' \ | local_irc_say - if [ $# -eq 0 ]; then - sleep 60 - fi ;; 'keyring') if ! ${master_mirror_rsync_command} \ @@ -546,9 +546,6 @@ while pgrep -x ii >/dev/null \ "$(date -I -d@"${expiration}")" \ "${expiration_days}" \ | local_irc_say - if [ $# -eq 0 ]; then - sleep 60 - fi fi done done @@ -604,9 +601,6 @@ while pgrep -x ii >/dev/null \ s/^\S\+ /parts of \0are in different repositories: / ' \ | local_irc_say - if [ $# -eq 0 ]; then - sleep 60 - fi fi ;; 'upstream-availability') @@ -671,9 +665,6 @@ while pgrep -x ii >/dev/null \ printf 'Package %s is still in our repositories or on the build-list, but is not available upstream.\n' \ "${parameters}" \ | local_irc_say - if [ $# -eq 0 ]; then - sleep 60 - fi ;; 'repository-duration') case "${parameters#* }" in @@ -743,9 +734,6 @@ while pgrep -x ii >/dev/null \ fi } \ | local_irc_say - if [ $# -eq 0 ]; then - sleep 60 - fi ;; *) >&2 printf 'action "%s" is not yet implemented.\n' "${action}" @@ -757,7 +745,7 @@ while pgrep -x ii >/dev/null \ ;; esac done - if [ $# -ge 1 ] || "${repair_dependencies}"; then + if ${single_run}; then >&2 echo 'only one run was requested' break fi -- cgit v1.2.3-70-g09d2