From patchwork Mon Jan 16 11:43:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/1] gcc-common.inc: Added shared source support for basichash. Date: Mon, 16 Jan 2012 11:43:10 -0000 From: Lianhao Lu X-Patchwork-Id: 19417 Message-Id: <2588490b8b8424c96da2824c604929baeb1c5c16.1326714004.git.lianhao.lu@intel.com> To: openembedded-core@lists.openembedded.org [YOCTO #1555] Adding new mechanism to allow multiple gcc related recipes sharing the same src directory when using the basichash as the signature handler. Using the same stamp file for multiple gcc related recipes to share the same src directory is no longer working when using the basichash signature. Signed-off-by: Lianhao Lu --- meta/recipes-devtools/gcc/gcc-common.inc | 56 ++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc index fe112d9..4f8e18f 100644 --- a/meta/recipes-devtools/gcc/gcc-common.inc +++ b/meta/recipes-devtools/gcc/gcc-common.inc @@ -63,6 +63,62 @@ do_unpack[stamp-base] = "${SS}" do_headerfix[stamp-base] = "${SS}" do_patch[stamp-base] = "${SS}" +# Shared source for basichash +def check_shared_taskdone(d, task): + import os.path, bb.utils + basedir = d.getVar('SW', True) + bb.utils.mkdirhier(basedir) + fn = os.path.join(basedir, "%s.done" % (task)) + return os.path.exists(fn) + +def mark_shared_taskdone(d, task): + import os.path, bb.utils + basedir = d.getVar('SW', True) + bb.utils.mkdirhier(basedir) + fn = os.path.join(basedir, "%s.done" % (task)) + f = open(fn, "w") + f.close() + +do_fetch[lockfiles] = "${SW}.fetch.lock" +do_unpack[lockfiles] = "${SW}.unpack.lock" +do_headerfix[lockfiles] = "${SW}.headerfix.lock" +do_patch[lockfiles] = "${SW}.patch.lock" + +python do_fetch_prepend() { + if check_shared_taskdone(d, 'fetch'): + return +} +python do_fetch_append() { + mark_shared_taskdone(d, 'fetch') +} + +python do_unpack_prepend() { + if check_shared_taskdone(d, 'unpack'): + return +} +python do_unpack_append() { + mark_shared_taskdone(d, 'unpack') +} + +python do_patch_prepend() { + if check_shared_taskdone(d, 'patch'): + return +} +python do_patch_append() { + mark_shared_taskdone(d, 'patch') +} + +do_headerfix_prepend() { + if [ -e "${SW}/headerfix.done" ]; then + return 0 + fi +} + +do_headerfix_append() { + mkdir -p "${SW}" + touch "${SW}/headerfix.done" +} + # SW means Shared Work directory SW = "${TMPDIR}/work-shared/gcc-${PV}-${PR}" WORKDIR_task-unpack = "${SW}"