cacaoh-native: Removed legacy style staging
[openembedded.git] / classes / src_distribute.bbclass
blob795a5cfe4eb16c3ec2cf749ad65e09d95a71bc55
1 SRC_DISTRIBUTE_DLONLY ?= "0"
2 SRC_DISTRIBUTECOMMAND[func] = "1"
4 addtask distribute_sources before do_build after do_fetch
5 python do_distribute_sources () {
6         bb.build.exec_func("do_fetch", d)
8         cmd = bb.data.getVar('SRC_DISTRIBUTECOMMAND', d, 1)
9         if not cmd:
10                 raise bb.build.FuncFailed("Unable to distribute sources, SRC_DISTRIBUTECOMMAND not set")
12         try:
13                 dlonly = int(d.getVar("SRC_DISTRIBUTE_DLONLY", 1))
14         except ValueError:
15                 raise bb.build.FuncFailed("Invalid value for SRC_DISTRIBUTE_DLONLY: expected integer.")
16         dldir = os.path.realpath(d.getVar("DL_DIR", 1) or "")
18         licenses = (bb.data.getVar('LICENSE', d, 1) or "unknown").split()
19         urldatadict = bb.fetch.init(d.getVar("SRC_URI", True).split(), d, True)
20         for url, urldata in urldatadict.iteritems():
21                 if not urldata.setup:
22                         urldata.setup_localpath(d)
24                 local = urldata.localpath
25                 if dlonly and dldir and not \
26                    os.path.realpath(local).startswith(dldir + os.path.sep):
27                         continue
29                 bb.data.setVar('SRC', os.path.abspath(local), d)
30                 for license in licenses:
31                         for entry in license.split("|"):
32                                 bb.data.setVar('LIC', entry, d)
33                                 bb.build.exec_func('SRC_DISTRIBUTECOMMAND', d)
36 addtask distribute_sources_all after do_distribute_sources
37 do_distribute_sources_all[recrdeptask] = "do_distribute_sources"
38 do_distribute_sources_all[nostamp] = "1"
40 # compatability wrapper
41 addtask distsrcall after do_distribute_sources_all
42 do_distsrcall[nostamp] = "1"