Skip to contentSkip to conversation

runqemu path fix

PATCH New Scott Garman 1 participant 3 messages Sep 26, 2012

lore
Share & tools
lore
#0 lore raw

cover runqemu path fix

Hello,

This is a bugfix for YOCTO #3101.

Since bitbake doesn't like empty PATH elements, prevent the runqemu-internal script from creating this situation when CROSSPATH is not set, and reveal bitbake errors to users to make it easier to troubleshoot future errors along these lines.

Scott

The following changes since commit a8edf79fce381d0433f18bd38df6cd74008e5179:

bitbake: fetch2/git: Don't use deprecated API (2012-09-25 15:55:57 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib sgarman/runqemu-path-fix
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=sgarman/runqemu-path-fix

Scott Garman (2):
oe-find-native-sysroot: show bitbake errors to user
runqemu-internal: don't append an empty element to PATH

 scripts/oe-find-native-sysroot |   29 +++++++++++++++++++----------
 scripts/runqemu-internal       |    6 +++++-
 2 files changed, 24 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 oe-find-native-sysroot: show bitbake errors to user

Ran into another bug that was masked by hiding a bitbake error message. This catches this situation and displays the error to the user.

Also includes whitespace fixes.

---
 scripts/oe-find-native-sysroot |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)
scripts/oe-find-native-sysroot +19 -10
index b2c22aa..9df9b44 100755
@@ -30,31 +30,40 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
+if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then
     BITBAKE=`which bitbake 2> /dev/null`
     if [ "x$BITBAKE" != "x" ]; then
-	if [ "$UID" = "0" ]; then
+        if [ "$UID" = "0" ]; then
             # Root cannot run bitbake unless sanity checking is disabled
             if [ ! -d "./conf" ]; then
-		echo "Error: root cannot run bitbake by default, and I cannot find a ./conf directory to be able to disable sanity checking"
-		exit 1
+                echo "Error: root cannot run bitbake by default, and I cannot find a ./conf directory to be able to disable sanity checking"
+                exit 1
             fi
             touch conf/sanity.conf
             OECORE_NATIVE_SYSROOT=`bitbake -e | grep ^STAGING_DIR_NATIVE | cut -d '=' -f2 | cut -d '"' -f2`
             rm -f conf/sanity.conf
-	else
+        else
             OECORE_NATIVE_SYSROOT=`bitbake -e | grep ^STAGING_DIR_NATIVE | cut -d '=' -f2 | cut -d '"' -f2`
-	fi
+        fi
     else
-	echo "Error: Unable to locate your native sysroot."
-	echo "Did you forget to source the build environment setup script?"
+        echo "Error: Unable to locate bitbake command."
+        echo "Did you forget to source the build environment setup script?"
 
-	if [ -z "$SKIP_STRICT_SYSROOT_CHECK" ]; then
+        if [ -z "$SKIP_STRICT_SYSROOT_CHECK" ]; then
             exit 1
-	fi
+        fi
     fi
 fi
 
+if [ "x$OECORE_NATIVE_SYSROOT" = "x" ]; then
+    # This indicates that there was an error running bitbake -e that
+    # the user needs to be informed of
+    echo "There was an error running bitbake to determine STAGING_DIR_NATIVE"
+    echo "Here is the output from bitbake -e"
+    bitbake -e
+    exit 1
+fi
+
 # Set up pseudo command
 if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" ]; then
     echo "Error: Unable to find pseudo binary in $OECORE_NATIVE_SYSROOT/usr/bin/"
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 runqemu-internal: don't append an empty element to PATH

In reply to Scott Garman

Bitbake fails to run when an empty element exists in $PATH. Avoid creating this situation when $CROSSPATH is not set.

This fixes bug [YOCTO #3101]

---
 scripts/runqemu-internal |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/runqemu-internal +5 -1
index 6b8bb65..0f07bad 100755
@@ -472,7 +472,11 @@ if [ "x$QEMUOPTIONS" = "x" ]; then
     return
 fi
 
-PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
+if [ "x$CROSSPATH" = "x" ]; then
+    PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
+else
+    PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
+fi
 
 QEMUBIN=`which $QEMU 2> /dev/null`
 if [ ! -x "$QEMUBIN" ]; then
Signature · 1 line
1.7.9.5