diff options
author | Erich Eckner <git@eckner.net> | 2018-05-16 08:48:52 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-05-16 08:50:38 +0200 |
commit | 4f20aac08b4ce0ffb6f3ffe285e8eba86875c187 (patch) | |
tree | a63212bd9f9ce60c8f80d1249b4e6afae8f2ab75 | |
parent | 14f8a1f422a4a0b272418acb9ab491de0a9d3379 (diff) | |
download | builder-4f20aac08b4ce0ffb6f3ffe285e8eba86875c187.tar.xz |
bin/sanity-check: --webserver -> --wait (we always output to webserver, but we make blocking configurable
-rwxr-xr-x | bin/sanity-check | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/bin/sanity-check b/bin/sanity-check index 6c30af7..7ae0303 100755 --- a/bin/sanity-check +++ b/bin/sanity-check @@ -15,7 +15,7 @@ usage() { >&2 echo ' -h|--help: Show this help and exit.' >&2 echo ' -q|--quiet: Only print errors found.' >&2 echo ' -r|--really-quiet: Do not print anything.' - >&2 echo ' -w|--webserver: Generate output suitable for webserver.' + >&2 echo ' -w|--wait: If necessary, wait for lock blocking.' [ -z "$1" ] && exit 1 || exit "$1" } @@ -37,15 +37,15 @@ eval set -- "$( --long help \ --long quiet \ --long really-quiet \ - --long webserver \ + --long wait \ -n "$(basename "$0")" -- "$@" || \ echo usage )" +block_flag='-n' silence=0 repos="${standalone_package_repositories} ${stable_package_repositories} ${testing_package_repositories} ${staging_package_repositories}" archs='i686' -web=false while true do @@ -59,8 +59,8 @@ do -r|--really-quiet) silence=2 ;; - -w|--webserver) - web=true + -w|--wait) + block_flag='' ;; --) shift @@ -75,30 +75,26 @@ do done exec 9> "${sanity_check_lock_file}" -if ! flock -n 9; then +if ! flock ${block_flag} 9; then >&2 echo 'Sanity check skipped, cannot acquire lock.' exit fi finish() { - if ${web}; then - { - printf '%s\n' \ - '<html>' \ - '<head>' \ - '<title>result of archlinux32 build master'"'"'s sanity check</title>' \ - '</head>' \ - '<body>' - printf '%s<br>\n' "$(date)" - sed 's|$|<br>|' "${tmp_dir}/messages" - printf '%s\n' \ - '</body>' \ - '</html>' - } > \ - "${webserver_directory}/master-sanity.html" - else - cat "${tmp_dir}/messages" >&2 - fi + { + printf '%s\n' \ + '<html>' \ + '<head>' \ + '<title>result of archlinux32 build master'"'"'s sanity check</title>' \ + '</head>' \ + '<body>' + printf '%s<br>\n' "$(date)" + sed 's|$|<br>|' "${tmp_dir}/messages" + printf '%s\n' \ + '</body>' \ + '</html>' + } > \ + "${webserver_directory}/master-sanity.html" rm -rf --one-file-system "${tmp_dir}" } |