diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:38:32 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 13:50:20 +0100 |
commit | e2e6f6fe07049f33cb6348780fa975162752e421 (patch) | |
tree | b1813295411235d1297a0ed642b1346b24fdfb12 /meta/classes/externalsrc.bbclass | |
download | poky-e2e6f6fe07049f33cb6348780fa975162752e421.tar.gz |
initial commit of Enea Linux 3.1
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r-- | meta/classes/externalsrc.bbclass | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass new file mode 100644 index 0000000000..c759289701 --- /dev/null +++ b/meta/classes/externalsrc.bbclass | |||
@@ -0,0 +1,68 @@ | |||
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, add externalsrc to the global inherit and set EXTERNALSRC to point at the | ||
12 | # directory you want to use containing the sources e.g. from local.conf for a recipe | ||
13 | # called "myrecipe" you would do: | ||
14 | # | ||
15 | # INHERIT += "externalsrc" | ||
16 | # EXTERNALSRC_pn-myrecipe = "/path/to/my/source/tree" | ||
17 | # | ||
18 | # In order to make this class work for both target and native versions (or with | ||
19 | # multilibs/cross or other BBCLASSEXTEND variants), B is set to point to a separate | ||
20 | # directory under the work directory (split source and build directories). This is | ||
21 | # the default, but the build directory can be set to the source directory if | ||
22 | # circumstances dictate by setting EXTERNALSRC_BUILD to the same value, e.g.: | ||
23 | # | ||
24 | # EXTERNALSRC_BUILD_pn-myrecipe = "/path/to/my/source/tree" | ||
25 | # | ||
26 | |||
27 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" | ||
28 | |||
29 | def remove_tasks(tasks, deltasks, d): | ||
30 | for task in tasks: | ||
31 | deps = d.getVarFlag(task, "deps") | ||
32 | for preptask in deltasks: | ||
33 | if preptask in deps: | ||
34 | deps.remove(preptask) | ||
35 | d.setVarFlag(task, "deps", deps) | ||
36 | # Poking around bitbake internal variables is evil but there appears to be no better way :( | ||
37 | tasklist = d.getVar('__BBTASKS') or [] | ||
38 | for task in deltasks: | ||
39 | d.delVarFlag(task, "task") | ||
40 | if task in tasklist: | ||
41 | tasklist.remove(task) | ||
42 | d.setVar('__BBTASKS', tasklist) | ||
43 | |||
44 | python () { | ||
45 | externalsrc = d.getVar('EXTERNALSRC', True) | ||
46 | if externalsrc: | ||
47 | d.setVar('S', externalsrc) | ||
48 | externalsrcbuild = d.getVar('EXTERNALSRC_BUILD', True) | ||
49 | if externalsrcbuild: | ||
50 | d.setVar('B', externalsrcbuild) | ||
51 | else: | ||
52 | d.setVar('B', '${WORKDIR}/${BPN}-${PV}/') | ||
53 | d.setVar('SRC_URI', '') | ||
54 | |||
55 | tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys()) | ||
56 | covered = d.getVar("SRCTREECOVEREDTASKS", True).split() | ||
57 | |||
58 | for task in tasks: | ||
59 | if task.endswith("_setscene"): | ||
60 | # sstate is never going to work for external source trees, disable it | ||
61 | covered.append(task) | ||
62 | else: | ||
63 | # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time | ||
64 | d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock") | ||
65 | |||
66 | remove_tasks(tasks, covered, d) | ||
67 | } | ||
68 | |||