summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2007-07-31 13:09:51 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2007-07-31 13:09:51 +0000
commit368b022088bdfd48d3347f83b5929a4c1915eaa3 (patch)
tree9b269ca45e35dd04008d5964550e3dd05650c4a0
parentb507e59e0d38c454bf7a76d4bd7b3ffc7b907eeb (diff)
downloadbitbake-368b022088bdfd48d3347f83b5929a4c1915eaa3.tar.gz
data.emit_var() - only call getVar if we need the variable
-rw-r--r--ChangeLog1
-rw-r--r--lib/bb/data.py40
2 files changed, 24 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 2acac5877..fd998496e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ Changes in Bitbake 1.8.x:
- Import persistent data store from trunk
- Sync fetcher code with that in trunk, adding SRCREV support for svn
- Add ConfigParsed Event after configuration parsing is complete
+ - data.emit_var() - only call getVar if we need the variable
Changes in Bitbake 1.8.6:
- Correctly redirect stdin when forking
diff --git a/lib/bb/data.py b/lib/bb/data.py
index 14f1d896d..9782c9f54 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -337,6 +337,12 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
if getVarFlag(var, "python", d):
return 0
+ export = getVarFlag(var, "export", d)
+ unexport = getVarFlag(var, "unexport", d)
+ func = getVarFlag(var, "func", d)
+ if not all and not export and not unexport and not func:
+ return 0
+
try:
if all:
oval = getVar(var, d, 0)
@@ -362,28 +368,28 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
if (var.find("-") != -1 or var.find(".") != -1 or var.find('{') != -1 or var.find('}') != -1 or var.find('+') != -1) and not all:
return 0
+ varExpanded = expand(var, d)
+
+ if unexport:
+ o.write('unset %s\n' % varExpanded)
+ return 1
+
val.rstrip()
if not val:
return 0
-
- varExpanded = expand(var, d)
- if getVarFlag(var, "func", d):
-# NOTE: should probably check for unbalanced {} within the var
+ if func:
+ # NOTE: should probably check for unbalanced {} within the var
o.write("%s() {\n%s\n}\n" % (varExpanded, val))
- else:
- if getVarFlag(var, "unexport", d):
- o.write('unset %s\n' % varExpanded)
- return 1
- if getVarFlag(var, "export", d):
- o.write('export ')
- else:
- if not all:
- return 0
-# if we're going to output this within doublequotes,
-# to a shell, we need to escape the quotes in the var
- alter = re.sub('"', '\\"', val.strip())
- o.write('%s="%s"\n' % (varExpanded, alter))
+ return 1
+
+ if export:
+ o.write('export ')
+
+ # if we're going to output this within doublequotes,
+ # to a shell, we need to escape the quotes in the var
+ alter = re.sub('"', '\\"', val.strip())
+ o.write('%s="%s"\n' % (varExpanded, alter))
return 1