build.sh.functions: add timestamp printing for nolog functions
This commit is contained in:
parent
1a95962a45
commit
22aa969f36
@ -22,6 +22,8 @@
|
|||||||
autolog=1
|
autolog=1
|
||||||
# Don't log these methods
|
# Don't log these methods
|
||||||
nolog="prep distclean"
|
nolog="prep distclean"
|
||||||
|
# date format string
|
||||||
|
dateformat="%Y%m%d%H%M%S"
|
||||||
|
|
||||||
# Define script functions and register them
|
# Define script functions and register them
|
||||||
METHODS=""
|
METHODS=""
|
||||||
@ -73,6 +75,12 @@ build_sh() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Write out a timestamp
|
||||||
|
timestamp()
|
||||||
|
{
|
||||||
|
date +$dateformat
|
||||||
|
}
|
||||||
|
|
||||||
# Start a logfile
|
# Start a logfile
|
||||||
# Note this should only be used *after* the buildpkg.* libraries
|
# Note this should only be used *after* the buildpkg.* libraries
|
||||||
# have been sourced, otherwise most of the variables used to construct
|
# have been sourced, otherwise most of the variables used to construct
|
||||||
@ -80,17 +88,21 @@ build_sh() {
|
|||||||
log_start()
|
log_start()
|
||||||
{
|
{
|
||||||
local func=$1
|
local func=$1
|
||||||
build_sh_logfile=${topdir}-${version}_${pkgver}-${os}-${arch}-${func}-$(date +%Y%m%d%H%M%S).log
|
build_sh_logfile=${topdir}-${version}_${pkgver}-${os}-${arch}-${func}-$(timestamp).log
|
||||||
|
|
||||||
if [ $autolog -eq 1 -a -z "$(${__expr} "$nolog" : ".*\($func\)")" ]; then
|
if [ $autolog -eq 1 ]; then
|
||||||
# save stdout and stderr to file descriptors 3 and 4
|
if [ -z "$(${__expr} "$nolog" : ".*\($func\)")" ]; then
|
||||||
# then redirect them to $build_sh_logfile
|
# save stdout and stderr to file descriptors 3 and 4
|
||||||
echo "Opening logfile: $build_sh_logfile"
|
# then redirect them to $build_sh_logfile
|
||||||
exec 3>&1 4>&2 >$build_sh_logfile 2>&1
|
echo "Opening logfile: $build_sh_logfile"
|
||||||
# Log a timestamp
|
exec 3>&1 4>&2 >$build_sh_logfile 2>&1
|
||||||
date +%Y%m%d%H%M%S
|
# Log a timestamp
|
||||||
# Get information about the compiler into the logfile
|
timestamp
|
||||||
identify_compiler log
|
# Get information about the compiler into the logfile
|
||||||
|
identify_compiler log
|
||||||
|
else # $nolog function, just add a timestamp
|
||||||
|
timestamp
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +112,7 @@ log_stop()
|
|||||||
local func=$1
|
local func=$1
|
||||||
if [ $autolog -eq 1 -a -z "$(${__expr} "$nolog" : ".*\($func\)")" ]; then
|
if [ $autolog -eq 1 -a -z "$(${__expr} "$nolog" : ".*\($func\)")" ]; then
|
||||||
# Log a timestamp
|
# Log a timestamp
|
||||||
date +%Y%m%d%H%M%S
|
timestamp
|
||||||
# restore stdout and stderr
|
# restore stdout and stderr
|
||||||
exec 1>&3 2>&4
|
exec 1>&3 2>&4
|
||||||
echo "Closing logfile: $build_sh_logfile"
|
echo "Closing logfile: $build_sh_logfile"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user