diff options
Diffstat (limited to 'meta/classes/multilib.bbclass')
-rw-r--r-- | meta/classes/multilib.bbclass | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass index 7750221f7d..d625bd527c 100644 --- a/meta/classes/multilib.bbclass +++ b/meta/classes/multilib.bbclass | |||
@@ -125,8 +125,55 @@ python __anonymous () { | |||
125 | clsextend.map_variable("USERADD_PACKAGES") | 125 | clsextend.map_variable("USERADD_PACKAGES") |
126 | clsextend.map_variable("SYSTEMD_PACKAGES") | 126 | clsextend.map_variable("SYSTEMD_PACKAGES") |
127 | clsextend.map_variable("UPDATERCPN") | 127 | clsextend.map_variable("UPDATERCPN") |
128 | |||
129 | reset_alternative_priority(d) | ||
128 | } | 130 | } |
129 | 131 | ||
132 | def reset_alternative_priority(d): | ||
133 | if not bb.data.inherits_class('update-alternatives', d): | ||
134 | return | ||
135 | |||
136 | # There might be multiple multilibs at the same time, e.g., lib32 and | ||
137 | # lib64, each of them should have a different priority. | ||
138 | multilib_variants = d.getVar('MULTILIB_VARIANTS') | ||
139 | bbextendvariant = d.getVar('BBEXTENDVARIANT') | ||
140 | reset_gap = multilib_variants.split().index(bbextendvariant) + 1 | ||
141 | |||
142 | # ALTERNATIVE_PRIORITY = priority | ||
143 | alt_priority_recipe = d.getVar('ALTERNATIVE_PRIORITY') | ||
144 | # Reset ALTERNATIVE_PRIORITY when found | ||
145 | if alt_priority_recipe: | ||
146 | reset_priority = int(alt_priority_recipe) - reset_gap | ||
147 | bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY to %s' % (d.getVar('PN'), reset_priority)) | ||
148 | d.setVar('ALTERNATIVE_PRIORITY', reset_priority) | ||
149 | |||
150 | handled_pkgs = [] | ||
151 | for pkg in (d.getVar('PACKAGES') or "").split(): | ||
152 | # ALTERNATIVE_PRIORITY_pkg = priority | ||
153 | alt_priority_pkg = d.getVar('ALTERNATIVE_PRIORITY_%s' % pkg) | ||
154 | # Reset ALTERNATIVE_PRIORITY_pkg when found | ||
155 | if alt_priority_pkg: | ||
156 | reset_priority = int(alt_priority_pkg) - reset_gap | ||
157 | if not pkg in handled_pkgs: | ||
158 | handled_pkgs.append(pkg) | ||
159 | bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY_%s to %s' % (pkg, pkg, reset_priority)) | ||
160 | d.setVar('ALTERNATIVE_PRIORITY_%s' % pkg, reset_priority) | ||
161 | |||
162 | for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split(): | ||
163 | # ALTERNATIVE_PRIORITY_pkg[tool] = priority | ||
164 | alt_priority_pkg_name = d.getVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name) | ||
165 | # ALTERNATIVE_PRIORITY[tool] = priority | ||
166 | alt_priority_name = d.getVarFlag('ALTERNATIVE_PRIORITY', alt_name) | ||
167 | |||
168 | if alt_priority_pkg_name: | ||
169 | reset_priority = int(alt_priority_pkg_name) - reset_gap | ||
170 | bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY_%s[%s] to %s' % (pkg, pkg, alt_name, reset_priority)) | ||
171 | d.setVarFlag('ALTERNATIVE_PRIORITY_%s' % pkg, alt_name, reset_priority) | ||
172 | elif alt_priority_name: | ||
173 | reset_priority = int(alt_priority_name) - reset_gap | ||
174 | bb.debug(1, '%s: Setting ALTERNATIVE_PRIORITY[%s] to %s' % (pkg, alt_name, reset_priority)) | ||
175 | d.setVarFlag('ALTERNATIVE_PRIORITY', alt_name, reset_priority) | ||
176 | |||
130 | PACKAGEFUNCS_append = " do_package_qa_multilib" | 177 | PACKAGEFUNCS_append = " do_package_qa_multilib" |
131 | 178 | ||
132 | python do_package_qa_multilib() { | 179 | python do_package_qa_multilib() { |