summaryrefslogtreecommitdiffstats
path: root/meta/classes/externalsrc.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-24 12:29:36 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-01 15:56:50 +0000
commit18af1f5b19eb61615aee6eb6d4238f6b2f403e25 (patch)
tree321cde864eaaa2a8c9664a936df1988ca03f9cbb /meta/classes/externalsrc.bbclass
parente682cdc10ac4cb73145d6372c08d7e7b3505a4af (diff)
downloadpoky-18af1f5b19eb61615aee6eb6d4238f6b2f403e25.tar.gz
externalsrc.bbclass: Add class for handling external source trees
This is loosly based upon srctree.bbclass from OE-Classic but with some changes appropriate to OE-Core. (From OE-Core rev: bdb341953ba7d8299cba4d49d857107fb7b01e5b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r--meta/classes/externalsrc.bbclass53
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
new file mode 100644
index 0000000000..7e00ef8d12
--- /dev/null
+++ b/meta/classes/externalsrc.bbclass
@@ -0,0 +1,53 @@
1# Copyright (C) 2012 Linux Foundation
2# Author: Richard Purdie
3# Some code and influence taken from srctree.bbclass:
4# Copyright (C) 2009 Chris Larson <clarson@kergoth.com>
5# Released under the MIT license (see COPYING.MIT for the terms)
6#
7# externalsrc.bbclass enables use of an existing source tree, usually external to
8# the build system to build a piece of software rather than the usual fetch/unpack/patch
9# process.
10#
11# To use, set S to point at the directory you want to use containing the sources
12# e.g. S = "/path/to/my/source/tree"
13#
14# If the class is to work for both target and native versions (or with multilibs/
15# cross or other BBCLASSEXTEND variants), its expected that setting B to point to
16# where to place the compiled binaries will work (split source and build directories).
17# This is the default but B can be set to S if circumstaces dictate.
18#
19
20SRC_URI = ""
21SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
22B = "${WORKDIR}/${BPN}-${PV}/"
23
24def remove_tasks(tasks, deltasks, d):
25 for task in tasks:
26 deps = d.getVarFlag(task, "deps")
27 for preptask in deltasks:
28 if preptask in deps:
29 deps.remove(preptask)
30 d.setVarFlag(task, "deps", deps)
31 # Poking around bitbake internal variables is evil but there appears to be no better way :(
32 tasklist = d.getVar('__BBTASKS') or []
33 for task in deltasks:
34 d.delVarFlag(task, "task")
35 if task in tasklist:
36 tasklist.remove(task)
37 d.setVar('__BBTASKS', tasklist)
38
39python () {
40 tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys())
41 covered = d.getVar("SRCTREECOVEREDTASKS", True).split()
42
43 for task in tasks:
44 if task.endswith("_setscene"):
45 # sstate is never going to work for external source trees, disable it
46 covered.append(task)
47 else:
48 # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time
49 d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock")
50
51 remove_tasks(tasks, covered, d)
52}
53