summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-02 23:49:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-04 23:47:49 +0000
commit4628fe12e7f2767d243949197c8326e3b7396301 (patch)
treef65671f46417a7fc5710edec657e22917c2b5f30 /bitbake/lib
parentb98866d003eb1287909ea74d594cdd12f28466f2 (diff)
downloadpoky-4628fe12e7f2767d243949197c8326e3b7396301.tar.gz
bitbake: lib/bb: Add expansion parameter to getVarFlag
This sets the scene for removing the default False for expansion from getVarFlag. This would later allow True to become the expand default. On the most part this is an automatic translation with: sed -e 's:\(\.getVarFlag([^,()]*, [^,()]*\)):\1, False):g' -i `grep -ril getVar *` There should be no functional change from this patch. (Bitbake rev: 7c3b99c6a716095af3ffce0b15110e91fb49c913) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/build.py14
-rw-r--r--bitbake/lib/bb/data.py24
-rw-r--r--bitbake/lib/bb/data_smart.py8
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py6
-rw-r--r--bitbake/lib/bb/parse/ast.py14
-rw-r--r--bitbake/lib/bb/tests/data.py8
-rw-r--r--bitbake/lib/bb/utils.py2
7 files changed, 38 insertions, 38 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 4a48a61fab..f16675bded 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -318,7 +318,7 @@ exit $ret
318 os.chmod(runfile, 0775) 318 os.chmod(runfile, 0775)
319 319
320 cmd = runfile 320 cmd = runfile
321 if d.getVarFlag(func, 'fakeroot'): 321 if d.getVarFlag(func, 'fakeroot', False):
322 fakerootcmd = d.getVar('FAKEROOT', True) 322 fakerootcmd = d.getVar('FAKEROOT', True)
323 if fakerootcmd: 323 if fakerootcmd:
324 cmd = [fakerootcmd, runfile] 324 cmd = [fakerootcmd, runfile]
@@ -393,7 +393,7 @@ def _exec_task(fn, task, d, quieterr):
393 Execution of a task involves a bit more setup than executing a function, 393 Execution of a task involves a bit more setup than executing a function,
394 running it with its own local metadata, and with some useful variables set. 394 running it with its own local metadata, and with some useful variables set.
395 """ 395 """
396 if not d.getVarFlag(task, 'task'): 396 if not d.getVarFlag(task, 'task', False):
397 event.fire(TaskInvalid(task, d), d) 397 event.fire(TaskInvalid(task, d), d)
398 logger.error("No such task: %s" % task) 398 logger.error("No such task: %s" % task)
399 return 1 399 return 1
@@ -532,7 +532,7 @@ def _exec_task(fn, task, d, quieterr):
532 bb.utils.remove(loglink) 532 bb.utils.remove(loglink)
533 event.fire(TaskSucceeded(task, logfn, localdata), localdata) 533 event.fire(TaskSucceeded(task, logfn, localdata), localdata)
534 534
535 if not localdata.getVarFlag(task, 'nostamp') and not localdata.getVarFlag(task, 'selfstamp'): 535 if not localdata.getVarFlag(task, 'nostamp', False) and not localdata.getVarFlag(task, 'selfstamp', False):
536 make_stamp(task, localdata) 536 make_stamp(task, localdata)
537 537
538 return 0 538 return 0
@@ -540,7 +540,7 @@ def _exec_task(fn, task, d, quieterr):
540def exec_task(fn, task, d, profile = False): 540def exec_task(fn, task, d, profile = False):
541 try: 541 try:
542 quieterr = False 542 quieterr = False
543 if d.getVarFlag(task, "quieterrors") is not None: 543 if d.getVarFlag(task, "quieterrors", False) is not None:
544 quieterr = True 544 quieterr = True
545 545
546 if profile: 546 if profile:
@@ -745,7 +745,7 @@ def addtask(task, before, after, d):
745 bbtasks.append(task) 745 bbtasks.append(task)
746 d.setVar('__BBTASKS', bbtasks) 746 d.setVar('__BBTASKS', bbtasks)
747 747
748 existing = d.getVarFlag(task, "deps") or [] 748 existing = d.getVarFlag(task, "deps", False) or []
749 if after is not None: 749 if after is not None:
750 # set up deps for function 750 # set up deps for function
751 for entry in after.split(): 751 for entry in after.split():
@@ -755,7 +755,7 @@ def addtask(task, before, after, d):
755 if before is not None: 755 if before is not None:
756 # set up things that depend on this func 756 # set up things that depend on this func
757 for entry in before.split(): 757 for entry in before.split():
758 existing = d.getVarFlag(entry, "deps") or [] 758 existing = d.getVarFlag(entry, "deps", False) or []
759 if task not in existing: 759 if task not in existing:
760 d.setVarFlag(entry, "deps", [task] + existing) 760 d.setVarFlag(entry, "deps", [task] + existing)
761 761
@@ -770,7 +770,7 @@ def deltask(task, d):
770 770
771 d.delVarFlag(task, 'deps') 771 d.delVarFlag(task, 'deps')
772 for bbtask in d.getVar('__BBTASKS', False) or []: 772 for bbtask in d.getVar('__BBTASKS', False) or []:
773 deps = d.getVarFlag(bbtask, 'deps') or [] 773 deps = d.getVarFlag(bbtask, 'deps', False) or []
774 if task in deps: 774 if task in deps:
775 deps.remove(task) 775 deps.remove(task)
776 d.setVarFlag(bbtask, 'deps', deps) 776 d.setVarFlag(bbtask, 'deps', deps)
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index 70ba56b48a..44f817e6c8 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -107,7 +107,7 @@ def setVarFlag(var, flag, flagvalue, d):
107 107
108def getVarFlag(var, flag, d): 108def getVarFlag(var, flag, d):
109 """Gets given flag from given var""" 109 """Gets given flag from given var"""
110 return d.getVarFlag(var, flag) 110 return d.getVarFlag(var, flag, False)
111 111
112def delVarFlag(var, flag, d): 112def delVarFlag(var, flag, d):
113 """Removes a given flag from the variable's flags""" 113 """Removes a given flag from the variable's flags"""
@@ -182,12 +182,12 @@ def inheritFromOS(d, savedenv, permitted):
182 182
183def emit_var(var, o=sys.__stdout__, d = init(), all=False): 183def emit_var(var, o=sys.__stdout__, d = init(), all=False):
184 """Emit a variable to be sourced by a shell.""" 184 """Emit a variable to be sourced by a shell."""
185 if d.getVarFlag(var, "python"): 185 if d.getVarFlag(var, "python", False):
186 return False 186 return False
187 187
188 export = d.getVarFlag(var, "export") 188 export = d.getVarFlag(var, "export", False)
189 unexport = d.getVarFlag(var, "unexport") 189 unexport = d.getVarFlag(var, "unexport", False)
190 func = d.getVarFlag(var, "func") 190 func = d.getVarFlag(var, "func", False)
191 if not all and not export and not unexport and not func: 191 if not all and not export and not unexport and not func:
192 return False 192 return False
193 193
@@ -245,7 +245,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False):
245def emit_env(o=sys.__stdout__, d = init(), all=False): 245def emit_env(o=sys.__stdout__, d = init(), all=False):
246 """Emits all items in the data store in a format such that it can be sourced by a shell.""" 246 """Emits all items in the data store in a format such that it can be sourced by a shell."""
247 247
248 isfunc = lambda key: bool(d.getVarFlag(key, "func")) 248 isfunc = lambda key: bool(d.getVarFlag(key, "func", False))
249 keys = sorted((key for key in d.keys() if not key.startswith("__")), key=isfunc) 249 keys = sorted((key for key in d.keys() if not key.startswith("__")), key=isfunc)
250 grouped = groupby(keys, isfunc) 250 grouped = groupby(keys, isfunc)
251 for isfunc, keys in grouped: 251 for isfunc, keys in grouped:
@@ -254,8 +254,8 @@ def emit_env(o=sys.__stdout__, d = init(), all=False):
254 254
255def exported_keys(d): 255def exported_keys(d):
256 return (key for key in d.keys() if not key.startswith('__') and 256 return (key for key in d.keys() if not key.startswith('__') and
257 d.getVarFlag(key, 'export') and 257 d.getVarFlag(key, 'export', False) and
258 not d.getVarFlag(key, 'unexport')) 258 not d.getVarFlag(key, 'unexport', False))
259 259
260def exported_vars(d): 260def exported_vars(d):
261 for key in exported_keys(d): 261 for key in exported_keys(d):
@@ -270,7 +270,7 @@ def exported_vars(d):
270def emit_func(func, o=sys.__stdout__, d = init()): 270def emit_func(func, o=sys.__stdout__, d = init()):
271 """Emits all items in the data store in a format such that it can be sourced by a shell.""" 271 """Emits all items in the data store in a format such that it can be sourced by a shell."""
272 272
273 keys = (key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func")) 273 keys = (key for key in d.keys() if not key.startswith("__") and not d.getVarFlag(key, "func", False))
274 for key in keys: 274 for key in keys:
275 emit_var(key, o, d, False) 275 emit_var(key, o, d, False)
276 276
@@ -284,7 +284,7 @@ def emit_func(func, o=sys.__stdout__, d = init()):
284 seen |= deps 284 seen |= deps
285 newdeps = set() 285 newdeps = set()
286 for dep in deps: 286 for dep in deps:
287 if d.getVarFlag(dep, "func") and not d.getVarFlag(dep, "python"): 287 if d.getVarFlag(dep, "func", False) and not d.getVarFlag(dep, "python", False):
288 emit_var(dep, o, d, False) and o.write('\n') 288 emit_var(dep, o, d, False) and o.write('\n')
289 newdeps |= bb.codeparser.ShellParser(dep, logger).parse_shell(d.getVar(dep, True)) 289 newdeps |= bb.codeparser.ShellParser(dep, logger).parse_shell(d.getVar(dep, True))
290 newdeps |= set((d.getVarFlag(dep, "vardeps", True) or "").split()) 290 newdeps |= set((d.getVarFlag(dep, "vardeps", True) or "").split())
@@ -317,7 +317,7 @@ def emit_func_python(func, o=sys.__stdout__, d = init()):
317 seen |= deps 317 seen |= deps
318 newdeps = set() 318 newdeps = set()
319 for dep in deps: 319 for dep in deps:
320 if d.getVarFlag(dep, "func") and d.getVarFlag(dep, "python"): 320 if d.getVarFlag(dep, "func", False) and d.getVarFlag(dep, "python", False):
321 write_func(dep, o) 321 write_func(dep, o)
322 pp = bb.codeparser.PythonParser(dep, logger) 322 pp = bb.codeparser.PythonParser(dep, logger)
323 pp.parse_python(d.getVar(dep, True)) 323 pp.parse_python(d.getVar(dep, True))
@@ -416,7 +416,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
416def generate_dependencies(d): 416def generate_dependencies(d):
417 417
418 keys = set(key for key in d if not key.startswith("__")) 418 keys = set(key for key in d if not key.startswith("__"))
419 shelldeps = set(key for key in d.getVar("__exportlist", False) if d.getVarFlag(key, "export") and not d.getVarFlag(key, "unexport")) 419 shelldeps = set(key for key in d.getVar("__exportlist", False) if d.getVarFlag(key, "export", False) and not d.getVarFlag(key, "unexport", False))
420 varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS', True) 420 varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS', True)
421 421
422 deps = {} 422 deps = {}
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index a6611c4e94..70d314d35b 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -147,7 +147,7 @@ class DataContext(dict):
147 147
148 def __missing__(self, key): 148 def __missing__(self, key):
149 value = self.metadata.getVar(key, True) 149 value = self.metadata.getVar(key, True)
150 if value is None or self.metadata.getVarFlag(key, 'func'): 150 if value is None or self.metadata.getVarFlag(key, 'func', False):
151 raise KeyError(key) 151 raise KeyError(key)
152 else: 152 else:
153 return value 153 return value
@@ -480,7 +480,7 @@ class DataSmart(MutableMapping):
480 base = match.group('base') 480 base = match.group('base')
481 keyword = match.group("keyword") 481 keyword = match.group("keyword")
482 override = match.group('add') 482 override = match.group('add')
483 l = self.getVarFlag(base, keyword) or [] 483 l = self.getVarFlag(base, keyword, False) or []
484 l.append([value, override]) 484 l.append([value, override])
485 self.setVarFlag(base, keyword, l, ignore=True) 485 self.setVarFlag(base, keyword, l, ignore=True)
486 # And cause that to be recorded: 486 # And cause that to be recorded:
@@ -582,11 +582,11 @@ class DataSmart(MutableMapping):
582 self.setVar(newkey, val, ignore=True, parsing=True) 582 self.setVar(newkey, val, ignore=True, parsing=True)
583 583
584 for i in (__setvar_keyword__): 584 for i in (__setvar_keyword__):
585 src = self.getVarFlag(key, i) 585 src = self.getVarFlag(key, i, False)
586 if src is None: 586 if src is None:
587 continue 587 continue
588 588
589 dest = self.getVarFlag(newkey, i) or [] 589 dest = self.getVarFlag(newkey, i, False) or []
590 dest.extend(src) 590 dest.extend(src)
591 self.setVarFlag(newkey, i, dest, ignore=True) 591 self.setVarFlag(newkey, i, dest, ignore=True)
592 592
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index dd1a1978d1..c3dcfd2ccb 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1002,7 +1002,7 @@ def trusted_network(d, url):
1002 return True 1002 return True
1003 1003
1004 pkgname = d.expand(d.getVar('PN', False)) 1004 pkgname = d.expand(d.getVar('PN', False))
1005 trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname) 1005 trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname, False)
1006 1006
1007 if not trusted_hosts: 1007 if not trusted_hosts:
1008 trusted_hosts = d.getVar('BB_ALLOWED_NETWORKS', True) 1008 trusted_hosts = d.getVar('BB_ALLOWED_NETWORKS', True)
@@ -1185,13 +1185,13 @@ class FetchData(object):
1185 elif self.type not in ["http", "https", "ftp", "ftps", "sftp"]: 1185 elif self.type not in ["http", "https", "ftp", "ftps", "sftp"]:
1186 self.md5_expected = None 1186 self.md5_expected = None
1187 else: 1187 else:
1188 self.md5_expected = d.getVarFlag("SRC_URI", self.md5_name) 1188 self.md5_expected = d.getVarFlag("SRC_URI", self.md5_name, False)
1189 if self.sha256_name in self.parm: 1189 if self.sha256_name in self.parm:
1190 self.sha256_expected = self.parm[self.sha256_name] 1190 self.sha256_expected = self.parm[self.sha256_name]
1191 elif self.type not in ["http", "https", "ftp", "ftps", "sftp"]: 1191 elif self.type not in ["http", "https", "ftp", "ftps", "sftp"]:
1192 self.sha256_expected = None 1192 self.sha256_expected = None
1193 else: 1193 else:
1194 self.sha256_expected = d.getVarFlag("SRC_URI", self.sha256_name) 1194 self.sha256_expected = d.getVarFlag("SRC_URI", self.sha256_name, False)
1195 self.ignore_checksums = False 1195 self.ignore_checksums = False
1196 1196
1197 self.names = self.parm.get("name",'default').split(',') 1197 self.names = self.parm.get("name",'default').split(',')
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index cff0d2b453..933a06e9bf 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -83,7 +83,7 @@ class DataNode(AstNode):
83 83
84 def getFunc(self, key, data): 84 def getFunc(self, key, data):
85 if 'flag' in self.groupd and self.groupd['flag'] != None: 85 if 'flag' in self.groupd and self.groupd['flag'] != None:
86 return data.getVarFlag(key, self.groupd['flag'], noweakdefault=True) 86 return data.getVarFlag(key, self.groupd['flag'], expand=False, noweakdefault=True)
87 else: 87 else:
88 return data.getVar(key, False, noweakdefault=True, parsing=True) 88 return data.getVar(key, False, noweakdefault=True, parsing=True)
89 89
@@ -213,7 +213,7 @@ class ExportFuncsNode(AstNode):
213 for func in self.n: 213 for func in self.n:
214 calledfunc = self.classname + "_" + func 214 calledfunc = self.classname + "_" + func
215 215
216 if data.getVar(func, False) and not data.getVarFlag(func, 'export_func'): 216 if data.getVar(func, False) and not data.getVarFlag(func, 'export_func', False):
217 continue 217 continue
218 218
219 if data.getVar(func, False): 219 if data.getVar(func, False):
@@ -221,15 +221,15 @@ class ExportFuncsNode(AstNode):
221 data.setVarFlag(func, 'func', None) 221 data.setVarFlag(func, 'func', None)
222 222
223 for flag in [ "func", "python" ]: 223 for flag in [ "func", "python" ]:
224 if data.getVarFlag(calledfunc, flag): 224 if data.getVarFlag(calledfunc, flag, False):
225 data.setVarFlag(func, flag, data.getVarFlag(calledfunc, flag)) 225 data.setVarFlag(func, flag, data.getVarFlag(calledfunc, flag, False))
226 for flag in [ "dirs" ]: 226 for flag in [ "dirs" ]:
227 if data.getVarFlag(func, flag): 227 if data.getVarFlag(func, flag, False):
228 data.setVarFlag(calledfunc, flag, data.getVarFlag(func, flag)) 228 data.setVarFlag(calledfunc, flag, data.getVarFlag(func, flag, False))
229 data.setVarFlag(func, "filename", "autogenerated") 229 data.setVarFlag(func, "filename", "autogenerated")
230 data.setVarFlag(func, "lineno", 1) 230 data.setVarFlag(func, "lineno", 1)
231 231
232 if data.getVarFlag(calledfunc, "python"): 232 if data.getVarFlag(calledfunc, "python", False):
233 data.setVar(func, " bb.build.exec_func('" + calledfunc + "', d)\n", parsing=True) 233 data.setVar(func, " bb.build.exec_func('" + calledfunc + "', d)\n", parsing=True)
234 else: 234 else:
235 if "-" in self.classname: 235 if "-" in self.classname:
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py
index a96078fa9c..12232305c3 100644
--- a/bitbake/lib/bb/tests/data.py
+++ b/bitbake/lib/bb/tests/data.py
@@ -399,13 +399,13 @@ class TestFlags(unittest.TestCase):
399 self.d.setVarFlag("foo", "flag2", "value of flag2") 399 self.d.setVarFlag("foo", "flag2", "value of flag2")
400 400
401 def test_setflag(self): 401 def test_setflag(self):
402 self.assertEqual(self.d.getVarFlag("foo", "flag1"), "value of flag1") 402 self.assertEqual(self.d.getVarFlag("foo", "flag1", False), "value of flag1")
403 self.assertEqual(self.d.getVarFlag("foo", "flag2"), "value of flag2") 403 self.assertEqual(self.d.getVarFlag("foo", "flag2", False), "value of flag2")
404 404
405 def test_delflag(self): 405 def test_delflag(self):
406 self.d.delVarFlag("foo", "flag2") 406 self.d.delVarFlag("foo", "flag2")
407 self.assertEqual(self.d.getVarFlag("foo", "flag1"), "value of flag1") 407 self.assertEqual(self.d.getVarFlag("foo", "flag1", False), "value of flag1")
408 self.assertEqual(self.d.getVarFlag("foo", "flag2"), None) 408 self.assertEqual(self.d.getVarFlag("foo", "flag2", False), None)
409 409
410 410
411class Contains(unittest.TestCase): 411class Contains(unittest.TestCase):
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index ae10213ed7..9730b514e4 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -631,7 +631,7 @@ def build_environment(d):
631 """ 631 """
632 import bb.data 632 import bb.data
633 for var in bb.data.keys(d): 633 for var in bb.data.keys(d):
634 export = d.getVarFlag(var, "export") 634 export = d.getVarFlag(var, "export", False)
635 if export: 635 if export:
636 os.environ[var] = d.getVar(var, True) or "" 636 os.environ[var] = d.getVar(var, True) or ""
637 637