From c469a51c4085338fdf17b77dc32cee580c6f7c5d Mon Sep 17 00:00:00 2001 From: Darragh Elliott Date: Thu, 15 Aug 2024 11:33:21 +0200 Subject: [PATCH] More fixes for status pages --- .gitignore | 4 +-- build/buildrun.sh | 4 +-- status.fsfe.org/fsfe.org/index.cgi | 41 ++++++++++++++++-------------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index b23611d297..265626b650 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,5 @@ tags/tagged-*.en.xhtml tags/.tags.??.xml ## Status dir stuff -status.fsfe.org/*fsfe.org/* -!status.fsfe.org/*fsfe.org/index.cgi -!status.fsfe.org/*fsfe.org/template.en.xhtml +status.fsfe.org/*fsfe.org/data/* status.fsfe.org/translations/data/* diff --git a/build/buildrun.sh b/build/buildrun.sh index 47443c5206..282fb7533c 100755 --- a/build/buildrun.sh +++ b/build/buildrun.sh @@ -71,7 +71,7 @@ buildrun(){ { for destination in ${target//,/ }; do echo "Syncing files to $(echo "$destination" | grep -Po "(?<=@)[^:]+")" - rsync -av --copy-unsafe-links --del "$stagedir/" "$destination/" | grep -v "copying unsafe symlink" + rsync -av --copy-unsafe-links --del --exclude "status.fsfe.org/*fsfe.org/data" "$stagedir/" "$destination/" | grep -v "copying unsafe symlink" done } | t_logstatus stagesync fi @@ -79,7 +79,7 @@ buildrun(){ date +%s > "$(logname end_time)" if [ -n "$statusdir" ]; then - ( cd "$statusdir"; ./index.cgi | tail -n+3 > status_$(date +%s).html ) + ( cd "$statusdir"; ./../index.cgi | tail -n+3 > status_$(date +%s).html ) fi } diff --git a/status.fsfe.org/fsfe.org/index.cgi b/status.fsfe.org/fsfe.org/index.cgi index bc3531df8f..dfc9e2482c 100755 --- a/status.fsfe.org/fsfe.org/index.cgi +++ b/status.fsfe.org/fsfe.org/index.cgi @@ -14,6 +14,9 @@ timestamp() { date -d "@$1" +"%F %T (%Z)" } +DATADIR="data" +readonly DATADIR + duration() { minutes=$(($1 / 60)) if [ "${minutes}" == "1" ]; then @@ -39,14 +42,14 @@ htmlcat() { s;'\'';\&apos\;;g;' $@ } -start_time=$(cat "start_time" || stat -c %Y "$0" || echo 0) -t_gitupdate=$(stat -c %Y "GITlatest" || echo 0) -t_phase_1=$(stat -c %Y "phase_1" || echo 0) -t_makefile=$(stat -c %Y "Makefile" || echo 0) -t_phase_2=$(stat -c %Y "phase_2" || echo 0) -t_manifest=$(stat -c %Y "manifest" || echo 0) -t_stagesync=$(stat -c %Y "stagesync" || echo 0) -end_time=$(cat "end_time" || echo 0) +start_time=$(cat "$DATADIR/start_time" || stat -c %Y "$0" || echo 0) +t_gitupdate=$(stat -c %Y "$DATADIR/GITlatest" || echo 0) +t_phase_1=$(stat -c %Y "$DATADIR/phase_1" || echo 0) +t_makefile=$(stat -c %Y "$DATADIR/Makefile" || echo 0) +t_phase_2=$(stat -c %Y "$DATADIR/phase_2" || echo 0) +t_manifest=$(stat -c %Y "$DATADIR/manifest" || echo 0) +t_stagesync=$(stat -c %Y "$DATADIR/stagesync" || echo 0) +end_time=$(cat "$DATADIR/end_time" || echo 0) duration=$(($end_time - $start_time)) term_status=$(if [ "$duration" -gt 0 -a -f lasterror ]; then echo Error @@ -64,7 +67,7 @@ cat <<-HTML_END
Duration:
$([ "$duration" -gt 0 ] && duration ${duration})
Termination Status:
${term_status:-running...}
-$(if [ ./full_build -nt ./index.cgi ]; then +$(if [ ./$DATADIR/full_build -nt ./index.cgi ]; then printf 'Full rebuild will be started within next minute.' else printf 'Schedule full rebuild' @@ -74,7 +77,7 @@ fi)
latest
$( - ls -t status_*.html | head -n10 | while read stat; do + ls -t "$DATADIR"/status_*.html | head -n10 | while read stat; do t="${stat#status_}" t="${t%.html}" printf '%s - %s
' \ @@ -90,7 +93,7 @@ $( $( if [ ${start_time} -le ${t_gitupdate} ]; then echo "at $(timestamp ${t_gitupdate})" \ - "
$(htmlcat GITlatest)
" \ + "
$(htmlcat "$DATADIR"/GITlatest)
" \ "checked" else echo "Unconditional build, changes ignored" @@ -104,10 +107,10 @@ $( $( if [ $start_time -lt $t_phase_1 -a $start_time -lt $t_gitupdate ]; then echo "$(duration $(($t_phase_1 - $t_gitupdate)))" \ - "
$(htmlcat phase_1)
" + "
$(htmlcat "$DATADIR"/phase_1)
" elif [ $start_time -lt $t_phase_1 ]; then echo "$(duration $(($t_phase_1 - $start_time)))" \ - "
$(htmlcat phase_1)
" + "
$(htmlcat "$DATADIR"/phase_1)
" else echo "waiting" fi @@ -121,7 +124,7 @@ $( $( if [ $start_time -lt $t_makefile ]; then echo "$(duration $(($t_makefile - $t_phase_1)))" \ - "
$(htmlcat Makefile)
" + "
$(htmlcat "$DATADIR"/Makefile)
" else echo "waiting" fi @@ -134,7 +137,7 @@ $( $( if [ $start_time -lt $t_phase_2 ]; then echo "$(duration $(($t_phase_2 - $t_makefile)))" \ - "
$(htmlcat phase_2)
" + "
$(htmlcat "$DATADIR"/phase_2)
" else echo "waiting" fi @@ -147,7 +150,7 @@ $( $( if [ ${start_time} -lt ${t_stagesync} -a -s stagesync ]; then echo "$(($(wc -l stagesync | cut -f1 -d\ ) - 4)) updated files" \ - "
$(htmlcat stagesync)
" + "
$(htmlcat "$DATADIR"/stagesync)
" elif [ -z ${term_status} ]; then echo "waiting" else @@ -162,7 +165,7 @@ $( $( if [ -f lasterror ]; then echo "There were errors" \ - "
$(htmlcat lasterror)
" \ + "
$(htmlcat "$DATADIR"/lasterror)
" \ "checked" else echo "none" @@ -175,8 +178,8 @@ $(
$( if [ $start_time -lt $t_manifest ]; then - echo "$(wc -l manifest | cut -d\-f1) files" \ - "view" + echo "$(wc -l "$DATADIR"/manifest | cut -d\-f1) files" \ + "view" else echo "waiting" fi