summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/data.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-04-08 15:43:47 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:31 +0100
commitc9c230b14a8202c31648c044e75e47022004014f (patch)
tree200d1ecf81848c41ff944f8fdba68a884fb3f48f /bitbake/lib/bb/data.py
parent00e3915ca6b479f78177e16e27ff9ad8a7fbff02 (diff)
downloadopenembedded-core-c9c230b14a8202c31648c044e75e47022004014f.tar.gz
openembedded-core-c9c230b14a8202c31648c044e75e47022004014f.tar.bz2
openembedded-core-c9c230b14a8202c31648c044e75e47022004014f.zip
Move update_data into the DataSmart class as a finalize() method
(Bitbake rev: ff801397785567cb84b3615de86bff764d65decf) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/data.py')
-rw-r--r--bitbake/lib/bb/data.py138
1 files changed, 2 insertions, 136 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index c3bb1a1f43..5938277273 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -410,142 +410,8 @@ def emit_env(o=sys.__stdout__, d = init(), all=False):
emit_var(e, o, d) and o.write('\n')
def update_data(d):
- """Modifies the environment vars according to local overrides and commands.
- Examples:
- Appending to a variable:
- >>> d = init()
- >>> setVar('TEST', 'this is a', d)
- >>> setVar('TEST_append', ' test', d)
- >>> setVar('TEST_append', ' of the emergency broadcast system.', d)
- >>> update_data(d)
- >>> print getVar('TEST', d)
- this is a test of the emergency broadcast system.
-
- Prepending to a variable:
- >>> setVar('TEST', 'virtual/libc', d)
- >>> setVar('TEST_prepend', 'virtual/tmake ', d)
- >>> setVar('TEST_prepend', 'virtual/patcher ', d)
- >>> update_data(d)
- >>> print getVar('TEST', d)
- virtual/patcher virtual/tmake virtual/libc
-
- Overrides:
- >>> setVar('TEST_arm', 'target', d)
- >>> setVar('TEST_ramses', 'machine', d)
- >>> setVar('TEST_local', 'local', d)
- >>> setVar('OVERRIDES', 'arm', d)
-
- >>> setVar('TEST', 'original', d)
- >>> update_data(d)
- >>> print getVar('TEST', d)
- target
-
- >>> setVar('OVERRIDES', 'arm:ramses:local', d)
- >>> setVar('TEST', 'original', d)
- >>> update_data(d)
- >>> print getVar('TEST', d)
- local
-
- CopyMonster:
- >>> e = d.createCopy()
- >>> setVar('TEST_foo', 'foo', e)
- >>> update_data(e)
- >>> print getVar('TEST', e)
- local
-
- >>> setVar('OVERRIDES', 'arm:ramses:local:foo', e)
- >>> update_data(e)
- >>> print getVar('TEST', e)
- foo
-
- >>> f = d.createCopy()
- >>> setVar('TEST_moo', 'something', f)
- >>> setVar('OVERRIDES', 'moo:arm:ramses:local:foo', e)
- >>> update_data(e)
- >>> print getVar('TEST', e)
- foo
-
-
- >>> h = init()
- >>> setVar('SRC_URI', 'file://append.foo;patch=1 ', h)
- >>> g = h.createCopy()
- >>> setVar('SRC_URI_append_arm', 'file://other.foo;patch=1', g)
- >>> setVar('OVERRIDES', 'arm:moo', g)
- >>> update_data(g)
- >>> print getVar('SRC_URI', g)
- file://append.foo;patch=1 file://other.foo;patch=1
-
- """
- bb.msg.debug(2, bb.msg.domain.Data, "update_data()")
-
- # now ask the cookie monster for help
- #print "Cookie Monster"
- #print "Append/Prepend %s" % d._special_values
- #print "Overrides %s" % d._seen_overrides
-
- overrides = (getVar('OVERRIDES', d, 1) or "").split(':') or []
-
- #
- # Well let us see what breaks here. We used to iterate
- # over each variable and apply the override and then
- # do the line expanding.
- # If we have bad luck - which we will have - the keys
- # where in some order that is so important for this
- # method which we don't have anymore.
- # Anyway we will fix that and write test cases this
- # time.
-
- #
- # First we apply all overrides
- # Then we will handle _append and _prepend
- #
-
- for o in overrides:
- # calculate '_'+override
- l = len(o)+1
-
- # see if one should even try
- if not d._seen_overrides.has_key(o):
- continue
-
- vars = d._seen_overrides[o]
- for var in vars:
- name = var[:-l]
- try:
- d[name] = d[var]
- except:
- bb.msg.note(1, bb.msg.domain.Data, "Untracked delVar")
-
- # now on to the appends and prepends
- if d._special_values.has_key('_append'):
- appends = d._special_values['_append'] or []
- for append in appends:
- for (a, o) in getVarFlag(append, '_append', d) or []:
- # maybe the OVERRIDE was not yet added so keep the append
- if (o and o in overrides) or not o:
- delVarFlag(append, '_append', d)
- if o and not o in overrides:
- continue
-
- sval = getVar(append,d) or ""
- sval+=a
- setVar(append, sval, d)
-
-
- if d._special_values.has_key('_prepend'):
- prepends = d._special_values['_prepend'] or []
-
- for prepend in prepends:
- for (a, o) in getVarFlag(prepend, '_prepend', d) or []:
- # maybe the OVERRIDE was not yet added so keep the prepend
- if (o and o in overrides) or not o:
- delVarFlag(prepend, '_prepend', d)
- if o and not o in overrides:
- continue
-
- sval = a + (getVar(prepend,d) or "")
- setVar(prepend, sval, d)
-
+ """Performs final steps upon the datastore, including application of overrides"""
+ d.finalize()
def inherits_class(klass, d):
val = getVar('__inherit_cache', d) or []