All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix TMPDIR usage in scripts v3
@ 2011-09-28 15:28 Paul Eggleton
  2011-09-28 15:28 ` [PATCH 1/2] scripts: use OE_TMPDIR instead of TMPDIR external variable Paul Eggleton
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul Eggleton @ 2011-09-28 15:28 UTC (permalink / raw)
  To: openembedded-core

Fix TMPDIR external environment variable usage within our scripts which
is a problem on OpenSUSE within an X session (see Yocto bug #1530) by
using OE_TMPDIR from the external environment instead.

Note that this will require changes to autobuilder scripts that use a
TMPDIR environment variable when calling these scripts - they should now
set OE_TMPDIR instead (if versions with and without this change need to
be run on the same system, then setting both variables will cause no
harm).

Since v1, fix pass-through references to TMPDIR in the
qemuimage-testlib script.

Since v2, fix setting of OE_TMPDIR in classes/imagetest-qemu.bbclass.

The following changes since commit e0908b7b080c0d861a1b3ccb2185b9281b10fa1a:

  tables: remove it as obsolete recipe (2011-09-28 11:47:24 +0100)

are available in the git repository at:
  git://git.openembedded.org/openembedded-core-contrib paule/scripts-tmpdir
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/scripts-tmpdir

Paul Eggleton (2):
  scripts: use OE_TMPDIR instead of TMPDIR external variable
  scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu

 meta/classes/imagetest-qemu.bbclass |    2 +-
 scripts/oe-setup-rpmrepo            |   35 +++++++++++++++++++++--------------
 scripts/qemuimage-testlib           |    4 ++--
 scripts/runqemu                     |    7 ++++++-
 4 files changed, 30 insertions(+), 18 deletions(-)

-- 
1.7.4.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] scripts: use OE_TMPDIR instead of TMPDIR external variable
  2011-09-28 15:28 [PATCH 0/2] Fix TMPDIR usage in scripts v3 Paul Eggleton
@ 2011-09-28 15:28 ` Paul Eggleton
  2011-09-28 15:28 ` [PATCH 2/2] scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu Paul Eggleton
  2011-09-28 20:37 ` [PATCH 0/2] Fix TMPDIR usage in scripts v3 Richard Purdie
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2011-09-28 15:28 UTC (permalink / raw)
  To: openembedded-core

On OpenSUSE within an X session, TMPDIR is set to the system temporary
directory (/tmp) which is incorrect for these scripts. Thus, change
runqemu and oe-setup-rpmrepo to use OE_TMPDIR from the external
environment rather than TMPDIR.

