Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | python multilib_virtclass_handler () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 2 | cls = e.data.getVar("BBEXTENDCURR") |
| 3 | variant = e.data.getVar("BBEXTENDVARIANT") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | if cls != "multilib" or not variant: |
| 5 | return |
| 6 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 7 | e.data.setVar('STAGING_KERNEL_DIR', e.data.getVar('STAGING_KERNEL_DIR')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 8 | |
| 9 | # There should only be one kernel in multilib configs |
| 10 | # We also skip multilib setup for module packages. |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 11 | provides = (e.data.getVar("PROVIDES") or "").split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | if "virtual/kernel" in provides or bb.data.inherits_class('module-base', e.data): |
| 13 | raise bb.parse.SkipPackage("We shouldn't have multilib variants for the kernel") |
| 14 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 15 | save_var_name=e.data.getVar("MULTILIB_SAVE_VARNAME") or "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | for name in save_var_name.split(): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 17 | val=e.data.getVar(name) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | if val: |
| 19 | e.data.setVar(name + "_MULTILIB_ORIGINAL", val) |
| 20 | |
| 21 | overrides = e.data.getVar("OVERRIDES", False) |
| 22 | pn = e.data.getVar("PN", False) |
| 23 | overrides = overrides.replace("pn-${PN}", "pn-${PN}:pn-" + pn) |
| 24 | e.data.setVar("OVERRIDES", overrides) |
| 25 | |
| 26 | if bb.data.inherits_class('image', e.data): |
| 27 | e.data.setVar("MLPREFIX", variant + "-") |
| 28 | e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False)) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 29 | e.data.setVar('SDKTARGETSYSROOT', e.data.getVar('SDKTARGETSYSROOT')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | target_vendor = e.data.getVar("TARGET_VENDOR_" + "virtclass-multilib-" + variant, False) |
| 31 | if target_vendor: |
| 32 | e.data.setVar("TARGET_VENDOR", target_vendor) |
| 33 | return |
| 34 | |
| 35 | if bb.data.inherits_class('cross-canadian', e.data): |
| 36 | e.data.setVar("MLPREFIX", variant + "-") |
| 37 | override = ":virtclass-multilib-" + variant |
| 38 | e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | return |
| 40 | |
| 41 | if bb.data.inherits_class('native', e.data): |
| 42 | raise bb.parse.SkipPackage("We can't extend native recipes") |
| 43 | |
| 44 | if bb.data.inherits_class('nativesdk', e.data) or bb.data.inherits_class('crosssdk', e.data): |
| 45 | raise bb.parse.SkipPackage("We can't extend nativesdk recipes") |
| 46 | |
| 47 | if bb.data.inherits_class('allarch', e.data) and not bb.data.inherits_class('packagegroup', e.data): |
| 48 | raise bb.parse.SkipPackage("Don't extend allarch recipes which are not packagegroups") |
| 49 | |
| 50 | |
| 51 | # Expand this since this won't work correctly once we set a multilib into place |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 52 | e.data.setVar("ALL_MULTILIB_PACKAGE_ARCHS", e.data.getVar("ALL_MULTILIB_PACKAGE_ARCHS")) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | |
| 54 | override = ":virtclass-multilib-" + variant |
| 55 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 56 | blacklist = e.data.getVarFlag('PNBLACKLIST', e.data.getVar('PN')) |
| 57 | if blacklist: |
| 58 | pn_new = variant + "-" + e.data.getVar('PN') |
| 59 | if not e.data.getVarFlag('PNBLACKLIST', pn_new): |
| 60 | e.data.setVarFlag('PNBLACKLIST', pn_new, blacklist) |
| 61 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | e.data.setVar("MLPREFIX", variant + "-") |
| 63 | e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False)) |
| 64 | e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override) |
| 65 | |
| 66 | # Expand the WHITELISTs with multilib prefix |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 67 | for whitelist in ["WHITELIST_GPL-3.0", "LGPLv2_WHITELIST_GPL-3.0"]: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 68 | pkgs = e.data.getVar(whitelist) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 69 | for pkg in pkgs.split(): |
| 70 | pkgs += " " + variant + "-" + pkg |
| 71 | e.data.setVar(whitelist, pkgs) |
| 72 | |
| 73 | # DEFAULTTUNE can change TARGET_ARCH override so expand this now before update_data |
| 74 | newtune = e.data.getVar("DEFAULTTUNE_" + "virtclass-multilib-" + variant, False) |
| 75 | if newtune: |
| 76 | e.data.setVar("DEFAULTTUNE", newtune) |
| 77 | e.data.setVar('DEFAULTTUNE_ML_%s' % variant, newtune) |
| 78 | } |
| 79 | |
| 80 | addhandler multilib_virtclass_handler |
| 81 | multilib_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" |
| 82 | |
| 83 | STAGINGCC_prepend = "${BBEXTENDVARIANT}-" |
| 84 | |
| 85 | python __anonymous () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 86 | variant = d.getVar("BBEXTENDVARIANT") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 87 | |
| 88 | import oe.classextend |
| 89 | |
| 90 | clsextend = oe.classextend.ClassExtender(variant, d) |
| 91 | |
| 92 | if bb.data.inherits_class('image', d): |
| 93 | clsextend.map_depends_variable("PACKAGE_INSTALL") |
| 94 | clsextend.map_depends_variable("LINGUAS_INSTALL") |
| 95 | clsextend.map_depends_variable("RDEPENDS") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 96 | pinstall = d.getVar("LINGUAS_INSTALL") + " " + d.getVar("PACKAGE_INSTALL") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 97 | d.setVar("PACKAGE_INSTALL", pinstall) |
| 98 | d.setVar("LINGUAS_INSTALL", "") |
| 99 | # FIXME, we need to map this to something, not delete it! |
| 100 | d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", "") |
| 101 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 102 | if bb.data.inherits_class('image', d): |
| 103 | return |
| 104 | |
| 105 | clsextend.map_depends_variable("DEPENDS") |
| 106 | clsextend.map_variable("PROVIDES") |
| 107 | |
| 108 | if bb.data.inherits_class('cross-canadian', d): |
| 109 | return |
| 110 | |
| 111 | clsextend.rename_packages() |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 112 | clsextend.rename_package_variables((d.getVar("PACKAGEVARS") or "").split()) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 113 | |
| 114 | clsextend.map_packagevars() |
| 115 | clsextend.map_regexp_variable("PACKAGES_DYNAMIC") |
| 116 | clsextend.map_variable("PACKAGE_INSTALL") |
| 117 | clsextend.map_variable("INITSCRIPT_PACKAGES") |
| 118 | clsextend.map_variable("USERADD_PACKAGES") |
| 119 | clsextend.map_variable("SYSTEMD_PACKAGES") |
| 120 | } |
| 121 | |
| 122 | PACKAGEFUNCS_append = " do_package_qa_multilib" |
| 123 | |
| 124 | python do_package_qa_multilib() { |
| 125 | |
| 126 | def check_mlprefix(pkg, var, mlprefix): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 127 | values = bb.utils.explode_deps(d.getVar('%s_%s' % (var, pkg)) or d.getVar(var) or "") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 128 | candidates = [] |
| 129 | for i in values: |
| 130 | if i.startswith('virtual/'): |
| 131 | i = i[len('virtual/'):] |
| 132 | if (not i.startswith('kernel-module')) and (not i.startswith(mlprefix)) and \ |
| 133 | (not 'cross-canadian' in i) and (not i.startswith("nativesdk-")) and \ |
| 134 | (not i.startswith("rtld")) and (not i.startswith('kernel-vmlinux')): |
| 135 | candidates.append(i) |
| 136 | if len(candidates) > 0: |
| 137 | msg = "%s package %s - suspicious values '%s' in %s" \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 138 | % (d.getVar('PN'), pkg, ' '.join(candidates), var) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 139 | package_qa_handle_error("multilib", msg, d) |
| 140 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 141 | ml = d.getVar('MLPREFIX') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 142 | if not ml: |
| 143 | return |
| 144 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 145 | packages = d.getVar('PACKAGES') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 146 | for pkg in packages.split(): |
| 147 | check_mlprefix(pkg, 'RDEPENDS', ml) |
| 148 | check_mlprefix(pkg, 'RPROVIDES', ml) |
| 149 | check_mlprefix(pkg, 'RRECOMMENDS', ml) |
| 150 | check_mlprefix(pkg, 'RSUGGESTS', ml) |
| 151 | check_mlprefix(pkg, 'RREPLACES', ml) |
| 152 | check_mlprefix(pkg, 'RCONFLICTS', ml) |
| 153 | } |