diff --git a/collects/meta/build/build b/collects/meta/build/build index 776b6b5cff..51a2227a05 100755 --- a/collects/meta/build/build +++ b/collects/meta/build/build @@ -14,8 +14,8 @@ if [ "${BASH_VERSION:-not_bash}" = "not_bash" ]; then exec bash "$0" "$@"; fi # verbose output? verbose="yes" -# should we record an external log at $scriptlogfile? ("only" means only there) -scriptlog="yes" +# should we record an external log at $buildlogfile? ("only" means only there) +buildlog="yes" # should we make binaries? make_bins="ask_or_yes" # should we do a repository update? @@ -173,7 +173,7 @@ unixinstallerscript="$unixinstallerdir/installer-header" # full clean tgz before building anything (relative to $maindir) cleantgz="${installdir}-clean-tree.tgz" # log file for this script (relative to $maindir) -scriptlogfile="build-log.txt" +buildlogfile="build-log.txt" # name of html files to generate for web directories index="index.html" # timestamp and version file for automatic scripts (relative to $maindir) @@ -198,6 +198,8 @@ repotgz="$tmpdir/$cleantgz" fulltgz="$tmpdir/$installdir-full.tgz" # log file name prefix for background jobs bglogfile="$tmpdir/bg-log" +# absolute prefix name for the web-available current log symlinks +curlog_prefix="$maindir/$prewebdir_default/current" last_part() { echo "$*" | sed 's/.*[ -]//' @@ -1021,7 +1023,7 @@ MAIN_BUILD() { _run lockfile -r 0 -l 10800 "$lockfile" trap cleanup_run_files 0 3 9 15 - # cleanup bg logs early so the status won't show bogus leftovers + # cleanup old bg logs early so the status won't show bogus leftovers _rm "$bglogfile-"* ## -------------------------------------------------------------------------- @@ -1095,6 +1097,7 @@ MAIN_BUILD() { header "{{{ Building ${machine}(${mplatform}) remotely }}}" _cat "$bglogfile-$machine" | grep -v "^### <<< .* >>>" _rm "$bglogfile-$machine" + _rm "$curlog_prefix-$(basename "$bglogfile-$machine")" fi done fi @@ -1154,6 +1157,8 @@ DO_COPY_BUILD() { # inputs -- machine-name (for ssh) < "$repotgz" touch "$bglogfile-$machine" chcon --type=httpd_sys_content_t "$bglogfile-$machine" + _rm "$curlog_prefix-$(basename "$bglogfile-$machine")" + _ln "$bglogfile-$machine" "$curlog_prefix-$(basename "$bglogfile-$machine")" run_part -bg "$machine" "DO_BUILD" "$releasing" "$@" \ &> "$bglogfile-$machine" else @@ -2117,8 +2122,8 @@ BUILD_PRE_WEB() { "automatic scripts)" #---- # don't copy this, since it's still being written to - _rm "$scriptlogfile"; ln "$maindir/$scriptlogfile" "$scriptlogfile" - html_file_row "$scriptlogfile" "Full build log" + _rm "$buildlogfile"; ln "$maindir/$buildlogfile" "$buildlogfile" + html_file_row "$buildlogfile" "Full build log" #---- html_table_end html_end @@ -2180,12 +2185,13 @@ BUILD_PRE_WEB() { if [[ "$prewebdir" = "$prewebdir_default" ]]; then _cd "$maindir/$prewebdir" - local target="$maindir/$prewebdir/$(basename "$statusscript")" + local target="$maindir/$prewebdir_default/$(basename "$statusscript")" { echo "#!/bin/bash" echo "" local var - for var in tmpdir lockfile statusfile statusfile_last bglogfile; do + for var in tmpdir lockfile statusfile statusfile_last \ + buildlogfile bglogfile; do local val; eval val="\$$var" echo "$var=\"$val\"" done @@ -2208,21 +2214,23 @@ if [[ "$1" = "--dispatch" ]]; then init_repo_vars # set the repository variables according to the env vars show "Working on $machine, dispatching to $go($*)" "$go" "$@" - if [[ "x$platform" = "x"]]; then show "Done working on $machine" + if [[ "x$platform" = "x" ]]; then show "Done working on $machine" else show "Done working on $machine($platform)"; fi -elif [[ "$scriptlog" = "yes" ]]; then +elif [[ "$buildlog" = "yes" ]]; then show "Working on $machine" - rm -f "$maindir/$scriptlogfile" + rm -f "$maindir/$buildlogfile" { echo "This is the build log, generated by $buildscript"; echo "" echo "Search for \"BOOM\" for any errors."; echo "" # set | grep "^[a-z].*=" | awk '{ print " " $0 }'; echo "" - } > "$maindir/$scriptlogfile" - chcon --type=httpd_sys_content_t "$maindir/$scriptlogfile" - if [[ "$scriptlog" = "only" ]]; then - exec >> "$maindir/$scriptlogfile" 2>&1 + } > "$maindir/$buildlogfile" + chcon --type=httpd_sys_content_t "$maindir/$buildlogfile" + _rm "$curlog_prefix-$buildlogfile" + _ln "$maindir/$buildlogfile" "$curlog_prefix-$buildlogfile" + if [[ "$buildlog" = "only" ]]; then + exec >> "$maindir/$buildlogfile" 2>&1 MAIN "$@" else - MAIN "$@" 2>&1 | tee -a "$maindir/$scriptlogfile" + MAIN "$@" 2>&1 | tee -a "$maindir/$buildlogfile" fi else show "Working on $machine"