diff options
Diffstat (limited to 'meta/classes')
-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 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 | ||
130 | def 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 | |||
128 | PACKAGEFUNCS_append = " do_package_qa_multilib" | 175 | PACKAGEFUNCS_append = " do_package_qa_multilib" |
129 | 176 | ||
130 | python do_package_qa_multilib() { | 177 | python do_package_qa_multilib() { |