This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Build log deceptively incomplete.


Andy, All,

On Monday 07 March 2011 20:57:23 ANDY KENNEDY wrote:
> Looking through the scripts and the build.log together, I find that,
> whereas the build log _LOOKS_ like the complete commands are there, in
> fact these aren't.
[--SNIP--]
> Now, when viewing this in the log, it omits the ENV definitions.
> 
> My question is was this intentional?  Why not make the build command
> along the lines:
> 
>     CT_DoExecLog CFG                                \
>     CC_FOR_BUILD="${CT_BUILD}-gcc"                  \
>     CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
>     LDFLAGS="${final_LDFLAGS[*]}"                   \
>     CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}"         \
>     CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}"       \
>     LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}"       \
>     "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure"  \
>         --build=${CT_BUILD}                         \
>         --host=${CT_HOST}                           \
>         --target=${CT_TARGET}                       \
>         --prefix="${CT_PREFIX_DIR}"                 \
>         ${CC_SYSROOT_ARG}                           \
>         "${extra_config[@]}"                        \
>         --with-local-prefix="${CT_SYSROOT_DIR}"     \
>         --disable-nls                               \
>         --enable-symvers=gnu                        \
>         --enable-c99                                \
>         --enable-long-long                          \
>         ${CT_CC_EXTRA_CONFIG}
> 
> So that the ENV params that are set during the build get included
> into the log?

What about the attached? Slightly tested, seems OK for me...
No CT_DoExecLog was changed in that patch, so you'll have to change some
of them locally before you can see the change.

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.  |
'------------------------------^-------^------------------^--------------------'
diff --git a/scripts/functions b/scripts/functions
--- a/scripts/functions
+++ b/scripts/functions
@@ -119,12 +119,26 @@
 }
 
 # Execute an action, and log its messages
-# Usage: [VAR=val...] CT_DoExecLog <level> <command [parameters...]>
+# It is possible to even log local variable assignments (a-la: var=val ./cmd opts)
+# Usage: CT_DoExecLog <level> [VAR=val...] <command> [parameters...]
 CT_DoExecLog() {
     local level="$1"
     shift
-    CT_DoLog DEBUG "==> Executing: '${*}'"
+    (
+    for i in "$@"; do
+        tmp_log+="'${i}' "
+    done
+    while true; do
+        case "${1}" in
+            *=*)    eval export "'${1}'"; shift;;
+            *)      break;;
+        esac
+    done
+    CT_DoLog DEBUG "==> Executing: ${tmp_log}"
     "${@}" 2>&1 |CT_DoLog "${level}"
+    )
+    # Catch failure of the sub-shell
+    [ $? -eq 0 ]
 }
 
 # Tail message to be logged whatever happens

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]