summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/data.py')
-rw-r--r--bitbake/lib/bb/data.py49
1 files changed, 41 insertions, 8 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index 55d1cc9053..819dff9679 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -45,7 +45,8 @@ else:
45 path = os.path.dirname(os.path.dirname(sys.argv[0])) 45 path = os.path.dirname(os.path.dirname(sys.argv[0]))
46sys.path.insert(0,path) 46sys.path.insert(0,path)
47 47
48from bb import note, debug, data_smart 48from bb import data_smart
49import bb
49 50
50_dict_type = data_smart.DataSmart 51_dict_type = data_smart.DataSmart
51 52
@@ -362,10 +363,12 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
362 val.rstrip() 363 val.rstrip()
363 if not val: 364 if not val:
364 return 0 365 return 0
366
367 varExpanded = expand(var, d)
365 368
366 if getVarFlag(var, "func", d): 369 if getVarFlag(var, "func", d):
367# NOTE: should probably check for unbalanced {} within the var 370# NOTE: should probably check for unbalanced {} within the var
368 o.write("%s() {\n%s\n}\n" % (var, val)) 371 o.write("%s() {\n%s\n}\n" % (varExpanded, val))
369 else: 372 else:
370 if getVarFlag(var, "export", d): 373 if getVarFlag(var, "export", d):
371 o.write('export ') 374 o.write('export ')
@@ -375,7 +378,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
375# if we're going to output this within doublequotes, 378# if we're going to output this within doublequotes,
376# to a shell, we need to escape the quotes in the var 379# to a shell, we need to escape the quotes in the var
377 alter = re.sub('"', '\\"', val.strip()) 380 alter = re.sub('"', '\\"', val.strip())
378 o.write('%s="%s"\n' % (var, alter)) 381 o.write('%s="%s"\n' % (varExpanded, alter))
379 return 1 382 return 1
380 383
381 384
@@ -430,8 +433,38 @@ def update_data(d):
430 >>> update_data(d) 433 >>> update_data(d)
431 >>> print getVar('TEST', d) 434 >>> print getVar('TEST', d)
432 local 435 local
436
437 CopyMonster:
438 >>> e = d.createCopy()
439 >>> setVar('TEST_foo', 'foo', e)
440 >>> update_data(e)
441 >>> print getVar('TEST', e)
442 local
443
444 >>> setVar('OVERRIDES', 'arm:ramses:local:foo', e)
445 >>> update_data(e)
446 >>> print getVar('TEST', e)
447 foo
448
449 >>> f = d.createCopy()
450 >>> setVar('TEST_moo', 'something', f)
451 >>> setVar('OVERRIDES', 'moo:arm:ramses:local:foo', e)
452 >>> update_data(e)
453 >>> print getVar('TEST', e)
454 foo
455
456
457 >>> h = init()
458 >>> setVar('SRC_URI', 'file://append.foo;patch=1 ', h)
459 >>> g = h.createCopy()
460 >>> setVar('SRC_URI_append_arm', 'file://other.foo;patch=1', g)
461 >>> setVar('OVERRIDES', 'arm:moo', g)
462 >>> update_data(g)
463 >>> print getVar('SRC_URI', g)
464 file://append.foo;patch=1 file://other.foo;patch=1
465
433 """ 466 """
434 debug(2, "update_data()") 467 bb.msg.debug(2, bb.msg.domain.Data, "update_data()")
435 468
436 # now ask the cookie monster for help 469 # now ask the cookie monster for help
437 #print "Cookie Monster" 470 #print "Cookie Monster"
@@ -460,7 +493,7 @@ def update_data(d):
460 l = len(o)+1 493 l = len(o)+1
461 494
462 # see if one should even try 495 # see if one should even try
463 if not o in d._seen_overrides: 496 if not d._seen_overrides.has_key(o):
464 continue 497 continue
465 498
466 vars = d._seen_overrides[o] 499 vars = d._seen_overrides[o]
@@ -469,10 +502,10 @@ def update_data(d):
469 try: 502 try:
470 d[name] = d[var] 503 d[name] = d[var]
471 except: 504 except:
472 note ("Untracked delVar") 505 bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar")
473 506
474 # now on to the appends and prepends 507 # now on to the appends and prepends
475 if '_append' in d._special_values: 508 if d._special_values.has_key('_append'):
476 appends = d._special_values['_append'] or [] 509 appends = d._special_values['_append'] or []
477 for append in appends: 510 for append in appends:
478 for (a, o) in getVarFlag(append, '_append', d) or []: 511 for (a, o) in getVarFlag(append, '_append', d) or []:
@@ -487,7 +520,7 @@ def update_data(d):
487 setVar(append, sval, d) 520 setVar(append, sval, d)
488 521
489 522
490 if '_prepend' in d._special_values: 523 if d._special_values.has_key('_prepend'):
491 prepends = d._special_values['_prepend'] or [] 524 prepends = d._special_values['_prepend'] or []
492 525
493 for prepend in prepends: 526 for prepend in prepends: