Minor improvements, mainly to the header/status suffixes.

(cherry picked from commit 3bdf05d7e1)
This commit is contained in:
Eli Barzilay 2012-01-15 20:27:20 -05:00 committed by Ryan Culpepper
parent df9c2f8d7b
commit 324234ff66

View File

@ -706,12 +706,13 @@ git_get() { # inputs: git repository, git branch, path in $maindir
} }
base_status="" base_status=""
machine_suffix=""
write_status() { write_status() {
local message="$*" local message="${*}${machine_suffix}"
if [[ "$gitbranch" != "master" ]]; then if [[ "$gitbranch" != "master" ]]; then
message="($gitbranch build) $message" message="($gitbranch build) $message"
fi fi
if [[ "$machine" = "$workmachine" ]]; then if [[ "x$machine_suffix" = "x" ]]; then
if [[ ! -e "$statusfile" ]]; then if [[ ! -e "$statusfile" ]]; then
touch "$statusfile" touch "$statusfile"
chcon --type=httpd_sys_content_t "$statusfile" chcon --type=httpd_sys_content_t "$statusfile"
@ -724,16 +725,12 @@ write_status() {
} }
header() { header() {
local suffix=""
if [[ "${machine:-$workmachine}" != "$workmachine" ]]; then
suffix=" [$machine($platform)]"
fi
local status="" local status=""
case "x$1" in case "x$1" in
( "x-s" ) shift; status="${*}${suffix}"; base_status="$*";; ( "x-s" ) shift; status="$*"; base_status="$*";;
( "x+s" ) shift; status="$base_status, ${*}${suffix}";; ( "x+s" ) shift; status="$base_status, $*";;
esac esac
local message="${*}${suffix}" local message="${*}${machine_suffix}"
local line="============================================================" local line="============================================================"
local message_len=${#message} local message_len=${#message}
local idx1=$(( ( 77 - $message_len ) / 2 )) local idx1=$(( ( 77 - $message_len ) / 2 ))
@ -1025,6 +1022,9 @@ MAIN_BUILD() {
_run lockfile -r 0 -l 10800 "$lockfile" _run lockfile -r 0 -l 10800 "$lockfile"
trap cleanup_run_files 0 3 9 15 trap cleanup_run_files 0 3 9 15
# cleanup bg logs early so the status won't show bogus leftovers
_rm "$bglogfile-"*
## -------------------------------------------------------------------------- ## --------------------------------------------------------------------------
header -s "Begin ($(date +'%Y-%m-%d %H:%M'))" header -s "Begin ($(date +'%Y-%m-%d %H:%M'))"
@ -1075,7 +1075,6 @@ MAIN_BUILD() {
header -s "Dispatching build jobs" header -s "Dispatching build jobs"
local m local m
_rm "$bglogfile-"*
if is_yes make_bins; then if is_yes make_bins; then
for m in "${machines[@]}"; do DO_COPY_BUILD "$m"; done for m in "${machines[@]}"; do DO_COPY_BUILD "$m"; done
else else
@ -2206,6 +2205,9 @@ if [[ "$1" = "--dispatch" ]]; then
machine="$1"; go="$2"; shift 2 machine="$1"; go="$2"; shift 2
init_repo_vars # set the repository variables according to the env vars init_repo_vars # set the repository variables according to the env vars
machineget platform # set the global platform for dependable script pieces machineget platform # set the global platform for dependable script pieces
if [[ "${machine:-$workmachine}" != "$workmachine" ]]; then
machine_suffix=" [$machine($platform)]"
fi
show "Working on $machine($platform)" show "Working on $machine($platform)"
show "Dispatching to $go($*)" show "Dispatching to $go($*)"
"$go" "$@" "$go" "$@"