merge from test: improved logging

svn path=/trunk/; revision=32019
This commit is contained in:
paul 2015-10-05 14:25:09 +00:00
parent 149bf4294b
commit ee1f7d6ab5
3 changed files with 26 additions and 3 deletions

View File

@ -18,7 +18,7 @@ build_into(){
validate_caches
make -j $ncpu -C "$basedir" \
| logstatus premake
| t_logstatus premake
dir_maker "$basedir" "$stagedir"
@ -30,13 +30,18 @@ build_into(){
| logstatus removed
make -j $ncpu -f "$(logname Makefile)" all \
| logstatus buildlog
| t_logstatus buildlog
[ "$stagedir" != "$target" ] && \
rsync -av --del "$stagedir/" "$target/" \
| logstatus stagesync
| t_logstatus stagesync
date +%s |logstatus end_time
if [ -n "$statusdir" ]; then
cd "$statusdir"
./index.cgi |tail -n+3 >status_$(date +%s).html
cd -
fi
}
svn_build_into(){

View File

@ -28,6 +28,13 @@ logstatus(){
tee "$(logname "$1")"
}
t_logstatus(){
# pipeline atom to write data streams into a log file
while read line; do
printf "[$(date +%T)] %s\n" "$line"
done |logstatus "$@"
}
logappend(){
# pipeline atom to write data streams into a log file
tee -a "$(logname "$1")"

View File

@ -49,6 +49,7 @@ term_status=$(if [ "$duration" -gt 0 -a lasterror -nt start_time ]; then
printf %s\\n\\n "Content-Type: text/html;charset=utf-8"
cat <<HTML_END
<!DOCTYPE HTML>
<html>
<head>
<title>Build status</title>
@ -153,6 +154,16 @@ label {
<dt>Termination Status:</dt><dd>${term_status:-running...}</dd>
</dl>
<h2>Previous builds</h2>$(
web_tab prev_tab '' "$(
ls -t status_*.html |head -n10 |while read stat; do
t="${stat#status_}"
t="${t%.html}"
printf '%s' "<a href=\"$stat\">$(timestamp "$t")</a> - $(sed -rn 's;^.*<dt>Duration:</dt><dd>(.+)</dd>.*$;\1;p;T;q' "$stat")<br>"
done
)"
)
<h2>SVN changes</h2>$(
if [ ${start_time} -lt ${t_svnupdate} ]; then
web_tab SVN_tab "at $(timestamp ${t_svnupdate})" "<pre>$(htmlcat SVNlatest)</pre>"