diff options
author | Erich Eckner <git@eckner.net> | 2021-03-25 08:55:18 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-03-25 08:55:18 +0100 |
commit | ffce954955a8241bacefaed602283c4e27d4b652 (patch) | |
tree | 683566c4c26c31cf18edf77cf10453da0e993bca /bin/nit-picker | |
parent | 3364f1ce018b6a9e772283e3682fe36dbdb1ce8e (diff) | |
download | builder-ffce954955a8241bacefaed602283c4e27d4b652.tar.xz |
bin/nit-picker: code cleanup and more consistency in when to `sleep 60` and when not to
Diffstat (limited to 'bin/nit-picker')
-rwxr-xr-x | bin/nit-picker | 38 |
1 files changed, 13 insertions, 25 deletions
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 |