From 5a4c688958a7dc1258575c0f6c3bd1af165b2585 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 11 Jun 2009 14:45:52 +0100 Subject: 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 --- meta/classes/autotools.bbclass | 7 ++++-- meta/classes/autotools_stage.bbclass | 2 +- meta/classes/packaged-staging.bbclass | 40 ++++++++++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 6 deletions(-) (limited to 'meta/classes') diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass index 365258f65..82ed36816 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 010117c25..ff0f4cd88 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 9b9ba16bf..5d0ee9aa9 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) } -- cgit v1.2.3