summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-06-11 14:45:52 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2009-06-11 14:46:17 +0100
commit5a4c688958a7dc1258575c0f6c3bd1af165b2585 (patch)
tree50be9f432541c51769cecba5361c758005fc6f23
parent4d503cfa062552046d9331a6dcfa724225cebc11 (diff)
downloadopenembedded-core-5a4c688958a7dc1258575c0f6c3bd1af165b2585.tar.gz
openembedded-core-5a4c688958a7dc1258575c0f6c3bd1af165b2585.tar.bz2
openembedded-core-5a4c688958a7dc1258575c0f6c3bd1af165b2585.zip
packaged-staging.bbclass: Detect when we're using autotools_stage_all and don't hold the lock for as long when that is the case giving a significant performance boost with less lock contention and staging area file timestamp checking required
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--meta/classes/autotools.bbclass7
-rw-r--r--meta/classes/autotools_stage.bbclass2
-rw-r--r--meta/classes/packaged-staging.bbclass40
3 files changed, 43 insertions, 6 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index 365258f65f..82ed36816b 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -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
}
diff --git a/meta/classes/autotools_stage.bbclass b/meta/classes/autotools_stage.bbclass
index 010117c250..ff0f4cd880 100644
--- a/meta/classes/autotools_stage.bbclass
+++ b/meta/classes/autotools_stage.bbclass
@@ -2,4 +2,4 @@ inherit autotools
do_stage () {
autotools_stage_all
-} \ No newline at end of file
+}
diff --git a/meta/classes/packaged-staging.bbclass b/meta/classes/packaged-staging.bbclass
index 9b9ba16bff..5d0ee9aa99 100644
--- a/meta/classes/packaged-staging.bbclass
+++ b/meta/classes/packaged-staging.bbclass
@@ -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)
}