[PATCH] Change log behaviour

Yann E. MORIN yann.morin.1998@anciens.enib.fr
Mon Mar 14 21:37:00 GMT 2011


Trevor, All,

Sorry for the delay: last week I was sick (a kind of flu that stuck
me in the sofa for most of the week, and when I was not in the sofa,
I was lying in my bed...)

On Saturday 05 March 2011 06:14:46 Trevor Woerner wrote:
> # HG changeset patch
> # User Trevor Woerner <twoerner@gmail.com>
> # Date 1299301856 18000
> # Node ID 3beab6987d73cf9c011064ebb5866c75b7fd4509
> # Parent  cd7bcbbd5cc9f2d3fafe5ac38fa15d6db1c31d14
> Change log behaviour.
> 
> Generate the (uncompressed) log file in the location where the build
> is being performed. Once the build is done, copy the log to the
> install location and, optionally, compress it (at the install location)
> if configured to do so while leaving the log in the build location
> uncompressed.

That's not quite enough, unfortunately. In this case, you'll be missing
the save/restore of the build.log in case restarting the build (see the
option DEBUG_CT_SAVE_STEPS).

I'll do the change here, and push later tonight...

> diff -r cd7bcbbd5cc9 -r 3beab6987d73 scripts/crosstool-NG.sh.in
> --- a/scripts/crosstool-NG.sh.in	Thu Mar 03 23:29:07 2011 +0100
> +++ b/scripts/crosstool-NG.sh.in	Sat Mar 05 00:10:56 2011 -0500
> @@ -274,10 +274,7 @@
>  # 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}"
> +    y)  exec >>"${tmp_log_file}"
>          ;;
>      *)  rm -f "${tmp_log_file}"
>          ;;

This whole case-esac should go. We should always log to the 'temp' log
file, as it is the log file for the build.

> @@ -624,7 +621,8 @@
>  CT_DoLog INFO "Finishing installation (may take a few seconds)..."
>  exec >/dev/null 2>&1
>  
> -[ "${CT_LOG_FILE_COMPRESS}" = y ] && bzip2 -9 "${CT_LOG_FILE}"
> +cp "${tmp_log_file}" "${CT_PREFIX_DIR}/build.log"
> +[ "${CT_LOG_FILE_COMPRESS}" = y ] && bzip2 -9 "${CT_PREFIX_DIR}/build.log"

Here, we should copy the log file only if the user asked for it in the
menuconfig;
if [ "${CT_LOG_TO_FILE}" = "y" ]; then
  if [ "${CT_LOG_FILE_COMPRESS}" = y ]; then
    bzip2 -9 -c "${tmp_log_file}" >"${CT_PREFIX_DIR}/build.log.bz2"
  else
    cp "${tmp_log_file}" "${CT_PREFIX_DIR}/build.log"
  fi
fi

And in the save/restore, always refer to the 'temp' log file, the one used
during the build.

>  [ "${CT_INSTALL_DIR_RO}" = "y"  ] && chmod -R a-w "${CT_INSTALL_DIR}"
>  [ "${CT_TEST_SUITE}" = "y" ] && chmod -R u+w "${CT_TEST_SUITE_DIR}"

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list