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