diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-10 14:35:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-12 15:27:17 +0100 |
commit | fd1517e2b51a170f2427122c6b95396db251d827 (patch) | |
tree | dabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes-global/packagedata.bbclass | |
parent | 10317912ee319ccf7f83605d438b5cbf9663f296 (diff) | |
download | poky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz |
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take
advantage of new bitbake functionality to check class scope/usage.
(From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-global/packagedata.bbclass')
-rw-r--r-- | meta/classes-global/packagedata.bbclass | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/meta/classes-global/packagedata.bbclass b/meta/classes-global/packagedata.bbclass new file mode 100644 index 0000000000..9f72c01d77 --- /dev/null +++ b/meta/classes-global/packagedata.bbclass | |||
@@ -0,0 +1,40 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | python read_subpackage_metadata () { | ||
8 | import oe.packagedata | ||
9 | |||
10 | vars = { | ||
11 | "PN" : d.getVar('PN'), | ||
12 | "PE" : d.getVar('PE'), | ||
13 | "PV" : d.getVar('PV'), | ||
14 | "PR" : d.getVar('PR'), | ||
15 | } | ||
16 | |||
17 | data = oe.packagedata.read_pkgdata(vars["PN"], d) | ||
18 | |||
19 | for key in data.keys(): | ||
20 | d.setVar(key, data[key]) | ||
21 | |||
22 | for pkg in d.getVar('PACKAGES').split(): | ||
23 | sdata = oe.packagedata.read_subpkgdata(pkg, d) | ||
24 | for key in sdata.keys(): | ||
25 | if key in vars: | ||
26 | if sdata[key] != vars[key]: | ||
27 | if key == "PN": | ||
28 | bb.fatal("Recipe %s is trying to create package %s which was already written by recipe %s. This will cause corruption, please resolve this and only provide the package from one recipe or the other or only build one of the recipes." % (vars[key], pkg, sdata[key])) | ||
29 | bb.fatal("Recipe %s is trying to change %s from '%s' to '%s'. This will cause do_package_write_* failures since the incorrect data will be used and they will be unable to find the right workdir." % (vars["PN"], key, vars[key], sdata[key])) | ||
30 | continue | ||
31 | # | ||
32 | # If we set unsuffixed variables here there is a chance they could clobber override versions | ||
33 | # of that variable, e.g. DESCRIPTION could clobber DESCRIPTION:<pkgname> | ||
34 | # We therefore don't clobber for the unsuffixed variable versions | ||
35 | # | ||
36 | if key.endswith(":" + pkg): | ||
37 | d.setVar(key, sdata[key]) | ||
38 | else: | ||
39 | d.setVar(key, sdata[key], parsing=True) | ||
40 | } | ||