Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 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 | } |