Patchwork scripts/runqemu: grep for line beginning with TMPDIR

login
register
mail settings
Submitter Khem Raj
Date Aug. 2, 2011, 1:47 a.m.
Message ID <1312249633-23675-1-git-send-email-raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/9027/
State New, archived
Headers show

Comments

Khem Raj - Aug. 2, 2011, 1:47 a.m.
Currently the grep regexp matches any occurance of
'TMPDIR=' but if you have another variable defined
e.g. OE_BUILD_TMPDIR=xxx then that gets picked up
too.

$ bitbake -e | grep TMPDIR=\"
TMPDIR="/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc"
OE_BUILD_TMPDIR="/home/kraj/work/angstrom/build/tmp-angstrom_2010_x"

So we become a bit more stringent and look for
line starting with TMPDIR

$ bitbake -e | grep ^TMPDIR=\"
TMPDIR="/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc"

make sure that it greps
only TMPDIR=xxx occurance and not values of other variables
whose names happens to end with TMPDIR

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 scripts/runqemu |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Richard Purdie - Aug. 2, 2011, 11:43 a.m.
On Mon, 2011-08-01 at 18:47 -0700, Khem Raj wrote:
> Currently the grep regexp matches any occurance of
> 'TMPDIR=' but if you have another variable defined
> e.g. OE_BUILD_TMPDIR=xxx then that gets picked up
> too.
> 
> $ bitbake -e | grep TMPDIR=\"
> TMPDIR="/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc"
> OE_BUILD_TMPDIR="/home/kraj/work/angstrom/build/tmp-angstrom_2010_x"
> 
> So we become a bit more stringent and look for
> line starting with TMPDIR
> 
> $ bitbake -e | grep ^TMPDIR=\"
> TMPDIR="/home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc"
> 
> make sure that it greps
> only TMPDIR=xxx occurance and not values of other variables
> whose names happens to end with TMPDIR

Merged to master, thanks.

Richard

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index dacaf7c..9611c64 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -271,7 +271,7 @@  setup_tmpdir() {
             exit 1; }
 
         # We have bitbake in PATH, get TMPDIR from bitbake
-        TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
+        TMPDIR=`bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
         if [ -z "$TMPDIR" ]; then
             echo "Error: this script needs to be run from your build directory,"
             echo "or you need to explicitly set TMPDIR in your environment"