Merge pull request #166827 from Artturin/addtimeprint

Artturi e2166cd2 29bffe5a

Changed files
+23
pkgs
stdenv
generic
+23
pkgs/stdenv/generic/setup.sh
···
}
genericBuild() {
if [ -f "${buildCommandPath:-}" ]; then
source "$buildCommandPath"
···
showPhaseHeader "$curPhase"
dumpVars
# Evaluate the variable named $curPhase if it exists, otherwise the
# function named $curPhase.
eval "${!curPhase:-$curPhase}"
if [ "$curPhase" = unpackPhase ]; then
# make sure we can cd into the directory
···
}
+
showPhaseFooter() {
+
local phase="$1"
+
local startTime="$2"
+
local endTime="$3"
+
local delta=$(( endTime - startTime ))
+
(( $delta < 30 )) && return
+
+
local H=$((delta/3600))
+
local M=$((delta%3600/60))
+
local S=$((delta%60))
+
echo -n "$phase completed in "
+
(( $H > 0 )) && echo -n "$H hours "
+
(( $M > 0 )) && echo -n "$M minutes "
+
echo "$S seconds"
+
}
+
+
genericBuild() {
if [ -f "${buildCommandPath:-}" ]; then
source "$buildCommandPath"
···
showPhaseHeader "$curPhase"
dumpVars
+
local startTime=$(date +"%s")
+
# Evaluate the variable named $curPhase if it exists, otherwise the
# function named $curPhase.
eval "${!curPhase:-$curPhase}"
+
+
local endTime=$(date +"%s")
+
+
showPhaseFooter "$curPhase" "$startTime" "$endTime"
if [ "$curPhase" = unpackPhase ]; then
# make sure we can cd into the directory