diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-13 16:17:21 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-15 11:03:25 +0000 |
commit | 119c592530e82ab2a9bdddb532640c345b58cf8b (patch) | |
tree | b05cbd04327b313a16f22c8d9beafe4648b2347d /bitbake/lib | |
parent | 9e4b20119e2548d70fdc732176d7dd9d8c38bf49 (diff) | |
download | poky-119c592530e82ab2a9bdddb532640c345b58cf8b.tar.gz |
bitbake: cookerdata: Set TOPDIR explicitly and fix broken findTopdir()
TOPDIR is set internally deep within the parser to os.getcwd(). Rather
than do that, set it explicitly if not set. Note that modern code will
almost always have a bblayers.conf file which would have already set
TOPDIR before this new code.
Also fix findTopdir since the conf/bitbake.conf codepath is just
plain incorrect, it would find build metadata, not the current
build directory that bitbake would use. Again, the use of bblayers.conf
means hitting the fallback code was unlikely.
This change makes everything clear and explicit.
(Bitbake rev: c03df5283408dfd089b6317677d2b7af6fa73936)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/cookerdata.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index 592bc2968e..397b43dfa7 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py | |||
@@ -210,7 +210,7 @@ def findConfigFile(configfile, data): | |||
210 | 210 | ||
211 | # | 211 | # |
212 | # We search for a conf/bblayers.conf under an entry in BBPATH or in cwd working | 212 | # We search for a conf/bblayers.conf under an entry in BBPATH or in cwd working |
213 | # up to /. If that fails, we search for a conf/bitbake.conf in BBPATH. | 213 | # up to /. If that fails, bitbake would fall back to cwd. |
214 | # | 214 | # |
215 | 215 | ||
216 | def findTopdir(): | 216 | def findTopdir(): |
@@ -223,11 +223,8 @@ def findTopdir(): | |||
223 | layerconf = findConfigFile("bblayers.conf", d) | 223 | layerconf = findConfigFile("bblayers.conf", d) |
224 | if layerconf: | 224 | if layerconf: |
225 | return os.path.dirname(os.path.dirname(layerconf)) | 225 | return os.path.dirname(os.path.dirname(layerconf)) |
226 | if bbpath: | 226 | |
227 | bitbakeconf = bb.utils.which(bbpath, "conf/bitbake.conf") | 227 | return os.path.abspath(os.getcwd()) |
228 | if bitbakeconf: | ||
229 | return os.path.dirname(os.path.dirname(bitbakeconf)) | ||
230 | return None | ||
231 | 228 | ||
232 | class CookerDataBuilder(object): | 229 | class CookerDataBuilder(object): |
233 | 230 | ||
@@ -417,6 +414,9 @@ class CookerDataBuilder(object): | |||
417 | " invoked bitbake from the wrong directory?") | 414 | " invoked bitbake from the wrong directory?") |
418 | raise SystemExit(msg) | 415 | raise SystemExit(msg) |
419 | 416 | ||
417 | if not data.getVar("TOPDIR"): | ||
418 | data.setVar("TOPDIR", os.path.abspath(os.getcwd())) | ||
419 | |||
420 | data = parse_config_file(os.path.join("conf", "bitbake.conf"), data) | 420 | data = parse_config_file(os.path.join("conf", "bitbake.conf"), data) |
421 | 421 | ||
422 | # Parse files for loading *after* bitbake.conf and any includes | 422 | # Parse files for loading *after* bitbake.conf and any includes |