summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-18 15:31:57 +0200
committerErich Eckner <git@eckner.net>2017-10-18 15:31:57 +0200
commit2b5be37206f08d8cc72b682d578bbbecd1dc048e (patch)
tree352c53f693d3c258caa62b83ee5d575b3a4718f1 /bin
parent2746088e0c225f8a576630a734cd9475e36d01b0 (diff)
downloadbuilder-2b5be37206f08d8cc72b682d578bbbecd1dc048e.tar.xz
bin/filter-build-logs new for displaying namcap-output on the webserver
Diffstat (limited to 'bin')
-rwxr-xr-xbin/filter-build-logs61
1 files changed, 61 insertions, 0 deletions
diff --git a/bin/filter-build-logs b/bin/filter-build-logs
new file mode 100755
index 0000000..36f83f0
--- /dev/null
+++ b/bin/filter-build-logs
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# filter content of build-logs for display on the webserver
+
+# shellcheck source=conf/default.conf
+. "${0%/*}/../conf/default.conf"
+
+{
+ printf '%s\n' \
+ '<html>' \
+ '<head>' \
+ '<title>Output of namcap of successful builds</title>' \
+ '<link rel="stylesheet" type="text/css" href="/static/style.css">' \
+ '</head>' \
+ '<body>' \
+ '<table>'
+ printf '<tr>'
+ printf '<th>%s</th>' \
+ 'package' \
+ 'type' \
+ 'message'
+ printf '</tr>\n'
+ find "${build_log_directory}/success" -maxdepth 1 -name '*.build-log.gz' -printf '%p\n' | \
+ while read -r log; do
+ zcat "${log}" | \
+ sed -n '
+ /^Checking PKGBUILD$/{
+ :a
+ $!{
+ N
+ ba
+ }
+ p
+ }
+ '
+ done | \
+ sed '
+ /^Checking \(PKGBUILD\|\S\+\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\)$/d
+ / on your system is a testing release$/d
+ ' | \
+ sort -u | \
+ while read -r a b c; do
+ b="${b%:}"
+ if [ "${b}" = 'E' ]; then
+ left='<font color="red">'
+ right='</font>'
+ else
+ unset left
+ unset right
+ fi
+ printf '<tr>'
+ printf '<td>%s</td>' \
+ "${left}${a}${right}" "${left}${b}${right}" "${left}${c}${right}"
+ printf '</tr>\n'
+ done
+ printf '%s\n' \
+ '</table>' \
+ '</body>' \
+ '</html>'
+} > \
+ "${webserver_directory}/namcap-outputs.html"