diff options
author | Erich Eckner <git@eckner.net> | 2017-07-04 09:46:33 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-07-04 09:46:33 +0200 |
commit | 4d83e12fdcea0957cdaecf766d33186d62b9e9ed (patch) | |
tree | 4863daa9bf759e941cd20a79d37fe26f3cda1130 /bin | |
parent | 536e5073ae45d141664570b5d5cb0963a2c1903d (diff) | |
download | builder-4d83e12fdcea0957cdaecf766d33186d62b9e9ed.tar.xz |
bin/build-master-status: add space separated output for statistics (graph)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/build-master-status | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/bin/build-master-status b/bin/build-master-status index 637c76a..7827ab5 100755 --- a/bin/build-master-status +++ b/bin/build-master-status @@ -9,19 +9,26 @@ usage() { >&2 echo 'build-master-status: report about status of build master' >&2 echo '' >&2 echo 'possible options:' - >&2 echo ' -b|--broken $output: Write broken packages to $output.' - >&2 echo ' -h|--help: Show this help and exit.' - >&2 echo ' -n|--nice: Write html output.' - >&2 echo ' -o|--output $output: Write to $output instead of stdout.' + >&2 echo ' -b|--broken $output:' + >&2 echo ' Write broken packages to $output.' + >&2 echo ' -h|--help:' + >&2 echo ' Show this help and exit.' + >&2 echo ' -n|--nice:' + >&2 echo ' Write html output.' + >&2 echo ' -o|--output $output:' + >&2 echo ' Write to $output instead of stdout.' + >&2 echo ' -s|--statistics $output:' + >&2 echo ' Write statistics to $output.' [ -z "$1" ] && exit 1 || exit $1 } eval set -- "$( - getopt -o b:hno: \ + getopt -o b:hno:s: \ --long broken: \ --long help \ --long nice \ --long output: \ + --long statistics: \ -n "$(basename "$0")" -- "$@" || \ echo usage )" @@ -37,6 +44,7 @@ make_nice() { nice=false broken_output='' output_file='' +statistics_output='' while true do @@ -61,6 +69,10 @@ do cat >> "${output_file}" } ;; + -s|--statistics) + shift + statistics_output="$1" + ;; --) shift break @@ -181,6 +193,26 @@ if [ $((${testing}+${staging}+${pending_packages}-${broken})) -ne 0 ]; then output fi +if [ -n "${statistics_output}" ]; then + ( + [ -f "${statistics_output}" ] && \ + cat "${statistics_output}" + printf '%s ' \ + "$(date +%s)" \ + "${stable}" \ + "${tasks}" \ + "${pending_packages}" \ + "${staging}" \ + "${testing}" \ + "${broken}" \ + "${loops}" \ + "${looped_packages}" | \ + sed 's| $|\n|' + ) | \ + tail -n 10080 | \ + sponge "${statistics_output}" +fi + if [ -n "${broken_output}" ]; then ( if ${nice}; then |