summaryrefslogtreecommitdiffstats
path: root/meta/classes/devupstream.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-04 14:06:49 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-04 20:45:41 +0100
commit1900cb43f1f9f81abbef4fa1416a4057500aa19c (patch)
treec26b0adf8957bac62283ef33da965ae9bebb4afb /meta/classes/devupstream.bbclass
parent174ceef844922a3e25bc955e4bb6db04009ac3e9 (diff)
downloadpoky-1900cb43f1f9f81abbef4fa1416a4057500aa19c.tar.gz
devupstream: Allow support of native class extensions
It is useful to be able to use the class with recipes using BBCLASSEXTEND for native extensions. This adds the magic required to do that. [YOCTO #11449] (From OE-Core rev: 17bab13b0f2431757d8ddd66489bb720c13a0320) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/devupstream.bbclass')
-rw-r--r--meta/classes/devupstream.bbclass20
1 files changed, 13 insertions, 7 deletions
diff --git a/meta/classes/devupstream.bbclass b/meta/classes/devupstream.bbclass
index 1230fa12ea..dc9a9472b1 100644
--- a/meta/classes/devupstream.bbclass
+++ b/meta/classes/devupstream.bbclass
@@ -16,8 +16,6 @@
16# - If the fetcher requires native tools (such as subversion-native) then 16# - If the fetcher requires native tools (such as subversion-native) then
17# bitbake won't be able to add them automatically. 17# bitbake won't be able to add them automatically.
18 18
19CLASSOVERRIDE .= ":class-devupstream"
20
21python devupstream_virtclass_handler () { 19python devupstream_virtclass_handler () {
22 # Do nothing if this is inherited, as it's for BBCLASSEXTEND 20 # Do nothing if this is inherited, as it's for BBCLASSEXTEND
23 if "devupstream" not in (d.getVar('BBCLASSEXTEND') or ""): 21 if "devupstream" not in (d.getVar('BBCLASSEXTEND') or ""):
@@ -25,8 +23,8 @@ python devupstream_virtclass_handler () {
25 return 23 return
26 24
27 variant = d.getVar("BBEXTENDVARIANT") 25 variant = d.getVar("BBEXTENDVARIANT")
28 if variant not in ("target"): 26 if variant not in ("target", "native"):
29 bb.error("Pass the variant when using devupstream, for example devupstream:target") 27 bb.error("Unsupported variant %s. Pass the variant when using devupstream, for example devupstream:target" % variant)
30 return 28 return
31 29
32 # Develpment releases are never preferred by default 30 # Develpment releases are never preferred by default
@@ -34,14 +32,22 @@ python devupstream_virtclass_handler () {
34 32
35 uri = bb.fetch2.URI(d.getVar("SRC_URI").split()[0]) 33 uri = bb.fetch2.URI(d.getVar("SRC_URI").split()[0])
36 34
37 if uri.scheme == "git": 35 if uri.scheme == "git" and not d.getVar("S:class-devupstream"):
38 d.setVar("S", "${WORKDIR}/git") 36 d.setVar("S:class-devupstream", "${WORKDIR}/git")
39 37
40 # Modify the PV if the recipe hasn't already overridden it 38 # Modify the PV if the recipe hasn't already overridden it
41 pv = d.getVar("PV") 39 pv = d.getVar("PV")
42 proto_marker = "+" + uri.scheme 40 proto_marker = "+" + uri.scheme
43 if proto_marker not in pv: 41 if proto_marker not in pv and not d.getVar("PV:class-devupstream"):
44 d.setVar("PV", pv + proto_marker + "${SRCPV}") 42 d.setVar("PV", pv + proto_marker + "${SRCPV}")
43
44 if variant == "native":
45 pn = d.getVar("PN")
46 d.setVar("PN", "%s-native" % (pn))
47 fn = d.getVar("FILE")
48 bb.parse.BBHandler.inherit("native", fn, 0, d)
49
50 d.appendVar("CLASSOVERRIDE", ":class-devupstream")
45} 51}
46 52
47addhandler devupstream_virtclass_handler 53addhandler devupstream_virtclass_handler