diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-04-02 21:39:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-04-06 16:45:34 +0100 |
commit | 9435b6cf10efb11c4ad206e06665321b058d943e (patch) | |
tree | d2edc3bd86115f4fff2f3e058d508ccbe632d965 | |
parent | f15a1f2b7f53b574b5fe0294fc16e88546f97875 (diff) | |
download | poky-9435b6cf10efb11c4ad206e06665321b058d943e.tar.gz |
bitbake: data/siggen: Don't expand ignored variables
If a variable is in the signature whitelist, we'd currently expand
it, then later ignore the data. This is problemtic for code which
has effects when expanded, recently source date epoch in OE-Core
for example.
We don't actually need to do this, if we pass the whitelist into
the earlier function it can avoid the expansion. This also also
give a small performance boost since we avoid running code in some
cases.
[YOCTO #13581]
(Bitbake rev: f483ee4a869fb1dafbe4bdf2da228cdaa40b38bd)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/data.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/siggen.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index 6dc02172cb..b0683c5180 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -365,7 +365,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
365 | #bb.note("Variable %s references %s and calls %s" % (key, str(deps), str(execs))) | 365 | #bb.note("Variable %s references %s and calls %s" % (key, str(deps), str(execs))) |
366 | #d.setVarFlag(key, "vardeps", deps) | 366 | #d.setVarFlag(key, "vardeps", deps) |
367 | 367 | ||
368 | def generate_dependencies(d): | 368 | def generate_dependencies(d, whitelist): |
369 | 369 | ||
370 | keys = set(key for key in d if not key.startswith("__")) | 370 | keys = set(key for key in d if not key.startswith("__")) |
371 | shelldeps = set(key for key in d.getVar("__exportlist", False) if d.getVarFlag(key, "export", False) and not d.getVarFlag(key, "unexport", False)) | 371 | shelldeps = set(key for key in d.getVar("__exportlist", False) if d.getVarFlag(key, "export", False) and not d.getVarFlag(key, "unexport", False)) |
@@ -380,7 +380,7 @@ def generate_dependencies(d): | |||
380 | newdeps = deps[task] | 380 | newdeps = deps[task] |
381 | seen = set() | 381 | seen = set() |
382 | while newdeps: | 382 | while newdeps: |
383 | nextdeps = newdeps | 383 | nextdeps = newdeps - whitelist |
384 | seen |= nextdeps | 384 | seen |= nextdeps |
385 | newdeps = set() | 385 | newdeps = set() |
386 | for dep in nextdeps: | 386 | for dep in nextdeps: |
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index 8bfc45235d..4c8d81c5da 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -146,7 +146,7 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
146 | def _build_data(self, fn, d): | 146 | def _build_data(self, fn, d): |
147 | 147 | ||
148 | ignore_mismatch = ((d.getVar("BB_HASH_IGNORE_MISMATCH") or '') == '1') | 148 | ignore_mismatch = ((d.getVar("BB_HASH_IGNORE_MISMATCH") or '') == '1') |
149 | tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d) | 149 | tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d, self.basewhitelist) |
150 | 150 | ||
151 | taskdeps, basehash = bb.data.generate_dependency_hash(tasklist, gendeps, lookupcache, self.basewhitelist, fn) | 151 | taskdeps, basehash = bb.data.generate_dependency_hash(tasklist, gendeps, lookupcache, self.basewhitelist, fn) |
152 | 152 | ||
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index 2b137706dd..5f195047de 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -476,7 +476,7 @@ class Contains(unittest.TestCase): | |||
476 | class TaskHash(unittest.TestCase): | 476 | class TaskHash(unittest.TestCase): |
477 | def test_taskhashes(self): | 477 | def test_taskhashes(self): |
478 | def gettask_bashhash(taskname, d): | 478 | def gettask_bashhash(taskname, d): |
479 | tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d) | 479 | tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d, set()) |
480 | taskdeps, basehash = bb.data.generate_dependency_hash(tasklist, gendeps, lookupcache, set(), "somefile") | 480 | taskdeps, basehash = bb.data.generate_dependency_hash(tasklist, gendeps, lookupcache, set(), "somefile") |
481 | bb.warn(str(lookupcache)) | 481 | bb.warn(str(lookupcache)) |
482 | return basehash["somefile:" + taskname] | 482 | return basehash["somefile:" + taskname] |