mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-24 06:56:40 +00:00
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>
This commit is contained in:
parent
a5d9facb14
commit
7bfa4139ad
@ -18,7 +18,7 @@ config.gen/
|
|||||||
|
|
||||||
# Temporaries
|
# Temporaries
|
||||||
.*.swp
|
.*.swp
|
||||||
log.*
|
build.log
|
||||||
.config.old
|
.config.old
|
||||||
|
|
||||||
# This is the place where toolchains are built
|
# This is the place where toolchains are built
|
||||||
|
2
ct-ng.in
2
ct-ng.in
@ -165,7 +165,7 @@ version:
|
|||||||
PHONY += clean
|
PHONY += clean
|
||||||
clean::
|
clean::
|
||||||
@$(ECHO) " CLEAN log"
|
@$(ECHO) " CLEAN log"
|
||||||
$(SILENT)rm -f log.* .config.* ..config*
|
$(SILENT)rm -f build.log .config.* ..config*
|
||||||
|
|
||||||
PHONY += distclean
|
PHONY += distclean
|
||||||
distclean:: clean
|
distclean:: clean
|
||||||
|
@ -222,8 +222,6 @@ fi
|
|||||||
# Don't eradicate directories if we need to restart
|
# Don't eradicate directories if we need to restart
|
||||||
if [ -z "${CT_RESTART}" ]; then
|
if [ -z "${CT_RESTART}" ]; then
|
||||||
# Get rid of pre-existing installed toolchain and previous build directories.
|
# Get rid of pre-existing installed toolchain and previous build directories.
|
||||||
# We need to do that _before_ we can safely log, because the log file will
|
|
||||||
# most probably be in the toolchain directory.
|
|
||||||
if [ "${CT_FORCE_DOWNLOAD}" = "y" -a -d "${CT_TARBALLS_DIR}" ]; then
|
if [ "${CT_FORCE_DOWNLOAD}" = "y" -a -d "${CT_TARBALLS_DIR}" ]; then
|
||||||
CT_DoForceRmdir "${CT_TARBALLS_DIR}"
|
CT_DoForceRmdir "${CT_TARBALLS_DIR}"
|
||||||
fi
|
fi
|
||||||
@ -264,25 +262,9 @@ CT_TestAndAbort "Your file system in '${CT_PREFIX_DIR}' is *not* case-sensitive!
|
|||||||
CT_DoExecLog DEBUG rm -f "${CT_PREFIX_DIR}/foo"
|
CT_DoExecLog DEBUG rm -f "${CT_PREFIX_DIR}/foo"
|
||||||
|
|
||||||
# Kludge: CT_INSTALL_DIR and CT_PREFIX_DIR might have grown read-only if
|
# Kludge: CT_INSTALL_DIR and CT_PREFIX_DIR might have grown read-only if
|
||||||
# the previous build was successful. To be able to move the logfile there,
|
# the previous build was successful.
|
||||||
# switch them back to read/write
|
|
||||||
CT_DoExecLog ALL chmod -R u+w "${CT_INSTALL_DIR}" "${CT_PREFIX_DIR}"
|
CT_DoExecLog ALL chmod -R u+w "${CT_INSTALL_DIR}" "${CT_PREFIX_DIR}"
|
||||||
|
|
||||||
# Redirect log to the actual log file now we can
|
|
||||||
# It's quite understandable that the log file will be installed in the install
|
|
||||||
# directory, so we must first ensure it exists and is writeable (above) before
|
|
||||||
# we can log there
|
|
||||||
exec >/dev/null
|
|
||||||
case "${CT_LOG_TO_FILE}" in
|
|
||||||
y) CT_LOG_FILE="${CT_PREFIX_DIR}/build.log"
|
|
||||||
cat "${tmp_log_file}" >>"${CT_LOG_FILE}"
|
|
||||||
rm -f "${tmp_log_file}"
|
|
||||||
exec >>"${CT_LOG_FILE}"
|
|
||||||
;;
|
|
||||||
*) rm -f "${tmp_log_file}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Setting up the rest of the environment only if not restarting
|
# Setting up the rest of the environment only if not restarting
|
||||||
if [ -z "${CT_RESTART}" ]; then
|
if [ -z "${CT_RESTART}" ]; then
|
||||||
case "${CT_SYSROOT_NAME}" in
|
case "${CT_SYSROOT_NAME}" in
|
||||||
@ -624,7 +606,12 @@ CT_DoEnd INFO
|
|||||||
CT_DoLog INFO "Finishing installation (may take a few seconds)..."
|
CT_DoLog INFO "Finishing installation (may take a few seconds)..."
|
||||||
exec >/dev/null 2>&1
|
exec >/dev/null 2>&1
|
||||||
|
|
||||||
[ "${CT_LOG_FILE_COMPRESS}" = y ] && bzip2 -9 "${CT_LOG_FILE}"
|
if [ "${CT_LOG_TO_FILE}" = "y" ]; then
|
||||||
|
cp "${tmp_log_file}" "${CT_PREFIX_DIR}/build.log"
|
||||||
|
if [ "${CT_LOG_FILE_COMPRESS}" = y ]; then
|
||||||
|
bzip2 -9 "${CT_PREFIX_DIR}/build.log"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
[ "${CT_INSTALL_DIR_RO}" = "y" ] && chmod -R a-w "${CT_INSTALL_DIR}"
|
[ "${CT_INSTALL_DIR_RO}" = "y" ] && chmod -R a-w "${CT_INSTALL_DIR}"
|
||||||
[ "${CT_TEST_SUITE}" = "y" ] && chmod -R u+w "${CT_TEST_SUITE_DIR}"
|
[ "${CT_TEST_SUITE}" = "y" ] && chmod -R u+w "${CT_TEST_SUITE_DIR}"
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ CT_OnError() {
|
|||||||
for((depth=2; ${BASH_LINENO[$((${depth}-1))]}>0; depth++)); do
|
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}]}'"
|
CT_DoLog ERROR " called from '${BASH_SOURCE[${depth}]}' at line # ${BASH_LINENO[${depth}-1]} in function '${FUNCNAME[${depth}]}'"
|
||||||
done
|
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_STEP_COUNT=1
|
||||||
CT_DoEnd ERROR
|
CT_DoEnd ERROR
|
||||||
exit $ret
|
exit $ret
|
||||||
@ -40,8 +40,9 @@ set +o hashall
|
|||||||
# Log policy:
|
# Log policy:
|
||||||
# - first of all, save stdout so we can see the live logs: fd #6
|
# - first of all, save stdout so we can see the live logs: fd #6
|
||||||
exec 6>&1
|
exec 6>&1
|
||||||
# - then point stdout to the log file (temporary for now)
|
# - then point stdout to the log file
|
||||||
tmp_log_file="${CT_TOP_DIR}/log.$$"
|
tmp_log_file="${CT_TOP_DIR}/build.log"
|
||||||
|
rm -f "${tmp_log_file}"
|
||||||
exec >>"${tmp_log_file}"
|
exec >>"${tmp_log_file}"
|
||||||
|
|
||||||
# The different log levels:
|
# 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_CC_CORE_SHARED_PREFIX_DIR}" "${state_dir}/cc_core_shared_prefix_dir"
|
||||||
CT_DoTarballIfExists "${CT_PREFIX_DIR}" "${state_dir}/prefix_dir" --exclude '*.log'
|
CT_DoTarballIfExists "${CT_PREFIX_DIR}" "${state_dir}/prefix_dir" --exclude '*.log'
|
||||||
|
|
||||||
if [ "${CT_LOG_TO_FILE}" = "y" ]; then
|
CT_DoLog STATE " Saving log file"
|
||||||
CT_DoLog STATE " Saving log file"
|
exec >/dev/null
|
||||||
exec >/dev/null
|
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
||||||
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
y) gzip -3 -c "${tmp_log_file}" >"${state_dir}/log.gz";;
|
||||||
y) gzip -3 -c "${CT_LOG_FILE}" >"${state_dir}/log.gz";;
|
*) cat "${tmp_log_file}" >"${state_dir}/log";;
|
||||||
*) cat "${CT_LOG_FILE}" >"${state_dir}/log";;
|
esac
|
||||||
esac
|
exec >>"${tmp_log_file}"
|
||||||
exec >>"${CT_LOG_FILE}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function restores a previously saved state
|
# This function restores a previously saved state
|
||||||
@ -1072,15 +1071,13 @@ CT_DoLoadState(){
|
|||||||
CT_STOP="${old_STOP}"
|
CT_STOP="${old_STOP}"
|
||||||
unset old_stop old_restart
|
unset old_stop old_restart
|
||||||
|
|
||||||
if [ "${CT_LOG_TO_FILE}" = "y" ]; then
|
CT_DoLog STATE " Restoring log file"
|
||||||
CT_DoLog STATE " Restoring log file"
|
exec >/dev/null
|
||||||
exec >/dev/null
|
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
||||||
case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
|
y) zcat "${state_dir}/log.gz" >"${tmp_log_file}";;
|
||||||
y) zcat "${state_dir}/log.gz" >"${CT_LOG_FILE}";;
|
*) cat "${state_dir}/log" >"${tmp_log_file}";;
|
||||||
*) cat "${state_dir}/log" >"${CT_LOG_FILE}";;
|
esac
|
||||||
esac
|
cat "${state_dir}/tail.log" >>"${tmp_log_file}"
|
||||||
cat "${state_dir}/tail.log" >>"${CT_LOG_FILE}"
|
exec >>"${tmp_log_file}"
|
||||||
exec >>"${CT_LOG_FILE}"
|
rm -f "${state_dir}/tail.log"
|
||||||
rm -f "${state_dir}/tail.log"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user