diff options
author | Ross Burton <ross.burton@intel.com> | 2016-11-11 17:51:17 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-11 16:09:14 +0000 |
commit | ca5059e638c6641d73c6b30ae7ed8b25c3f4a847 (patch) | |
tree | 87a8e264b69e7f33a2156247e84685c06d38a8f3 | |
parent | 94790a8254d63d63759ca3598b42f3f67bc97d02 (diff) | |
download | poky-ca5059e638c6641d73c6b30ae7ed8b25c3f4a847.tar.gz |
classes: add devupstream class
This class lets you use BBCLASSEXTEND to add a variant of the recipe that
fetches from an alternative URI (such as git:) instead of a tarball.
For example:
BBCLASSEXTEND = "devupstream:target"
SRC_URI_class-devupstream = "git://git.example.com/example"
SRCREV_class-devupstream = "abcd1234"
This variant will have DEFAULT_PREFERENCE set to -1 so it needs to be selected
to be used, and any development-specific tweaks can be done with the
class-devupstream override, for example:
DEPENDS_append_class-devupstream = " gperf-native"
do_configure_prepend_class-devupstream() {
touch ${S}/README
}
It currently only supports creating a development variant of the target recipe,
not native or nativesdk. The BBCLASSEXTEND syntax (devupstream:target) was
chosen so that support for native and nativesdk can be added at a later date.
Support for other version control systems such as subversion is limited, as
bitbake's automatic fetch dependencies on for example subversion-native are not
generated.
[ YOCTO #10215 ]
(From OE-Core rev: c48ef2d7c7198232846f36a975c673cc57f4a090)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/devupstream.bbclass | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta/classes/devupstream.bbclass b/meta/classes/devupstream.bbclass new file mode 100644 index 0000000000..7d4113fcc3 --- /dev/null +++ b/meta/classes/devupstream.bbclass | |||
@@ -0,0 +1,48 @@ | |||
1 | # Class for use in BBCLASSEXTEND to make it easier to have a single recipe that | ||
2 | # can build both stable tarballs and snapshots from upstream source | ||
3 | # repoistories. | ||
4 | # | ||
5 | # Usage: | ||
6 | # BBCLASSEXTEND = "devupstream:target" | ||
7 | # SRC_URI_class-devupstream = "git://git.example.com/example" | ||
8 | # SRCREV_class-devupstream = "abcdef" | ||
9 | # | ||
10 | # If the first entry in SRC_URI is a git: URL then S is rewritten to | ||
11 | # WORKDIR/git. | ||
12 | # | ||
13 | # There are a few caveats that remain to be solved: | ||
14 | # - You can't build native or nativesdk recipes using for example | ||
15 | # devupstream:native, you can only build target recipes. | ||
16 | # - If the fetcher requires native tools (such as subversion-native) then | ||
17 | # bitbake won't be able to add them automatically. | ||
18 | |||
19 | CLASSOVERRIDE .= ":class-devupstream" | ||
20 | |||
21 | python devupstream_virtclass_handler () { | ||
22 | # Do nothing if this is inherited, as it's for BBCLASSEXTEND | ||
23 | if "devupstream" not in (d.getVar('BBCLASSEXTEND') or ""): | ||
24 | bb.error("Don't inherit devupstream, use BBCLASSEXTEND") | ||
25 | return | ||
26 | |||
27 | variant = d.getVar("BBEXTENDVARIANT") | ||
28 | if variant not in ("target"): | ||
29 | bb.error("Pass the variant when using devupstream, for example devupstream:target") | ||
30 | return | ||
31 | |||
32 | # Develpment releases are never preferred by default | ||
33 | d.setVar("DEFAULT_PREFERENCE", "-1") | ||
34 | |||
35 | uri = bb.fetch2.URI(d.getVar("SRC_URI").split()[0]) | ||
36 | |||
37 | if uri.scheme == "git": | ||
38 | d.setVar("S", "${WORKDIR}/git") | ||
39 | |||
40 | # Modify the PV if the recipe hasn't already overridden it | ||
41 | pv = d.getVar("PV") | ||
42 | proto_marker = "+" + uri.scheme | ||
43 | if proto_marker not in pv: | ||
44 | d.setVar("PV", pv + proto_marker + "${SRCPV}") | ||
45 | } | ||
46 | |||
47 | addhandler devupstream_virtclass_handler | ||
48 | devupstream_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" | ||