Fixes [YOCTO #1530]

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/imagetest-qemu.bbclass |    2 +-
 scripts/oe-setup-rpmrepo            |    8 +++++++-
 scripts/qemuimage-testlib           |    4 ++--
 scripts/runqemu                     |    7 ++++++-
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass
index 18798e0..4ea86c0 100644
--- a/meta/classes/imagetest-qemu.bbclass
+++ b/meta/classes/imagetest-qemu.bbclass
@@ -70,7 +70,7 @@ def qemuimagetest_main(d):
         os.environ["DISPLAY"] = bb.data.getVar("DISPLAY", d, True)
         os.environ["COREBASE"] = bb.data.getVar("COREBASE", d, True)
         os.environ["TOPDIR"] = bb.data.getVar("TOPDIR", d, True)
-        os.environ["TMPDIR"] = bb.data.getVar("TMPDIR", d, True)
+        os.environ["OE_TMPDIR"] = bb.data.getVar("TMPDIR", d, True)
         os.environ["TEST_STATUS"] = bb.data.getVar("TEST_STATUS", d, True)
         os.environ["TARGET_IPSAVE"] = bb.data.getVar("TARGET_IPSAVE", d, True)
         os.environ["TEST_SERIALIZE"] = bb.data.getVar("TEST_SERIALIZE", d, True)
diff --git a/scripts/oe-setup-rpmrepo b/scripts/oe-setup-rpmrepo
index 03372b6..fc2f7a8 100755
--- a/scripts/oe-setup-rpmrepo
+++ b/scripts/oe-setup-rpmrepo
@@ -17,9 +17,15 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
+
+# Don't use TMPDIR from the external environment, it may be a distro
+# variable pointing to /tmp (e.g. within X on OpenSUSE)
+# Instead, use OE_TMPDIR for passing this in externally.
+TMPDIR="$OE_TMPDIR"
+
 function usage() {
 	echo "Usage: $0 <rpm-dir>"
-	echo "  <rpm-dir>: default is $TPMDIR/deploy/rpm"
+	echo "  <rpm-dir>: default is $TMPDIR/deploy/rpm"
 }
 
 if [ $# -gt 1 ]; then
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index 9ffaa7c..6a1b900 100644
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -467,8 +467,8 @@ Test_Create_Qemu()
 		export MACHINE=$QEMUARCH
 
 		# Create Qemu in localhost VNC Port 1
-		echo "Running xterm -display ${DISPLAY} -e 'TMPDIR=${TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} && /bin/sleep 60' &"
-	    	xterm -display ${DISPLAY} -e "TMPDIR=${TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} && /bin/sleep 60" &
+		echo "Running xterm -display ${DISPLAY} -e 'OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} && /bin/sleep 60' &"
+		xterm -display ${DISPLAY} -e "OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} && /bin/sleep 60" &
 	
 		# Get the pid of the xterm processor, which will be used in Test_Kill_Qemu
 		PID=$!
diff --git a/scripts/runqemu b/scripts/runqemu
index 0f943b5..31e9822 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -55,6 +55,11 @@ SCRIPT_QEMU_OPT=""
 SCRIPT_QEMU_EXTRA_OPT=""
 SCRIPT_KERNEL_OPT=""
 
+# Don't use TMPDIR from the external environment, it may be a distro
+# variable pointing to /tmp (e.g. within X on OpenSUSE)
+# Instead, use OE_TMPDIR for passing this in externally.
+TMPDIR="$OE_TMPDIR"
+
 # Determine whether the file is a kernel or QEMU image, and set the
 # appropriate variables
 process_filename() {
@@ -260,7 +265,7 @@ SPITZ_DEFAULT_FSTYPE=ext3
 
 setup_tmpdir() {
     if [ -z "$TMPDIR" ]; then
-        # BUILDDIR unset, try and get TMPDIR from bitbake
+        # Try to get TMPDIR from bitbake
         type -P bitbake &>/dev/null || {
             echo "In order for this script to dynamically infer paths";
             echo "to kernels or filesystem images, you either need";
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu
  2011-09-28 15:28 [PATCH 0/2] Fix TMPDIR usage in scripts v3 Paul Eggleton
  2011-09-28 15:28 ` [PATCH 1/2] scripts: use OE_TMPDIR instead of TMPDIR external variable Paul Eggleton
@ 2011-09-28 15:28 ` Paul Eggleton
  2011-09-28 20:37 ` [PATCH 0/2] Fix TMPDIR usage in scripts v3 Richard Purdie
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2011-09-28 15:28 UTC (permalink / raw)
  To: openembedded-core

Update the internal copy of setup_tmpdir in the oe-setup-rpmrepo script
to be the same as the one in the runqemu script.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/oe-setup-rpmrepo |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/scripts/oe-setup-rpmrepo b/scripts/oe-setup-rpmrepo
index fc2f7a8..ea885f6 100755
--- a/scripts/oe-setup-rpmrepo
+++ b/scripts/oe-setup-rpmrepo
@@ -35,19 +35,20 @@ fi
 
 setup_tmpdir() {
     if [ -z "$TMPDIR" ]; then
-        if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then
-            # BUILDDIR unset, try and get TMPDIR from bitbake
-            type -P bitbake &>/dev/null || {
-                echo "In order for this script to dynamically infer paths";
-                echo "to kernels or filesystem images, you either need";
-                echo "bitbake in your PATH or to source oe-init-build-env";
-                echo "before running this script" >&2;
-                exit 1; }
-
-            # We have bitbake in PATH, get TMPDIR from bitbake
-            TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
-        else
-            TMPDIR=$BUILDDIR/tmp
+        # Try to get TMPDIR from bitbake
+        type -P bitbake &>/dev/null || {
+            echo "In order for this script to dynamically infer paths";
+            echo "to kernels or filesystem images, you either need";
+            echo "bitbake in your PATH or to source oe-init-build-env";
+            echo "before running this script" >&2;
+            exit 1; }
+
+        # We have bitbake in PATH, get TMPDIR from bitbake
+        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"
+            exit 1
         fi
     fi
 }
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Fix TMPDIR usage in scripts v3
  2011-09-28 15:28 [PATCH 0/2] Fix TMPDIR usage in scripts v3 Paul Eggleton
  2011-09-28 15:28 ` [PATCH 1/2] scripts: use OE_TMPDIR instead of TMPDIR external variable Paul Eggleton
  2011-09-28 15:28 ` [PATCH 2/2] scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu Paul Eggleton
@ 2011-09-28 20:37 ` Richard Purdie
  2 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2011-09-28 20:37 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Wed, 2011-09-28 at 16:28 +0100, Paul Eggleton wrote:
> Fix TMPDIR external environment variable usage within our scripts which
> is a problem on OpenSUSE within an X session (see Yocto bug #1530) by
> using OE_TMPDIR from the external environment instead.
> 
> Note that this will require changes to autobuilder scripts that use a
> TMPDIR environment variable when calling these scripts - they should now
> set OE_TMPDIR instead (if versions with and without this change need to
> be run on the same system, then setting both variables will cause no
> harm).
> 
> Since v1, fix pass-through references to TMPDIR in the
> qemuimage-testlib script.
> 
> Since v2, fix setting of OE_TMPDIR in classes/imagetest-qemu.bbclass.
> 
> The following changes since commit e0908b7b080c0d861a1b3ccb2185b9281b10fa1a:
> 
>   tables: remove it as obsolete recipe (2011-09-28 11:47:24 +0100)
> 
> are available in the git repository at:
>   git://git.openembedded.org/openembedded-core-contrib paule/scripts-tmpdir
>   http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/scripts-tmpdir
> 
> Paul Eggleton (2):
>   scripts: use OE_TMPDIR instead of TMPDIR external variable
>   scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu

Merged to master, thanks.

Richard




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu
  2011-09-28 11:39 [PATCH 0/2] Fix TMPDIR usage in scripts v2 Paul Eggleton
@ 2011-09-28 11:39 ` Paul Eggleton
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2011-09-28 11:39 UTC (permalink / raw)
  To: openembedded-core

Update the internal copy of setup_tmpdir in the oe-setup-rpmrepo script
to be the same as the one in the runqemu script.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/oe-setup-rpmrepo |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/scripts/oe-setup-rpmrepo b/scripts/oe-setup-rpmrepo
index fc2f7a8..ea885f6 100755
--- a/scripts/oe-setup-rpmrepo
+++ b/scripts/oe-setup-rpmrepo
@@ -35,19 +35,20 @@ fi
 
 setup_tmpdir() {
     if [ -z "$TMPDIR" ]; then
-        if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then
-            # BUILDDIR unset, try and get TMPDIR from bitbake
-            type -P bitbake &>/dev/null || {
-                echo "In order for this script to dynamically infer paths";
-                echo "to kernels or filesystem images, you either need";
-                echo "bitbake in your PATH or to source oe-init-build-env";
-                echo "before running this script" >&2;
-                exit 1; }
-
-            # We have bitbake in PATH, get TMPDIR from bitbake
-            TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
-        else
-            TMPDIR=$BUILDDIR/tmp
+        # Try to get TMPDIR from bitbake
+        type -P bitbake &>/dev/null || {
+            echo "In order for this script to dynamically infer paths";
+            echo "to kernels or filesystem images, you either need";
+            echo "bitbake in your PATH or to source oe-init-build-env";
+            echo "before running this script" >&2;
+            exit 1; }
+
+        # We have bitbake in PATH, get TMPDIR from bitbake
+        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"
+            exit 1
         fi
     fi
 }
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu
  2011-09-28  9:26 [PATCH 0/2] Fix TMPDIR usage in scripts Paul Eggleton
@ 2011-09-28  9:26 ` Paul Eggleton
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2011-09-28  9:26 UTC (permalink / raw)
  To: openembedded-core

Update the internal copy of setup_tmpdir in the oe-setup-rpmrepo script
to be the same as the one in the runqemu script.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/oe-setup-rpmrepo |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/scripts/oe-setup-rpmrepo b/scripts/oe-setup-rpmrepo
index fc2f7a8..ea885f6 100755
--- a/scripts/oe-setup-rpmrepo
+++ b/scripts/oe-setup-rpmrepo
@@ -35,19 +35,20 @@ fi
 
 setup_tmpdir() {
     if [ -z "$TMPDIR" ]; then
-        if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then
-            # BUILDDIR unset, try and get TMPDIR from bitbake
-            type -P bitbake &>/dev/null || {
-                echo "In order for this script to dynamically infer paths";
-                echo "to kernels or filesystem images, you either need";
-                echo "bitbake in your PATH or to source oe-init-build-env";
-                echo "before running this script" >&2;
-                exit 1; }
-
-            # We have bitbake in PATH, get TMPDIR from bitbake
-            TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
-        else
-            TMPDIR=$BUILDDIR/tmp
+        # Try to get TMPDIR from bitbake
+        type -P bitbake &>/dev/null || {
+            echo "In order for this script to dynamically infer paths";
+            echo "to kernels or filesystem images, you either need";
+            echo "bitbake in your PATH or to source oe-init-build-env";
+            echo "before running this script" >&2;
+            exit 1; }
+
+        # We have bitbake in PATH, get TMPDIR from bitbake
+        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"
+            exit 1
         fi
     fi
 }
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-28 20:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-28 15:28 [PATCH 0/2] Fix TMPDIR usage in scripts v3 Paul Eggleton
2011-09-28 15:28 ` [PATCH 1/2] scripts: use OE_TMPDIR instead of TMPDIR external variable Paul Eggleton
2011-09-28 15:28 ` [PATCH 2/2] scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu Paul Eggleton
2011-09-28 20:37 ` [PATCH 0/2] Fix TMPDIR usage in scripts v3 Richard Purdie
  -- strict thread matches above, loose matches on Subject: below --
2011-09-28 11:39 [PATCH 0/2] Fix TMPDIR usage in scripts v2 Paul Eggleton
2011-09-28 11:39 ` [PATCH 2/2] scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu Paul Eggleton
2011-09-28  9:26 [PATCH 0/2] Fix TMPDIR usage in scripts Paul Eggleton
2011-09-28  9:26 ` [PATCH 2/2] scripts/oe-setup-rpmrepo: use setup_tmpdir from runqemu Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.