Browse Source

improved status logging

svn path=/branches/test/; revision=31863
tags/stw2018
paul 4 years ago
parent
commit
f72c5d2509
4 changed files with 21 additions and 7 deletions
  1. 2
    0
      build/build_main.sh
  2. 5
    1
      build/buildrun.sh
  3. 1
    0
      build/misc.sh
  4. 13
    6
      build/status.html.sh

+ 2
- 0
build/build_main.sh View File

@@ -2,6 +2,7 @@

basedir="$(dirname "$0")/.."
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
readonly start_time="$(date +%s)"

. "$basedir/build/arguments.sh"

@@ -23,6 +24,7 @@ if [ $command = "build_into" -o $command = "svn_build_into" ] && [ "$buildpids"
debug "build script is already running"
exit 0
fi
[ -n "$statusdir" ] && cp "$basedir/build/status.html.sh" "$statusdir/index.cgi"

[ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
[ -z "$inc_buildrun" ] && . "$basedir/build/buildrun.sh"

+ 5
- 1
build/buildrun.sh View File

@@ -9,6 +9,7 @@ inc_buildrun=true
build_into(){
ncpu="$(grep -c ^processor /proc/cpuinfo)"

printf %s "$start_time" |logstatus start_time
[ -s "$(logname debug)" ] && truncate -s 0 "$(logname debug)"
forcelog Makefile

@@ -32,6 +33,8 @@ build_into(){
[ "$stagedir" != "$target" ] && \
rsync -av --del "$stagedir/" "$target/" \
| logstatus stagesync

date +%s |logstatus end_time
}

svn_build_into(){
@@ -39,8 +42,9 @@ svn_build_into(){
forcelog SVNerrors; SVNerrors="$(logname SVNerrors)"

svn --non-interactive update "$basedir" >"$SVNchanges" 2>"$SVNerrors"
svnterm="$?"

if [ -s "$SVNerrors" ]; then
if [ "$svnterm" -ne 0 ]; then
die "SVN reported the following problem:\n" \
"$(cat "$SVNerrors")"
elif egrep '^(C...|.C..|...C) .+' "$SVNchanges"; then

+ 1
- 0
build/misc.sh View File

@@ -26,5 +26,6 @@ print_error(){

die(){
echo "$(date '+%F %T'): Fatal - $@" |logappend lasterror >&2
date +%s |logstatus end_time
exit 1
}

+ 13
- 6
build/status.html.sh View File

@@ -23,7 +23,7 @@ htmlcat(){
s;'\'';\&apos\;;g;' $@
}

start_time=$(stat -c %Y "SVNchanges" ||echo 0)
start_time=$(cat "start_time" || stat -c %Y "$0" || echo 0)
t_svnupdate=$(stat -c %Y "SVNlatest" ||echo 0)
t_premake=$(stat -c %Y "premake" ||echo 0)
t_makefile=$(stat -c %Y "Makefile" ||echo 0)
@@ -37,9 +37,13 @@ t_makerun=$(stat -c %Y "buildlog" ||echo 0)
t_errors=$(stat -c %Y "lasterror" ||echo 0)
t_removed=$(stat -c %Y "removed" ||echo 0)
t_stagesync=$(stat -c %Y "stagesync" ||echo 0)
end_time=$(stat -c %Y stagesync removed lasterror buildlog |sort -n |tail -n1)
end_time=$(cat "end_time" || echo 0)
duration=$(($end_time - $start_time))
term_status=$([ "$duration" -gt 0 -a lasterror -nt buildlog ] && echo Error || [ "$duration" -gt 0 ] && echo Success)
term_status=$(if [ "$duration" -gt 0 -a lasterror -nt start_time ]; then
echo Error
elif [ "$duration" -gt 0 ]; then
echo Success
fi)

printf %s\\n\\n "Content-Type: text/html;charset=utf-8"
cat <<HTML_END
@@ -86,6 +90,7 @@ input.tabhandle:checked + label.filled + .tabcontent {
width: auto;
height: auto;
border-style: dashed solid solid solid;
overflow: auto;
}
input.tabhandle + label::before { content: '\25b9 \00a0';}
input.tabhandle + label.filled::before { content: '\25b8 \00a0';}
@@ -167,8 +172,6 @@ label {
web_tab Makefiletab "waiting..." ""
fi)

<h2>File Manifest</h2>$(web_tab Manifesttab "Number of files: $(wc -l manifest |cut -d\ -f1), <a href=\"manifest\">view</a>" "")

<h2>Makerun</h2>$(
if [ $start_time -lt $t_makerun ]; then
web_tab Makeruntab "Build time: $(duration $(($t_makerun - $t_makefile)) )" "<pre>$(tail buildlog |htmlcat)</pre>"
@@ -183,9 +186,13 @@ label {
web_tab Errortab "none" ""
fi)

<h2>File Manifest</h2>$(web_tab Manifesttab "Number of files: $(wc -l manifest |cut -d\ -f1)" "<pre>$(tail manifest |htmlcat)</pre><a href=\"manifest\">view full</a>")

<h2>Files removed</h2>$(
if [ $start_time -lt $t_removed ]; then
if [ $start_time -lt $t_removed -a -s "removed" ]; then
web_tab Removedtab "$(wc -l removed |cut -f1 -d\ )" "<pre>$(htmlcat removed)</pre>"
elif [ $start_time -lt $t_removed ]; then
web_tab Removedtab "none" ""
elif [ -z ${term_status} ]; then
web_tab Removedtab "waiting..." ""
else

Loading…
Cancel
Save