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

Submitted by Lianhao Lu on Jan. 16, 2012, 11:43 a.m.

Details

Message ID 2588490b8b8424c96da2824c604929baeb1c5c16.1326714004.git.lianhao.lu@intel.com
State New
Headers show

Commit Message

Lianhao Lu Jan. 16, 2012, 11:43 a.m.
[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@intel.com>
---
 meta/recipes-devtools/gcc/gcc-common.inc |   56 ++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

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