#!/bin/sh
# filter content of build-logs for display on the webserver
# shellcheck disable=SC2119,SC2120
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
# TODO: remove hard-coded package suffixes
{
printf '%s\n' \
'' \
'
' \
'Output of namcap of successful builds' \
'' \
'' \
'' \
''
printf ''
printf '%s | ' \
' ' \
'package' \
'type' \
'message'
printf '
\n'
find "${build_log_directory}/success" -maxdepth 1 \( \
-name '*.pkg.tar.xz-namcap.log.gz' \
-o -name '*.pkg.tar.zst-namcap.log.gz' \
\) -execdir zcat {} \; | \
sed '
/^Checking \(PKGBUILD\|\S\+\(-[^-]\+\)\{3\}\.pkg\.tar\.\(xz\|zst\)\)$/d
/ on your system is a testing release$/d
s/^PKGBUILD\s\+(\([^) ]\+\))\s\+/\1 /
s/^./\0 /
' | \
sort -u | \
sort -k2,2 -k3,3 -k1,1 -k4 | \
while read -r a b c d; do
c="${c%:}"
if [ "${c}" = 'E' ]; then
color='FF'
else
color='80'
fi
case "${a}" in
'+')
color="${color}0000"
;;
'-')
color="00${color}00"
;;
*)
color="0000${color}"
esac
printf ''
printf '%s | ' \
"${a}" "${b}" "${c}" "${d}"
printf '
\n'
done
printf '%s\n' \
'
' \
'' \
''
} > \
"${webserver_directory}/namcap-outputs.html"
{
printf '%s\n' \
'' \
'' \
'packages with text relocations' \
'' \
''
find "${webserver_directory}/build-logs/success" -name '*-namcap.log.gz' \
-exec zgrep -q '^[+*].*\sELF file (.*) has text relocations\.$' '{}' \; \
-printf '%f\n' | \
sort | \
sed '
s|-namcap\.log\.gz$|
|
'
printf '%s\n' \
'' \
''
} > \
"${webserver_directory}/text-relocations-packages.html"