[oe-commits] Tom Rini : packaged-staging, native{, sdk}: Rework OVERRIDES to check PSTAGING_DISABLED

git version control git at git.openembedded.org
Wed Jul 28 21:06:42 UTC 2010


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 42446f681a3e70015d48cf51b0b5cb78b47930c3
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=42446f681a3e70015d48cf51b0b5cb78b47930c3

Author: Tom Rini <tom_rini at mentor.com>
Date:   Wed Jul 28 13:56:08 2010 -0700

packaged-staging, native{,sdk}: Rework OVERRIDES to check PSTAGING_DISABLED

When the function to set PSTAGING_ACTIVE is an anon python function OVERRIDES
is not set so we cannot set things to disabled in the context of BBCLASSEXTEND
recipes.  To fix this we need to have native/nativesdk set OVERRIDES outside of
the anon function context.  We then make a COW of the data at this point in
packaged-staging's anon function and evaluate so we know what will be in
OVERRIDES and check.  While we're in here drop a duplicate test in
populate_sysroot_postamble and check nativesdk along with the rest of the
classes that need mangling.

Signed-off-by: Tom Rini <tom_rini at mentor.com>

---

 classes/native.bbclass           |    7 ++++++-
 classes/nativesdk.bbclass        |    5 ++---
 classes/packaged-staging.bbclass |   24 +++++++++++-------------
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/classes/native.bbclass b/classes/native.bbclass
index 3437836..345bd80 100644
--- a/classes/native.bbclass
+++ b/classes/native.bbclass
@@ -91,6 +91,12 @@ ORIG_DEPENDS := "${DEPENDS}"
 
 DEPENDS_virtclass-native ?= "${ORIG_DEPENDS}"
 
+def native_virtclass_add_override(d):
+    if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""):
+        bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-native", d)
+
+OVERRIDES .= "${@native_virtclass_add_override(d)}"
+
 python __anonymous () {
     # If we've a legacy native do_stage, we need to neuter do_install
     stagefunc = bb.data.getVar('do_stage', d, True)
@@ -124,6 +130,5 @@ python __anonymous () {
     
                 provides = provides.replace(prov, prov + "-native")
         bb.data.setVar("PROVIDES", provides, d)
-        bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-native", d)
 }
 
diff --git a/classes/nativesdk.bbclass b/classes/nativesdk.bbclass
index ddaab85..f3f9930 100644
--- a/classes/nativesdk.bbclass
+++ b/classes/nativesdk.bbclass
@@ -52,6 +52,8 @@ export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
 ORIG_DEPENDS := "${DEPENDS}"
 DEPENDS_virtclass-nativesdk ?= "${ORIG_DEPENDS}"
 
+OVERRIDES .= ":virtclass-nativesdk"
+
 python __anonymous () {
     pn = bb.data.getVar("PN", d, True)
     depends = bb.data.getVar("DEPENDS_virtclass-nativesdk", d, True)
@@ -74,7 +76,4 @@ python __anonymous () {
         if not prov.endswith("-nativesdk"):
             provides = provides.replace(prov, prov + "-nativesdk")
     bb.data.setVar("PROVIDES", provides, d)
-    bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-nativesdk", d)
 }
-
-
diff --git a/classes/packaged-staging.bbclass b/classes/packaged-staging.bbclass
index 9f36948..8847243 100644
--- a/classes/packaged-staging.bbclass
+++ b/classes/packaged-staging.bbclass
@@ -29,22 +29,20 @@ PSTAGE_NATIVEDEPENDS = "\
 BB_STAMP_WHITELIST = "${PSTAGE_NATIVEDEPENDS}"
 
 python __anonymous() {
+    pstage_allowed = True
+
     # We need PSTAGE_PKGARCH to contain information about the target.
     if bb.data.inherits_class('cross', d):
         bb.data.setVar('PSTAGE_PKGARCH', "${HOST_SYS}-${PACKAGE_ARCH}-${TARGET_OS}", d)
-}
-
-python () {
-    pstage_allowed = True
 
-    # These classes encode staging paths into the binary data so can only be
-    # reused if the path doesn't change/
-    if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d):
+    # These classes encode staging paths data files so we must mangle them
+    # for reuse.
+    if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('sdk', d):
         scan_cmd = "grep -Irl ${STAGING_DIR} ${PSTAGE_TMPDIR_STAGE}"
         bb.data.setVar('PSTAGE_SCAN_CMD', scan_cmd, d)
 
-    # PSTAGE_NATIVEDEPENDS lists the packages we need before we can use packaged 
-    # staging. There will always be some packages we depend on.
+    # PSTAGE_NATIVEDEPENDS lists the packages we need before we can use
+    # packaged staging. There will always be some packages we depend on.
     if bb.data.inherits_class('native', d):
         pn = bb.data.getVar('PN', d, True)
         nativedeps = bb.data.getVar('PSTAGE_NATIVEDEPENDS', d, True).split()
@@ -55,7 +53,10 @@ python () {
     if bb.data.inherits_class('image', d):
         pstage_allowed = False
 
-    if bb.data.getVar('PSTAGING_DISABLED', d, True) == "1":
+    # We need OVERRIDES to be evaluated and applied.
+    localdata = d.createCopy()
+    bb.data.update_data(localdata)
+    if localdata.getVar('PSTAGING_DISABLED', True) == "1":
         pstage_allowed = False
 
     # Add task dependencies if we're active, otherwise mark packaged staging
@@ -318,9 +319,6 @@ populate_sysroot_postamble () {
 		if [ "$exitcode" != "5" -a "$exitcode" != "0" ]; then
 			exit $exitcode
 		fi
-		if [ "$exitcode" != "5" -a "$exitcode" != "0" ]; then
-			exit $exitcode
-		fi
 		set -e
 	fi
 }





More information about the Openembedded-commits mailing list