diff options
Diffstat (limited to 'meta/classes/src_distribute.bbclass')
-rw-r--r-- | meta/classes/src_distribute.bbclass | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/meta/classes/src_distribute.bbclass b/meta/classes/src_distribute.bbclass index 5daf526018..157e22bcef 100644 --- a/meta/classes/src_distribute.bbclass +++ b/meta/classes/src_distribute.bbclass | |||
@@ -1,40 +1,21 @@ | |||
1 | include conf/licenses.conf | ||
2 | |||
3 | SRC_DISTRIBUTECOMMAND[func] = "1" | 1 | SRC_DISTRIBUTECOMMAND[func] = "1" |
4 | python do_distribute_sources () { | 2 | python do_distribute_sources () { |
5 | l = bb.data.createCopy(d) | 3 | l = bb.data.createCopy(d) |
6 | bb.data.update_data(l) | 4 | bb.data.update_data(l) |
7 | licenses = (bb.data.getVar('LICENSE', d, 1) or "").split() | 5 | licenses = (bb.data.getVar('LICENSE', d, 1) or "unknown").split() |
8 | if not licenses: | 6 | |
9 | bb.note("LICENSE not defined") | 7 | sources_dir = bb.data.getVar('SRC_DISTRIBUTEDIR', d, 1) |
10 | src_distribute_licenses = (bb.data.getVar('SRC_DISTRIBUTE_LICENSES', d, 1) or "").split() | 8 | import re |
11 | # Explanation: | ||
12 | # Space seperated items in LICENSE must *all* be distributable | ||
13 | # Each space seperated item may be used under any number of | seperated licenses. | ||
14 | # If any of those | seperated licenses are distributable, then that component is. | ||
15 | # i.e. LICENSE = "GPL LGPL" | ||
16 | # In this case, both components are distributable. | ||
17 | # LICENSE = "GPL|QPL|Proprietary" | ||
18 | # In this case, GPL is distributable, so the component is. | ||
19 | valid = 1 | ||
20 | for l in licenses: | 9 | for l in licenses: |
21 | lvalid = 0 | ||
22 | for i in l.split("|"): | 10 | for i in l.split("|"): |
23 | if i in src_distribute_licenses: | 11 | for s in (bb.data.getVar('A', d, 1) or "").split(): |
24 | lvalid = 1 | 12 | s = re.sub(';.*$', '', s) |
25 | if lvalid != 1: | 13 | cmd = bb.data.getVar('SRC_DISTRIBUTECOMMAND', d, 1) |
26 | valid = 0 | 14 | if not cmd: |
27 | if valid == 0: | 15 | raise bb.build.FuncFailed("Unable to distribute sources, SRC_DISTRIBUTECOMMAND not defined") |
28 | bb.note("Licenses (%s) are not all listed in SRC_DISTRIBUTE_LICENSES, skipping source distribution" % licenses) | 16 | bb.data.setVar('SRC', s, d) |
29 | return | 17 | bb.data.setVar('SRC_DISTRIBUTEDIR', "%s/%s" % (sources_dir, l), d) |
30 | import re | 18 | bb.build.exec_func('SRC_DISTRIBUTECOMMAND', d) |
31 | for s in (bb.data.getVar('A', d, 1) or "").split(): | ||
32 | s = re.sub(';.*$', '', s) | ||
33 | cmd = bb.data.getVar('SRC_DISTRIBUTECOMMAND', d, 1) | ||
34 | if not cmd: | ||
35 | raise bb.build.FuncFailed("Unable to distribute sources, SRC_DISTRIBUTECOMMAND not defined") | ||
36 | bb.data.setVar('SRC', s, d) | ||
37 | bb.build.exec_func('SRC_DISTRIBUTECOMMAND', d) | ||
38 | } | 19 | } |
39 | 20 | ||
40 | addtask distribute_sources before do_build after do_fetch | 21 | addtask distribute_sources before do_build after do_fetch |