[OE-core] [PATCH 1/1] gcc-common.inc: Added shared source support for basichash.

Lianhao Lu lianhao.lu at intel.com
Mon Jan 16 11:43:10 UTC 2012


[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 <lianhao.lu at intel.com>
---
 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}"
-- 
1.7.0.4





More information about the Openembedded-core mailing list