Advertisement
Guest User

Untitled

a guest
Oct 25th, 2023
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.51 KB | None | 0 0
  1. def do_rootfs(d):
  2. from oe.rootfs import create_rootfs
  3. from oe.manifest import create_manifest
  4. import logging
  5.  
  6. logger = d.getVar('BB_TASK_LOGGER', False)
  7. if logger:
  8. logcatcher = bb.utils.LogCatcher()
  9. logger.addHandler(logcatcher)
  10. else:
  11. logcatcher = None
  12.  
  13. # NOTE: if you add, remove or significantly refactor the stages of this
  14. # process then you should recalculate the weightings here. This is quite
  15. # easy to do - just change the MultiStageProgressReporter line temporarily
  16. # to pass debug=True as the last parameter and you'll get a printout of
  17. # the weightings as well as a map to the lines where next_stage() was
  18. # called. Of course this isn't critical, but it helps to keep the progress
  19. # reporting accurate.
  20. stage_weights = [1, 203, 354, 186, 65, 4228, 1, 353, 49, 330, 382, 23, 1]
  21. progress_reporter = bb.progress.MultiStageProgressReporter(d, stage_weights)
  22. progress_reporter.next_stage()
  23.  
  24. # Handle package exclusions
  25. excl_pkgs = d.getVar("PACKAGE_EXCLUDE").split()
  26. inst_pkgs = d.getVar("PACKAGE_INSTALL").split()
  27. inst_attempt_pkgs = d.getVar("PACKAGE_INSTALL_ATTEMPTONLY").split()
  28.  
  29. d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
  30. d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
  31.  
  32. for pkg in excl_pkgs:
  33. if pkg in inst_pkgs:
  34. bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
  35. inst_pkgs.remove(pkg)
  36.  
  37. if pkg in inst_attempt_pkgs:
  38. bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs))
  39. inst_attempt_pkgs.remove(pkg)
  40.  
  41. d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
  42. d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
  43.  
  44. # Ensure we handle package name remapping
  45. # We have to delay the runtime_mapping_rename until just before rootfs runs
  46. # otherwise, the multilib renaming could step in and squash any fixups that
  47. # may have occurred.
  48. pn = d.getVar('PN')
  49. runtime_mapping_rename("PACKAGE_INSTALL", pn, d)
  50. runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d)
  51. runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d)
  52.  
  53. # Generate the initial manifest
  54. create_manifest(d)
  55.  
  56. progress_reporter.next_stage()
  57.  
  58. # generate rootfs
  59. d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
  60. create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
  61.  
  62. progress_reporter.finish()
  63.  
  64. do_rootfs(d)
  65.  
  66. def runtime_mapping_rename (varname, pkg, d):
  67. #bb.note("%s before: %s" % (varname, d.getVar(varname)))
  68.  
  69. new_depends = {}
  70. deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "")
  71. for depend, depversions in deps.items():
  72. new_depend = get_package_mapping(depend, pkg, d, depversions)
  73. if depend != new_depend:
  74. bb.note("package name mapping done: %s -> %s" % (depend, new_depend))
  75. new_depends[new_depend] = deps[depend]
  76.  
  77. d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False))
  78.  
  79. #bb.note("%s after: %s" % (varname, d.getVar(varname)))
  80.  
  81. #
  82. # Used by do_packagedata (and possibly other routines post do_package)
  83. #
  84.  
  85. def get_package_mapping (pkg, basepkg, d, depversions=None):
  86. import oe.packagedata
  87.  
  88. data = oe.packagedata.read_subpkgdata(pkg, d)
  89. key = "PKG:%s" % pkg
  90.  
  91. if key in data:
  92. if bb.data.inherits_class('allarch', d) and bb.data.inherits_class('packagegroup', d) and pkg != data[key]:
  93. bb.error("An allarch packagegroup shouldn't depend on packages which are dynamically renamed (%s to %s)" % (pkg, data[key]))
  94. # Have to avoid undoing the write_extra_pkgs(global_variants...)
  95. if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \
  96. and data[key] == basepkg:
  97. return pkg
  98. if depversions == []:
  99. # Avoid returning a mapping if the renamed package rprovides its original name
  100. rprovkey = "RPROVIDES:%s" % pkg
  101. if rprovkey in data:
  102. if pkg in bb.utils.explode_dep_versions2(data[rprovkey]):
  103. bb.note("%s rprovides %s, not replacing the latter" % (data[key], pkg))
  104. return pkg
  105. # Do map to rewritten package name
  106. return data[key]
  107.  
  108. return pkg
  109.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement