summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/update-alternatives.bbclass27
1 files changed, 22 insertions, 5 deletions
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index aa01058cf9..ee66379933 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -89,15 +89,21 @@ def ua_extend_depends(d):
89 if not 'virtual/update-alternatives' in d.getVar('PROVIDES'): 89 if not 'virtual/update-alternatives' in d.getVar('PROVIDES'):
90 d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives') 90 d.appendVar('DEPENDS', ' virtual/${MLPREFIX}update-alternatives')
91 91
92python __anonymous() { 92def update_alternatives_enabled(d):
93 # Update Alternatives only works on target packages... 93 # Update Alternatives only works on target packages...
94 if bb.data.inherits_class('native', d) or \ 94 if bb.data.inherits_class('native', d) or \
95 bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or \ 95 bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d) or \
96 bb.data.inherits_class('cross-canadian', d): 96 bb.data.inherits_class('cross-canadian', d):
97 return 97 return False
98 98
99 # Disable when targeting mingw32 (no target support) 99 # Disable when targeting mingw32 (no target support)
100 if d.getVar("TARGET_OS") == "mingw32": 100 if d.getVar("TARGET_OS") == "mingw32":
101 return False
102
103 return True
104
105python __anonymous() {
106 if not update_alternatives_enabled(d):
101 return 107 return
102 108
103 # compute special vardeps 109 # compute special vardeps
@@ -128,6 +134,11 @@ populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}"
128# the split and strip steps.. packagecopy seems to be the earliest reasonable 134# the split and strip steps.. packagecopy seems to be the earliest reasonable
129# place. 135# place.
130python perform_packagecopy_append () { 136python perform_packagecopy_append () {
137 if update_alternatives_enabled(d):
138 apply_update_alternative_renames(d)
139}
140
141def apply_update_alternative_renames(d):
131 # Check for deprecated usage... 142 # Check for deprecated usage...
132 pn = d.getVar('BPN') 143 pn = d.getVar('BPN')
133 if d.getVar('ALTERNATIVE_LINKS') != None: 144 if d.getVar('ALTERNATIVE_LINKS') != None:
@@ -194,11 +205,13 @@ python perform_packagecopy_append () {
194 os.unlink(src) 205 os.unlink(src)
195 else: 206 else:
196 bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target)) 207 bb.warn('%s: Unable to resolve dangling symlink: %s' % (pn, alt_target))
197}
198 208
199PACKAGESPLITFUNCS_prepend = "populate_packages_updatealternatives " 209PACKAGESPLITFUNCS_prepend = "populate_packages_updatealternatives "
200 210
201python populate_packages_updatealternatives () { 211python populate_packages_updatealternatives () {
212 if not update_alternatives_enabled(d):
213 return
214
202 pn = d.getVar('BPN') 215 pn = d.getVar('BPN')
203 216
204 # Do actual update alternatives processing 217 # Do actual update alternatives processing
@@ -252,10 +265,15 @@ python populate_packages_updatealternatives () {
252} 265}
253 266
254python package_do_filedeps_append () { 267python package_do_filedeps_append () {
268 if update_alternatives_enabled(d):
269 apply_update_alternative_provides(d)
270}
271
272def apply_update_alternative_provides(d):
255 pn = d.getVar('BPN') 273 pn = d.getVar('BPN')
256 pkgdest = d.getVar('PKGDEST') 274 pkgdest = d.getVar('PKGDEST')
257 275
258 for pkg in packages.split(): 276 for pkg in d.getVar('PACKAGES').split():
259 for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split(): 277 for alt_name in (d.getVar('ALTERNATIVE_%s' % pkg) or "").split():
260 alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name) 278 alt_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', alt_name)
261 alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name) 279 alt_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, alt_name) or d.getVarFlag('ALTERNATIVE_TARGET', alt_name)
@@ -273,5 +291,4 @@ python package_do_filedeps_append () {
273 d.appendVar('FILERPROVIDES_%s_%s' % (trans_target, pkg), " " + alt_link) 291 d.appendVar('FILERPROVIDES_%s_%s' % (trans_target, pkg), " " + alt_link)
274 if not trans_target in (d.getVar('FILERPROVIDESFLIST_%s' % pkg) or ""): 292 if not trans_target in (d.getVar('FILERPROVIDESFLIST_%s' % pkg) or ""):
275 d.appendVar('FILERPROVIDESFLIST_%s' % pkg, " " + trans_target) 293 d.appendVar('FILERPROVIDESFLIST_%s' % pkg, " " + trans_target)
276}
277 294