Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2014-04-23 03:22:16 +0400
committerBryan Drewery <bryan@shatow.net>2014-04-23 03:22:16 +0400
commit21b999f91f797b1d4889e329d52abc6971a61824 (patch)
treecc5a75b9c3d2b9e581ac845ae46a871b5c9ce6dc
parent43cf5a40b4c2e539323b88df1902fb741282d112 (diff)
status/SIGINFO: Show elapsed build time since start until end
Idea taken from marino's combo script
-rwxr-xr-xsrc/share/poudriere/common.sh29
-rwxr-xr-xsrc/share/poudriere/status.sh19
2 files changed, 38 insertions, 10 deletions
diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh
index ddeadd27..e261c293 100755
--- a/src/share/poudriere/common.sh
+++ b/src/share/poudriere/common.sh
@@ -437,9 +437,10 @@ siginfo_handler() {
local nbq=$(bget stats_queued 2>/dev/null || echo 0)
local ndone=$((nbb + nbf + nbi + nbs))
local nbtobuild=$((nbq - ndone))
+ local log=$(log_path)
local queue_width=2
local now
- local j
+ local j elapsed
local pkgname origin phase buildtime
local format_origin_phase format_phase
@@ -454,12 +455,16 @@ siginfo_handler() {
queue_width=3
fi
- printf "[${MASTERNAME}] [${status}] Queued: %-${queue_width}d Built: %-${queue_width}d Failed: %-${queue_width}d Skipped: %-${queue_width}d Ignored: %-${queue_width}d Tobuild: %-${queue_width}d \n" \
- ${nbq} ${nbb} ${nbf} ${nbs} ${nbi} ${nbtobuild}
+ now=$(date +%s)
+ calculate_elapsed ${now} ${log}
+ elapsed=${_elapsed_time}
+ buildtime=$(date -j -u -r ${elapsed} "+%H:%M:%S")
+
+ printf "[${MASTERNAME}] [${status}] Queued: %-${queue_width}d Built: %-${queue_width}d Failed: %-${queue_width}d Skipped: %-${queue_width}d Ignored: %-${queue_width}d Tobuild: %-${queue_width}d Time: %s \n" \
+ ${nbq} ${nbb} ${nbf} ${nbs} ${nbi} ${nbtobuild} "${buildtime}"
# Skip if stopping or starting jobs
if [ -n "${JOBS}" -a "${status#starting_jobs:}" = "${status}" -a "${status}" != "stopping_jobs:" ]; then
- now=$(date +%s)
format_origin_phase="\t[%s]: %-32s %-15s (%s)\n"
format_phase="\t[%s]: %15s\n"
@@ -480,6 +485,7 @@ siginfo_handler() {
if [ -n "${origin}" -a "${origin}" != "${status}" ]; then
cache_get_pkgname pkgname "${origin}"
# Find the buildtime for this pkgname
+ buildtime=
for pkgname_buildtime in $pkgname_buildtimes; do
[ "${pkgname_buildtime%!*}" = "${pkgname}" ] || continue
buildtime="${pkgname_buildtime#*!}"
@@ -2087,6 +2093,21 @@ calculate_tobuild() {
echo ${nremaining}
}
+calculate_elapsed() {
+ [ $# -eq 2 ] || eargs calculate_elapsed now log
+ local now="$1"
+ local log="$2"
+ start_end_time=$(stat -f '%B %m' ${log}/.poudriere.status)
+ start_time=${start_end_time% *}
+ case "${status}" in
+ sigint:|crashed:|stop:) end_time=${start_end_time#* } ;;
+ *) end_time=${now} ;;
+ esac
+ _start_time=${start_time}
+ _end_time=${end_time}
+ _elapsed_time=$((${end_time} - ${start_time}))
+}
+
# Build ports in parallel
# Returns when all are built.
parallel_build() {
diff --git a/src/share/poudriere/status.sh b/src/share/poudriere/status.sh
index 8d53d967..388d726a 100755
--- a/src/share/poudriere/status.sh
+++ b/src/share/poudriere/status.sh
@@ -99,6 +99,7 @@ if [ ${ALL} -eq 0 ] && \
fi
POUDRIERE_BUILD_TYPE=bulk
+now="$(date +%s)"
if [ -n "${JAILNAME}" ]; then
MASTERNAME=${JAILNAME}-${PTNAME}${SETNAME:+-${SETNAME}}
@@ -115,9 +116,10 @@ if [ -n "${JAILNAME}" ]; then
JOBS="${builders}" siginfo_handler
else
if [ ${SCRIPT_MODE} -eq 0 ]; then
- format="%-40s %-25s %6s %5s %6s %7s %7s %7s %s"
+ format="%-40s %-25s %6s %5s %6s %7s %7s %7s %9s %s"
printf "${format}" "JAIL" "STATUS" "QUEUED" \
- "BUILT" "FAILED" "SKIPPED" "IGNORED" "TOBUILD"
+ "BUILT" "FAILED" "SKIPPED" "IGNORED" "TOBUILD" \
+ "TIME"
if [ -n "${URL_BASE}" ] && [ ${URL} -eq 1 ]; then
echo -n "URL"
else
@@ -125,7 +127,7 @@ else
fi
echo
else
- format="%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s"
+ format="%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s"
fi
for mastermnt in ${POUDRIERE_DATA}/logs/bulk/*; do
# Check empty dir
@@ -149,14 +151,19 @@ else
nbskipped=$(bget stats_skipped 2>/dev/null || :)
nbbuilt=$(bget stats_built 2>/dev/null || :)
nbtobuild=$((nbqueued - (nbbuilt + nbfailed + nbskipped + nbignored)))
- url=
+
+ log="$(log_path)"
+ calculate_elapsed ${now} ${log}
+ elapsed=${_elapsed_time}
+ time=$(date -j -u -r ${elapsed} "+%H:%M:%S")
+
if [ -n "${URL_BASE}" ] && [ ${URL} -eq 1 ]; then
url="${URL_BASE}/${POUDRIERE_BUILD_TYPE}/${MASTERNAME}/${BUILDNAME}"
else
- url="$(log_path)"
+ url="${log}"
fi
printf "${format}\n" "${MASTERNAME}" "${status}" "${nbqueued}" \
"${nbbuilt}" "${nbfailed}" "${nbskipped}" "${nbignored}" \
- "${nbtobuild}" "${url}"
+ "${nbtobuild}" "${time}" "${url}"
done
fi