summaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-03-19 23:02:21 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-03-19 23:02:21 (GMT)
commit7bfa4139adfb9175ade8787a425a3baedee7a748 (patch)
treecd9235736a2755658e7706a16aed7de89820f52b /scripts/functions
parenta5d9facb144a937e56b484fb8f23ec68ada94598 (diff)
scripts: leave changelog in build dir, copy to install dir
Users tend to look for the build log in the current working directory, rather than in the toolchain's installation dir. While bundling the build log in the toolchain installation dir is nice for distribution and review, it can be easier to have the build log readily available in the working directory, as it is quicker to get to it. So, the build log stays in the working directory until the toolchain is completely and successfully built, and then a (compressed) copy is made. Reported-by: Trevor Woerner <twoerner@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'scripts/functions')
-rw-r--r--scripts/functions43
1 files changed, 20 insertions, 23 deletions
diff --git a/scripts/functions b/scripts/functions
index f744d53..3849594 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -15,7 +15,7 @@ CT_OnError() {
for((depth=2; ${BASH_LINENO[$((${depth}-1))]}>0; depth++)); do
CT_DoLog ERROR " called from '${BASH_SOURCE[${depth}]}' at line # ${BASH_LINENO[${depth}-1]} in function '${FUNCNAME[${depth}]}'"
done
- [ "${CT_LOG_TO_FILE}" = "y" ] && CT_DoLog ERROR "Look at '${CT_LOG_FILE}' for more info on this error."
+ [ "${CT_LOG_TO_FILE}" = "y" ] && CT_DoLog ERROR "Look at '${tmp_log_file}' for more info on this error."
CT_STEP_COUNT=1
CT_DoEnd ERROR
exit $ret
@@ -40,8 +40,9 @@ set +o hashall
# Log policy:
# - first of all, save stdout so we can see the live logs: fd #6
exec 6>&1
-# - then point stdout to the log file (temporary for now)
-tmp_log_file="${CT_TOP_DIR}/log.$$"
+# - then point stdout to the log file
+tmp_log_file="${CT_TOP_DIR}/build.log"
+rm -f "${tmp_log_file}"
exec >>"${tmp_log_file}"
# The different log levels:
@@ -1024,15 +1025,13 @@ CT_DoSaveState() {
CT_DoTarballIfExists "${CT_CC_CORE_SHARED_PREFIX_DIR}" "${state_dir}/cc_core_shared_prefix_dir"
CT_DoTarballIfExists "${CT_PREFIX_DIR}" "${state_dir}/prefix_dir" --exclude '*.log'
- if [ "${CT_LOG_TO_FILE}" = "y" ]; then
- CT_DoLog STATE " Saving log file"
- exec >/dev/null
- case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
- y) gzip -3 -c "${CT_LOG_FILE}" >"${state_dir}/log.gz";;
- *) cat "${CT_LOG_FILE}" >"${state_dir}/log";;
- esac
- exec >>"${CT_LOG_FILE}"
- fi
+ CT_DoLog STATE " Saving log file"
+ exec >/dev/null
+ case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
+ y) gzip -3 -c "${tmp_log_file}" >"${state_dir}/log.gz";;
+ *) cat "${tmp_log_file}" >"${state_dir}/log";;
+ esac
+ exec >>"${tmp_log_file}"
}
# This function restores a previously saved state
@@ -1072,15 +1071,13 @@ CT_DoLoadState(){
CT_STOP="${old_STOP}"
unset old_stop old_restart
- if [ "${CT_LOG_TO_FILE}" = "y" ]; then
- CT_DoLog STATE " Restoring log file"
- exec >/dev/null
- case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
- y) zcat "${state_dir}/log.gz" >"${CT_LOG_FILE}";;
- *) cat "${state_dir}/log" >"${CT_LOG_FILE}";;
- esac
- cat "${state_dir}/tail.log" >>"${CT_LOG_FILE}"
- exec >>"${CT_LOG_FILE}"
- rm -f "${state_dir}/tail.log"
- fi
+ CT_DoLog STATE " Restoring log file"
+ exec >/dev/null
+ case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
+ y) zcat "${state_dir}/log.gz" >"${tmp_log_file}";;
+ *) cat "${state_dir}/log" >"${tmp_log_file}";;
+ esac
+ cat "${state_dir}/tail.log" >>"${tmp_log_file}"
+ exec >>"${tmp_log_file}"
+ rm -f "${state_dir}/tail.log"
}