]> code.ossystems Code Review - openembedded-core.git/commitdiff
packaged-staging.bbclass: Detect when we're using autotools_stage_all and don't hold...
authorRichard Purdie <rpurdie@linux.intel.com>
Thu, 11 Jun 2009 13:45:52 +0000 (14:45 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Thu, 11 Jun 2009 13:46:17 +0000 (14:46 +0100)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
meta/classes/autotools.bbclass
meta/classes/autotools_stage.bbclass
meta/classes/packaged-staging.bbclass

index 365258f65fb774d7c1c1f509ace1b8602a68c34e..82ed36816bdb090bb712ac37bfc61b97b5f93f22 100644 (file)
@@ -151,7 +151,9 @@ autotools_do_install() {
        done
 }
 
+# STAGE_TEMP_PREFIX is used for a speedup by packaged-staging
 STAGE_TEMP="${WORKDIR}/temp-staging"
+STAGE_TEMP_PREFIX = ""
 
 autotools_stage_includes() {
        if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ]
@@ -167,11 +169,12 @@ autotools_stage_includes() {
 autotools_stage_dir() {
        from="$1"
        to="$2"
+        prefix="${STAGE_TEMP_PREFIX}"
        # This will remove empty directories so we can ignore them
        rmdir "$from" 2> /dev/null || true
        if [ -d "$from" ]; then
-               mkdir -p "$to"
-               cp -fpPR "$from"/* "$to"
+               mkdir -p "$prefix$to"
+               cp -fpPR "$from"/* "$prefix$to"
        fi
 }
 
index 010117c250e07077b0c78ef72d174278ac0c8453..ff0f4cd880b9037ff1af59cd7ac471000bdd6b4b 100644 (file)
@@ -2,4 +2,4 @@ inherit autotools
 
 do_stage () {
        autotools_stage_all
-}
\ No newline at end of file
+}
index 9b9ba16bffbb8b5ef6d84b6b6012c5d18d5183c8..5d0ee9aa99be887eaeb5e7b01d7bc59a04a4e469 100644 (file)
@@ -63,6 +63,24 @@ python () {
            bb.data.setVarFlag('do_setscene', 'recrdeptask', deps, d)
 
         bb.data.setVar("PSTAGING_ACTIVE", "1", d)
+
+        #
+        # Here we notice if the staging function is one of our standard staging 
+        # routines. If it is, we can remvoe the need to lock staging and take 
+        # timestamps which gives a nice speedup
+        #
+        fastpath = False
+        stagefunc = bb.data.getVar('do_stage', d, 1).strip()
+        if stagefunc == "autotools_stage_all":
+            fastpath = True
+        if stagefunc == "do_stage_native" and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1":
+            fastpath = True
+        if fastpath:         
+            bb.note("Can optimise " + bb.data.getVar('FILE', d, 1))
+            bb.data.setVar("PSTAGING_NEEDSTAMP", "0", d)
+            bb.data.setVar("STAGE_TEMP_PREFIX", "${WORKDIR}/temp-staging-pstage", d)
+        else:
+            bb.data.setVar("PSTAGING_NEEDSTAMP", "1", d)
     else:
         bb.data.setVar("PSTAGING_ACTIVE", "0", d)
 }
@@ -297,14 +315,30 @@ populate_staging_postamble () {
        fi
 }
 
-do_populate_staging[lockfiles] = "${STAGING_DIR}/staging.lock"
+autotools_staging_pstage () {
+       mkdir -p ${PSTAGE_TMPDIR_STAGE}/staging/
+       cp -fpPR ${WORKDIR}/temp-staging-pstage/${STAGING_DIR}/* ${PSTAGE_TMPDIR_STAGE}/staging/
+       cp -fpPR ${WORKDIR}/temp-staging-pstage/${STAGING_DIR}/* ${STAGING_DIR}/
+}
+
+#do_populate_staging[lockfiles] = "${STAGING_DIR}/staging.lock"
 do_populate_staging[dirs] =+ "${DEPLOY_DIR_PSTAGE}"
 python do_populate_staging_prepend() {
-    bb.build.exec_func("populate_staging_preamble", d)
+    needstamp = bb.data.getVar("PSTAGING_NEEDSTAMP", d, 1)
+    lock = bb.data.expand("${STAGING_DIR}/staging.lock", d)
+    if needstamp == "1":
+        stamplock = bb.utils.lockfile(lock)
+        bb.build.exec_func("populate_staging_preamble", d)
 }
 
 python do_populate_staging_append() {
-    bb.build.exec_func("populate_staging_postamble", d)
+    if needstamp == "1":
+        bb.build.exec_func("populate_staging_postamble", d)
+        bb.utils.unlockfile(stamplock)
+    else:
+        stamplock = bb.utils.lockfile(lock)
+        bb.build.exec_func("autotools_staging_pstage", d)
+        bb.utils.unlockfile(stamplock)
 }