From 4d83e12fdcea0957cdaecf766d33186d62b9e9ed Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 4 Jul 2017 09:46:33 +0200 Subject: bin/build-master-status: add space separated output for statistics (graph) --- bin/build-master-status | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'bin/build-master-status') 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 -- cgit v1.2.3-54-g00ecf