summaryrefslogtreecommitdiffstats
path: root/meta/classes/src_distribute.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/src_distribute.bbclass')
-rw-r--r--meta/classes/src_distribute.bbclass40
1 files changed, 40 insertions, 0 deletions
diff --git a/meta/classes/src_distribute.bbclass b/meta/classes/src_distribute.bbclass
new file mode 100644
index 0000000000..5daf526018
--- /dev/null
+++ b/meta/classes/src_distribute.bbclass
@@ -0,0 +1,40 @@
1include conf/licenses.conf
2
3SRC_DISTRIBUTECOMMAND[func] = "1"
4python do_distribute_sources () {
5 l = bb.data.createCopy(d)
6 bb.data.update_data(l)
7 licenses = (bb.data.getVar('LICENSE', d, 1) or "").split()
8 if not licenses:
9 bb.note("LICENSE not defined")
10 src_distribute_licenses = (bb.data.getVar('SRC_DISTRIBUTE_LICENSES', d, 1) or "").split()
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:
21 lvalid = 0
22 for i in l.split("|"):
23 if i in src_distribute_licenses:
24 lvalid = 1
25 if lvalid != 1:
26 valid = 0
27 if valid == 0:
28 bb.note("Licenses (%s) are not all listed in SRC_DISTRIBUTE_LICENSES, skipping source distribution" % licenses)
29 return
30 import re
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}
39
40addtask distribute_sources before do_build after do_fetch