summaryrefslogtreecommitdiffstats
path: root/meta/classes/utils.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/utils.bbclass')
-rw-r--r--meta/classes/utils.bbclass126
1 files changed, 63 insertions, 63 deletions
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index ccf78fcfee..57406109de 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -292,77 +292,77 @@ END
292} 292}
293 293
294def check_app_exists(app, d): 294def check_app_exists(app, d):
295 from bb import which, data 295 from bb import which, data
296 296
297 app = data.expand(app, d) 297 app = data.expand(app, d)
298 path = data.getVar('PATH', d, 1) 298 path = data.getVar('PATH', d, 1)
299 return bool(which(path, app)) 299 return bool(which(path, app))
300 300
301def explode_deps(s): 301def explode_deps(s):
302 return bb.utils.explode_deps(s) 302 return bb.utils.explode_deps(s)
303 303
304def base_set_filespath(path, d): 304def base_set_filespath(path, d):
305 filespath = [] 305 filespath = []
306 extrapaths = (d.getVar("FILESEXTRAPATHS", True) or "") 306 extrapaths = (d.getVar("FILESEXTRAPATHS", True) or "")
307 # Don't prepend empty strings to the path list 307 # Don't prepend empty strings to the path list
308 if extrapaths != "": 308 if extrapaths != "":
309 path = extrapaths.split(":") + path 309 path = extrapaths.split(":") + path
310 # The ":" ensures we have an 'empty' override 310 # The ":" ensures we have an 'empty' override
311 overrides = (d.getVar("OVERRIDES", True) or "") + ":" 311 overrides = (d.getVar("OVERRIDES", True) or "") + ":"
312 for p in path: 312 for p in path:
313 if p != "": 313 if p != "":
314 for o in overrides.split(":"): 314 for o in overrides.split(":"):
315 filespath.append(os.path.join(p, o)) 315 filespath.append(os.path.join(p, o))
316 return ":".join(filespath) 316 return ":".join(filespath)
317 317
318def extend_variants(d, var, extend, delim=':'): 318def extend_variants(d, var, extend, delim=':'):
319 """Return a string of all bb class extend variants for the given extend""" 319 """Return a string of all bb class extend variants for the given extend"""
320 variants = [] 320 variants = []
321 whole = d.getVar(var, True) or "" 321 whole = d.getVar(var, True) or ""
322 for ext in whole.split(): 322 for ext in whole.split():
323 eext = ext.split(delim) 323 eext = ext.split(delim)
324 if len(eext) > 1 and eext[0] == extend: 324 if len(eext) > 1 and eext[0] == extend:
325 variants.append(eext[1]) 325 variants.append(eext[1])
326 return " ".join(variants) 326 return " ".join(variants)
327 327
328def multilib_pkg_extend(d, pkg): 328def multilib_pkg_extend(d, pkg):
329 variants = (d.getVar("MULTILIB_VARIANTS", True) or "").split() 329 variants = (d.getVar("MULTILIB_VARIANTS", True) or "").split()
330 if not variants: 330 if not variants:
331 return pkg 331 return pkg
332 pkgs = pkg 332 pkgs = pkg
333 for v in variants: 333 for v in variants:
334 pkgs = pkgs + " " + v + "-" + pkg 334 pkgs = pkgs + " " + v + "-" + pkg
335 return pkgs 335 return pkgs
336 336
337def all_multilib_tune_values(d, var, unique = True, need_split = True, delim = ' '): 337def all_multilib_tune_values(d, var, unique = True, need_split = True, delim = ' '):
338 """Return a string of all ${var} in all multilib tune configuration""" 338 """Return a string of all ${var} in all multilib tune configuration"""
339 values = [] 339 values = []
340 value = d.getVar(var, True) or "" 340 value = d.getVar(var, True) or ""
341 if value != "": 341 if value != "":
342 if need_split: 342 if need_split:
343 for item in value.split(delim): 343 for item in value.split(delim):
344 values.append(item) 344 values.append(item)
345 else: 345 else:
346 values.append(value) 346 values.append(value)
347 variants = d.getVar("MULTILIB_VARIANTS", True) or "" 347 variants = d.getVar("MULTILIB_VARIANTS", True) or ""
348 for item in variants.split(): 348 for item in variants.split():
349 localdata = bb.data.createCopy(d) 349 localdata = bb.data.createCopy(d)
350 overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item 350 overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
351 localdata.setVar("OVERRIDES", overrides) 351 localdata.setVar("OVERRIDES", overrides)
352 bb.data.update_data(localdata) 352 bb.data.update_data(localdata)
353 value = localdata.getVar(var, True) or "" 353 value = localdata.getVar(var, True) or ""
354 if value != "": 354 if value != "":
355 if need_split: 355 if need_split:
356 for item in value.split(delim): 356 for item in value.split(delim):
357 values.append(item) 357 values.append(item)
358 else: 358 else:
359 values.append(value) 359 values.append(value)
360 if unique: 360 if unique:
361 #we do this to keep order as much as possible 361 #we do this to keep order as much as possible
362 ret = [] 362 ret = []
363 for value in values: 363 for value in values:
364 if not value in ret: 364 if not value in ret:
365 ret.append(value) 365 ret.append(value)
366 else: 366 else:
367 ret = values 367 ret = values
368 return " ".join(ret) 368 return " ".join(ret)