packagedata.bbclass 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #
  2. # Copyright OpenEmbedded Contributors
  3. #
  4. # SPDX-License-Identifier: MIT
  5. #
  6. python read_subpackage_metadata () {
  7. import oe.packagedata
  8. vars = {
  9. "PN" : d.getVar('PN'),
  10. "PE" : d.getVar('PE'),
  11. "PV" : d.getVar('PV'),
  12. "PR" : d.getVar('PR'),
  13. }
  14. data = oe.packagedata.read_pkgdata(vars["PN"], d)
  15. for key in data.keys():
  16. d.setVar(key, data[key])
  17. for pkg in d.getVar('PACKAGES').split():
  18. sdata = oe.packagedata.read_subpkgdata(pkg, d)
  19. for key in sdata.keys():
  20. if key in vars:
  21. if sdata[key] != vars[key]:
  22. if key == "PN":
  23. 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]))
  24. 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]))
  25. continue
  26. #
  27. # If we set unsuffixed variables here there is a chance they could clobber override versions
  28. # of that variable, e.g. DESCRIPTION could clobber DESCRIPTION:<pkgname>
  29. # We therefore don't clobber for the unsuffixed variable versions
  30. #
  31. if key.endswith(":" + pkg):
  32. d.setVar(key, sdata[key])
  33. else:
  34. d.setVar(key, sdata[key], parsing=True)
  35. }