summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2019-06-26 20:59:34 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-30 16:44:42 +0100
commitdabc1206b54d423996c311126f2bacc445fb2459 (patch)
treec28d4efb396c43aee77b21843c863291e6f6395f
parent4802bed8cee1836e8945a91980d3d703cb0de2c0 (diff)
downloadpoky-dabc1206b54d423996c311126f2bacc445fb2459.tar.gz
multilib.bbclass: Reduce ALTERNATIVE_PRIORITY for extended recipes
Fixed: MACHINE = "qemux86-64" require conf/multilib.conf MULTILIBS = "multilib:lib32" DEFAULTTUNE_virtclass-multilib-lib32 = "x86" $ bitbake core-image-minimal update-alternatives: libtool has multiple providers with the same priority, please check /path/to/rootfs/usr/lib/opkg/alternatives/libtool for details Both libtool and lib32-libtool have the same priority (as they're the same recipe), so update-alternatives won't deterministically pick a provider. This means you could end up with an image using a 32-bit pkgconfig and 64-bit libtool, for example. Make extended recipes reduce priority by 1 (or 2, 3 ... when there are multiple variants in MULTILIB_VARIANTS) to fix the problem. [YOCTO #13418] (From OE-Core rev: 51730928df4dbecac72b56e9f843885674b4d18a) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/multilib.bbclass47
1 files changed, 47 insertions, 0 deletions
diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
index 2b761f3551..9b27b53b47 100644
--- a/meta/classes/multilib.bbclass
+++ b/meta/classes/multilib.bbclass
@@ -123,8 +123,55 @@ python __anonymous () {
123 clsextend.map_variable("USERADD_PACKAGES") 123 clsextend.map_variable("USERADD_PACKAGES")
124 clsextend.map_variable("SYSTEMD_PACKAGES") 124 clsextend.map_variable("SYSTEMD_PACKAGES")
125 clsextend.map_variable("UPDATERCPN") 125 clsextend.map_variable("UPDATERCPN")
126
127 reset_alternative_priority(d)
126} 128}
127 129
130def reset_alternative_priority(d):
131 if not bb.data.inherits_class('update-alternatives', d):
132 return
133
134 # There might be multiple multilibs at the same time, e.g., lib32 and
135 # lib64, each of them should have a different priority.
136 multilib_variants = d.getVar('MULTILIB_VARIANTS')
137 bbextendvariant = d.getVar('BBEXTENDVARIANT')
138 reset_gap = multilib_variants.split().index(bbextendvariant) + 1
139
140 # ALTERNATIVE_PRIORITY = priority
141 alt_priority_recipe = d.getVar('ALTERNATIVE_PRIORITY')
142 # Reset ALTERNATIVE_PRIORITY when found
143 if alt_priority_recipe:
144 reset_priority = int(alt_priority_recipe) - reset_gap
145 bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY to %s' % (d.getVar('PN'), reset_priority))
146 d.setVar('ALTERNATIVE_PRIORITY', reset_priority)
147
148 handled_pkgs = []
149 for pkg in (d.getVar('PACKAGES') or "").split():
150 # ALTERNATIVE_PRIORITY_pkg = priority
151 alt_priority_pkg = d.getVar('ALTERNATIVE_PRIORITY_%s' % pkg)
152 # Reset ALTERNATIVE_PRIORITY_pkg when found
153 if alt_priority_pkg:
154 reset_priority = int(alt_priority_pkg) - reset_gap
155 if not pkg in handled_pkgs:
156 handled_pkgs.append(pkg)
157 bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY_%s to %s' % (pkg, pkg, reset_priority))
158 d.setVar('ALTERNATIVE_PRIORITY_%s' % pkg, reset_priority)
159
160 for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split():
161 # ALTERNATIVE_PRIORITY_pkg[tool] = priority
162 alt_priority_pkg_name = d.getVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name)
163 # ALTERNATIVE_PRIORITY[tool] = priority
164 alt_priority_name = d.getVarFlag('ALTERNATIVE_PRIORITY', alt_name)
165
166 if alt_priority_pkg_name:
167 reset_priority = int(alt_priority_pkg_name) - reset_gap
168 bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY_%s[%s] to %s' % (pkg, pkg, alt_name, reset_priority))
169 d.setVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name, reset_priority)
170 elif alt_priority_name:
171 reset_priority = int(alt_priority_name) - reset_gap
172 bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY[%s] to %s' % (pkg, alt_name, reset_priority))
173 d.setVarFlag('ALTERNATIVE_PRIORITY', alt_name, reset_priority)
174
128PACKAGEFUNCS_append = " do_package_qa_multilib" 175PACKAGEFUNCS_append = " do_package_qa_multilib"
129 176
130python do_package_qa_multilib() { 177python do_package_qa_multilib() {