blob: c2760e2bf0cf28e3feee98610daf4384178bb2df [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001python read_subpackage_metadata () {
2 import oe.packagedata
3
4 vars = {
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005 "PN" : d.getVar('PN'),
6 "PE" : d.getVar('PE'),
7 "PV" : d.getVar('PV'),
8 "PR" : d.getVar('PR'),
Patrick Williamsc124f4f2015-09-15 14:41:29 -05009 }
10
11 data = oe.packagedata.read_pkgdata(vars["PN"], d)
12
13 for key in data.keys():
14 d.setVar(key, data[key])
15
Brad Bishop6e60e8b2018-02-01 10:27:11 -050016 for pkg in d.getVar('PACKAGES').split():
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 sdata = oe.packagedata.read_subpkgdata(pkg, d)
18 for key in sdata.keys():
19 if key in vars:
20 if sdata[key] != vars[key]:
21 if key == "PN":
22 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]))
23 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]))
24 continue
25 #
26 # If we set unsuffixed variables here there is a chance they could clobber override versions
Patrick Williams213cb262021-08-07 19:21:33 -050027 # of that variable, e.g. DESCRIPTION could clobber DESCRIPTION:<pkgname>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 # We therefore don't clobber for the unsuffixed variable versions
29 #
Patrick Williams213cb262021-08-07 19:21:33 -050030 if key.endswith(":" + pkg):
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031 d.setVar(key, sdata[key])
32 else:
33 d.setVar(key, sdata[key], parsing=True)
34}