[oe-commits] Tom Rini : packaged-staging: Make setting PSTAGING_ACTIVE be a named python func

git version control git at git.openembedded.org
Wed Jul 28 02:15:02 UTC 2010


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

Author: Tom Rini <tom_rini at mentor.com>
Date:   Tue Jul 27 19:09:44 2010 -0700

packaged-staging: Make setting PSTAGING_ACTIVE be a named python func

When the function to set PSTAGING_ACTIVE is an anon python function
overrides are not set so we cannot set things to disabled in the context
of BBCLASSEXTEND recipes.  Call this function before we check
PSTAGING_ACTIVE.  In the case of packagedstaging_fastpath it's cleaner
to convert to a full python function.  While we're in here drop a
duplicate test in populate_sysroot_postamble and make do_package_stage
check PSTAGING_ACTIVE for == 0 rather than != 1, like the rest of the
functions do.

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

---

 classes/packaged-staging.bbclass |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/classes/packaged-staging.bbclass b/classes/packaged-staging.bbclass
index 9f36948..ff03cc3 100644
--- a/classes/packaged-staging.bbclass
+++ b/classes/packaged-staging.bbclass
@@ -34,7 +34,7 @@ python __anonymous() {
         bb.data.setVar('PSTAGE_PKGARCH', "${HOST_SYS}-${PACKAGE_ARCH}-${TARGET_OS}", d)
 }
 
-python () {
+def pstage_check_allowed (d):
     pstage_allowed = True
 
     # These classes encode staging paths into the binary data so can only be
@@ -74,7 +74,6 @@ python () {
         bb.data.setVar("PSTAGING_ACTIVE", "1", d)
     else:
         bb.data.setVar("PSTAGING_ACTIVE", "0", d)
-}
 
 PSTAGE_MACHCONFIG   = "${PSTAGE_WORKDIR}/opkg.conf"
 
@@ -193,6 +192,8 @@ SCENEFUNCS += "packagestage_scenefunc"
 
 python packagestage_scenefunc () {
     import glob
+
+    pstage_check_allowed(d)
     if bb.data.getVar("PSTAGING_ACTIVE", d, 1) == "0":
         return
 
@@ -318,26 +319,27 @@ 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
 }
 
-packagedstaging_fastpath () {
-	if [ "$PSTAGING_ACTIVE" = "1" ]; then
-		mkdir -p ${PSTAGE_TMPDIR_STAGE}/sysroots/
-		cp -fpPR ${SYSROOT_DESTDIR}/${STAGING_DIR}/* ${PSTAGE_TMPDIR_STAGE}/sysroots/ || /bin/true
-	fi
+python packagedstaging_fastpath () {
+    pstage_check_allowed(d)
+    if bb.data.getVar("PSTAGING_ACTIVE", d, 1) == "0":
+        path = bb.data.getVar("PATH", d, 1)
+        bb.mkdirhier(bb.data.expand("${PSTAGE_TMPDIR_STAGE}/sysroots", d))
+        cmd = bb.data.expand("cp -fpPR ${SYSROOT_DESTDIR}/${STAGING_DIR}/* ${PSTAGE_TMPDIR_STAGE}/sysroots/", d)
+        os.system("PATH=\"%s\" %s" % (path, cmd))
 }
 
 do_populate_sysroot[dirs] =+ "${PSTAGE_DIR}"
 python populate_sysroot_prehook() {
+    pstage_check_allowed(d)
     bb.build.exec_func("populate_sysroot_preamble", d)
 }
 
 python populate_sysroot_posthook() {
+    pstage_check_allowed(d)
     bb.build.exec_func("populate_sysroot_postamble", d)
 }
 
@@ -411,7 +413,8 @@ python staging_package_libtoolhack () {
 }
 
 python do_package_stage () {
-    if bb.data.getVar("PSTAGING_ACTIVE", d, 1) != "1":
+    pstage_check_allowed(d)
+    if bb.data.getVar("PSTAGING_ACTIVE", d, 1) == "0":
         return
 
     #





More information about the Openembedded-commits mailing list