aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2023-04-27 20:40:44 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2023-04-27 20:40:44 +0000
commite020aa37b85805eb9937f10a50ed5ec34eab35c4 (patch)
treec369cd5933ab896b5653e5825ccac9c7a17648fd
parent08ed87514f9286f557794756eeb519456c2ecfa9 (diff)
downloadsrc-e020aa37b85805eb9937f10a50ed5ec34eab35c4.tar.gz
src-e020aa37b85805eb9937f10a50ed5ec34eab35c4.zip
jobs.mk report JOB_ARGS log and JOB_LOG_START
At the start of a job include info such as JOB_ARGS the log location and anything in JOB_LOG_START (eg TARGET_SPEC=${TARGET_SPEC})
-rw-r--r--share/mk/jobs.mk17
1 files changed, 13 insertions, 4 deletions
diff --git a/share/mk/jobs.mk b/share/mk/jobs.mk
index f465ea06310b..62fe9eeae030 100644
--- a/share/mk/jobs.mk
+++ b/share/mk/jobs.mk
@@ -1,4 +1,4 @@
-# $Id: jobs.mk,v 1.7 2023/04/18 23:32:28 sjg Exp $
+# $Id: jobs.mk,v 1.9 2023/04/27 18:10:27 sjg Exp $
#
# @(#) Copyright (c) 2012-2023, Simon J. Gerraty
#
@@ -38,21 +38,30 @@ now_utc ?= ${%s:L:gmtime}
start_utc := ${now_utc}
.endif
-.info ${.newline}${TIME_STAMP} Start ${.TARGETS}
-
.if make(*-jobs)
+.info ${.newline}${TIME_STAMP} Start ${.TARGETS}
JOB_LOGDIR ?= ${SRCTOP:H}
JOB_LOG = ${JOB_LOGDIR}/${.TARGET:S,-jobs,,:S,/,_,g}.log
JOB_LOG_GENS ?= 4
# we like to rotate logs
.if empty(NEWLOG_SH)
+.for d in ${.SYSPATH:U${.PARSEDIR}:@x@$x $x/scripts@}
+.if exists($d/newlog.sh)
+NEWLOG_SH := $d/newlog.sh
+.if ${MAKE_VERSION} > 20220924
+.break
+.endif
+.endif
+.endfor
+.if empty(NEWLOG_SH)
.ifdef M_whence
NEWLOG_SH := ${newlog.sh:L:${M_whence}}
.else
NEWLOG_SH := ${(type newlog.sh) 2> /dev/null:L:sh:M/*}
.endif
.endif
+.endif
.if !empty(NEWLOG_SH) && exists(${NEWLOG_SH})
NEWLOG := sh ${NEWLOG_SH}
JOB_NEWLOG_ARGS ?= -S -n ${JOB_LOG_GENS}
@@ -72,7 +81,7 @@ JOB_ARGS+= -j${JOB_MAX}
# build orchestration works as expected (DIRDEPS_BUILD)
${.TARGETS:M*-jobs}:
@${NEWLOG} ${JOB_NEWLOG_ARGS} ${JOB_LOG}
- @echo Logging to ${JOB_LOG}
+ @echo "${TIME_STAMP} Start ${.TARGET:S,-jobs,,} ${JOB_ARGS} ${JOB_LOG_START} log=${JOB_LOG}" | tee ${JOB_LOG}
@cd ${.CURDIR} && env MAKELEVEL=0 \
${.MAKE} ${JOB_ARGS} _TARGETS=${.TARGET:S,-jobs,,} ${.TARGET:S,-jobs,,} >> ${JOB_LOG} 2>&1