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>
This commit is contained in:
Richard Purdie 2009-06-11 14:45:52 +01:00
parent 4d503cfa06
commit 5a4c688958
3 changed files with 43 additions and 6 deletions

View 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
}

View File

@ -2,4 +2,4 @@ inherit autotools
do_stage () {
autotools_stage_all
}
}

View 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)
}