From 75df431b9458615bea97a50d2d578c3821833ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Sun, 23 Dec 2018 16:00:17 +0000 Subject: subr/build_init.subr:build_init(): rename build logs from previous builds w/ appended modification time postfix. subr/build_init.subr:build_init(): turn ${DEFAULT_BUILD_LOG_LAST_FNAME} into symbolic link to last previous build log. --- subr/build_init.subr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'subr') diff --git a/subr/build_init.subr b/subr/build_init.subr index a76b9c42..7e52a280 100644 --- a/subr/build_init.subr +++ b/subr/build_init.subr @@ -9,7 +9,7 @@ build_fini() { }; build_init() { - local __="" _env_vars="" _env_vars_except="" _env_var=""; + local __="" _env_vars="" _env_vars_except="" _env_var="" _log_last_fname="" _log_last_ts=""; set -o noglob; umask 022; if [ -z "${DEFAULT_BUILD_CPUS}" ]\ && [ -e /proc/cpuinfo ]; then @@ -65,7 +65,11 @@ build_init() { touch "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}"; fi; if [ -e "${DEFAULT_BUILD_LOG_FNAME}" ]; then - ex_rtl_fileop mv "${DEFAULT_BUILD_LOG_FNAME}" "${DEFAULT_BUILD_LOG_LAST_FNAME}"; + _log_last_ts="$(stat -c %Y "${DEFAULT_BUILD_LOG_FNAME}")"; + _log_last_ts="$(awk 'BEGIN {printf(strftime("%Y-%m-%d-%H-%M-%S", '"${_log_last_ts}"'))}')"; + _log_last_fname="${DEFAULT_BUILD_LOG_FNAME}.${_log_last_ts}"; + ex_rtl_fileop mv "${DEFAULT_BUILD_LOG_FNAME}" "${_log_last_fname}"; + ex_rtl_fileop ln_symbolic "${_log_last_fname}" "${DEFAULT_BUILD_LOG_LAST_FNAME}"; fi; ex_rtl_fileop touch "${DEFAULT_BUILD_LOG_FNAME}"; BUILD_IS_PARENT=1; -- cgit v1.2.3