summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/update-alternatives.bbclass95
1 files changed, 1 insertions, 94 deletions
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index 2cadaf79e3..f75f5b6115 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -57,96 +57,12 @@
57# 57#
58# The package priority for a specific target 58# The package priority for a specific target
59# ALTERNATIVE_PRIORITY_<pkg>[name] = "priority" 59# ALTERNATIVE_PRIORITY_<pkg>[name] = "priority"
60#
61#
62# -----
63#
64#
65# The following describes deprecated behavior, using any of the
66# following modes will result in a warning, and eventually an error:
67#
68# There are two basic modes supported: 'single update' and 'batch update'
69#
70# 'single update' is used for a single alternative command, and you're
71# expected to provide at least below keywords:
72#
73# ALTERNATIVE_NAME - the name that the alternative is registered
74# ALTERNATIVE_PATH - the path of installed alternative
75#
76# ALTERNATIVE_PRIORITY and ALTERNATIVE_LINK are optional which have defaults
77# in this class.
78#
79# 'batch update' is used if you have multiple alternatives to be updated.
80# Unlike 'single update', 'batch update' in most times only require two
81# parameters:
82#
83# ALTERNATIVE_LINKS - a list of symbolic links for which you'd like to
84# create alternatives, with space as delimiter, e.g:
85#
86# ALTERNATIVE_LINKS = "${bindir}/cmd1 ${sbindir}/cmd2 ..."
87#
88# ALTERNATIVE_PRIORITY - optional, applies to all
89#
90# To simplify the design, this class has the assumption that for a name
91# listed in ALTERNATIVE_LINKS, say /path/cmd:
92#
93# the name of the alternative would be: cmd
94# the path of installed alternative would be: /path/cmd.${BPN}
95# ${D}/path/cmd will be renamed to ${D}/path/cmd.{BPN} automatically
96# priority will be the same from ALTERNATIVE_PRIORITY
97#
98# If above assumption breaks your requirement, then you still need to use
99# your own update-alternatives command directly.
100 60
101# defaults
102ALTERNATIVE_PRIORITY = "10" 61ALTERNATIVE_PRIORITY = "10"
103 62
104# The following code is deprecated, but included for compatibility with older packages
105def update_alternatives_after_parse(d):
106 if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d):
107 return
108
109 # The following code is deprecated, but included for compatibility with older packages
110 pn = d.getVar('BPN', True)
111
112 if d.getVar('ALTERNATIVE_LINKS') != None:
113 # Convert old format to new format...
114 alt_links = d.getVar('ALTERNATIVE_LINKS', True) or ""
115 for alt_link in alt_links.split():
116 alt_name = os.path.basename(alt_link)
117
118 alternative = d.getVar('ALTERNATIVE_%s' % pn, True) or ""
119 alternative += " " + alt_name
120 d.setVar('ALTERNATIVE_%s' % pn, alternative)
121 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link)
122 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, alt_link)
123 return
124
125 if d.getVar('ALTERNATIVE_NAME') != None or d.getVar('ALTERNATIVE_PATH') != None:
126 # Convert old format to new format...
127 alt_name = d.getVar('ALTERNATIVE_NAME', True)
128 alt_path = d.getVar('ALTERNATIVE_PATH', True)
129 alt_link = d.getVar('ALTERNATIVE_LINK', True) or ("%s/%s" % (d.getVar('bindir', True), alt_name))
130 if alt_name == None:
131 raise bb.build.build.FuncFailed("%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % d.getVar('FILE'))
132 if alt_path == None:
133 raise bb.build.build.FuncFailed("%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % d.getVar('FILE'))
134
135 alternative = d.getVar('ALTERNATIVE_%s' % pn, True) or ""
136 alternative += " " + alt_name
137
138 # Fix the alt_path if it's relative
139 alt_path = os.path.join(os.path.dirname(alt_link), alt_path)
140
141 d.setVar('ALTERNATIVE_%s' % pn, alternative)
142 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link)
143 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, alt_path)
144
145
146# We need special processing for vardeps because it can not work on 63# We need special processing for vardeps because it can not work on
147# modified flag values. So we agregate the flags into a new variable 64# modified flag values. So we agregate the flags into a new variable
148# and include that vairable in the set. 65# and include that vairable in the set.
149
150UPDALTVARS = "ALTERNATIVE ALTERNATIVE_LINK_NAME ALTERNATIVE_TARGET ALTERNATIVE_PRIORITY" 66UPDALTVARS = "ALTERNATIVE ALTERNATIVE_LINK_NAME ALTERNATIVE_TARGET ALTERNATIVE_PRIORITY"
151 67
152def gen_updatealternativesvardeps(d): 68def gen_updatealternativesvardeps(d):
@@ -178,9 +94,6 @@ python __anonymous() {
178 bb.data.inherits_class('cross-canadian', d): 94 bb.data.inherits_class('cross-canadian', d):
179 return 95 return
180 96
181 # deprecated stuff...
182 update_alternatives_after_parse(d)
183
184 # compute special vardeps 97 # compute special vardeps
185 gen_updatealternativesvardeps(d) 98 gen_updatealternativesvardeps(d)
186 99
@@ -202,9 +115,6 @@ def gen_updatealternativesvars(d):
202 ret.append(v + "_VARDEPS_" + p) 115 ret.append(v + "_VARDEPS_" + p)
203 return " ".join(ret) 116 return " ".join(ret)
204 117
205# First the deprecated items...
206populate_packages[vardeps] += "ALTERNATIVE_LINKS ALTERNATIVE_NAME ALTERNATIVE_PATH"
207
208# Now the new stuff, we use a custom function to generate the right values 118# Now the new stuff, we use a custom function to generate the right values
209populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}" 119populate_packages[vardeps] += "${UPDALTVARS} ${@gen_updatealternativesvars(d)}"
210 120
@@ -215,10 +125,7 @@ python perform_packagecopy_append () {
215 # Check for deprecated usage... 125 # Check for deprecated usage...
216 pn = d.getVar('BPN', True) 126 pn = d.getVar('BPN', True)
217 if d.getVar('ALTERNATIVE_LINKS', True) != None: 127 if d.getVar('ALTERNATIVE_LINKS', True) != None:
218 bb.warn('%s: Use of ALTERNATIVE_LINKS is deprecated, see update-alternatives.bbclass for more info.' % pn) 128 bb.fatal('%s: Use of ALTERNATIVE_LINKS/ALTERNATIVE_PATH/ALTERNATIVE_NAME is no longer supported, please convert to the updated syntax, see update-alternatives.bbclass for more info.' % pn)
219
220 if d.getVar('ALTERNATIVE_NAME', True) != None or d.getVar('ALTERNATIVE_PATH', True) != None:
221 bb.warn('%s: Use of ALTERNATIVE_NAME is deprecated, see update-alternatives.bbclass for more info.' % pn)
222 129
223 # Do actual update alternatives processing 130 # Do actual update alternatives processing
224 pkgdest = d.getVar('PKGD', True) 131 pkgdest = d.getVar('PKGD', True)