Adding robbat2's patch for bug #62365.
authorTim Yamin <plasmaroo@gentoo.org>
Sun, 19 Sep 2004 09:12:00 +0000 (09:12 +0000)
committerTim Yamin <plasmaroo@gentoo.org>
Sun, 19 Sep 2004 09:12:00 +0000 (09:12 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@133 67a159dc-881f-0410-a524-ba9dfbe2cb84

gen_compile.sh
gen_funcs.sh
genkernel

index 61a73559a373c0b33316414c8a944c3da64f708f..e18ea680c414daee26049dab9d40a1ab875fbcbf 100644 (file)
@@ -120,28 +120,38 @@ compile_generic() {
                export_utils_args
                MAKE=${UTILS_MAKE}
        fi
-
+       case "$2" in
+               kernel) ARGS="`compile_kernel_args`" ;;
+               utils) ARGS="`compile_utils_args`" ;;
+               *) ARGS="" ;; # includes runtask
+       esac
+               
+
+       # the eval usage is needed in the next set of code
+       # as ARGS can contain spaces and quotes, eg:
+       # ARGS='CC="ccache gcc"'
        if [ "${2}" == 'runtask' ]
        then
-               print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
-               ${MAKE} -s ${MAKEOPTS/-j?/-j1} ${1}
+               print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS/-j?/j1} ${ARGS} ${1}" 1 0 1
+               eval ${MAKE} -s ${MAKEOPTS/-j?/-j1} "${ARGS}" ${1}
                RET=$?
        elif [ "${DEBUGLEVEL}" -gt "1" ]
        then
                # Output to stdout and debugfile
-               print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
-               ${MAKE} ${MAKEOPTS} ${1} 2>&1 | tee -a ${DEBUGFILE}
-               RET=$?
+               print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
+               eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} 2>&1 | tee -a ${DEBUGFILE}
+               RET=${PIPESTATUS[0]}
        else
                # Output to debugfile only
-               print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${1}" 1 0 1
-               ${MAKE} ${MAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1
+               print_info 2 "COMMAND: ${MAKE} ${MAKEOPTS} ${ARGS} ${1}" 1 0 1
+               eval ${MAKE} ${MAKEOPTS} ${ARGS} ${1} >> ${DEBUGFILE} 2>&1
                RET=$?
        fi
        [ "${RET}" -ne '0' ] &&
                gen_die "Failed to compile the \"${1}\" target..."
 
        unset MAKE
+       unset ARGS
        if [ "${2}" = 'kernel' ]
        then
                unset_kernel_args
index 7f9b3948983150f9ecab6e7cd31444c53ab4cab7..17c7e828f63b16584ad47477c9221bfa8d54852e 100755 (executable)
@@ -225,7 +225,7 @@ gen_die() {
 
 has_loop() {
        dmesg | egrep -q '^loop:'
-       if [ -e '/dev/loop0' -o -e '/dev/loop/0' -a $? ]
+       if [ -e '/dev/loop0' -o -e '/dev/loop/0' -a ${PIPESTATUS[1]} ]
        then
                # We found devfs or standard dev loop device, assume
                # loop is compiled into the kernel or the module is loaded
index 147097634b24b0120f663b8164ff1c2b64ffa362..59a52c0f724b2f138c34f29fe0f115ad1502d7d7 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -183,7 +183,7 @@ then
                echo
                eval ${CMD_CALLBACK} | tee -a ${DEBUGFILE}
                echo
-               print_info 1 "<<< Callback exit status: $?"
+               print_info 1 "<<< Callback exit status: ${PIPESTATUS[0]}"
        else
                echo
                print_info 1 ">>> Callback cancelled..."