diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-18 22:18:53 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-21 08:41:11 +0100 |
commit | 62bd2e365eedaa030fe71e74a0d96fb5b76ad3de (patch) | |
tree | 262db46c9330fe66f3b44b39fa76e0f743706fe2 /bitbake/lib/bb/cookerdata.py | |
parent | 577b75086eaf4ae2201933f7b9ac32f6239867c6 (diff) | |
download | poky-62bd2e365eedaa030fe71e74a0d96fb5b76ad3de.tar.gz |
bitbake: cookerdata: Add a function to find TOPDIR
Finding the top level build directory is currently hard and relies on
having a complete cooker being setup. Add a helper function which
does the same thing without all the extra overhead. This is needed
to be able to locate the bitbake lockfile and hence the socket
for connecting clients in the new server model.
(Bitbake rev: d196afe68032898c31a8599ca7d3ceba58d96b0a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cookerdata.py')
-rw-r--r-- | bitbake/lib/bb/cookerdata.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index c2aeee63fb..6511dcbfad 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py | |||
@@ -230,6 +230,27 @@ def findConfigFile(configfile, data): | |||
230 | 230 | ||
231 | return None | 231 | return None |
232 | 232 | ||
233 | # | ||
234 | # We search for a conf/bblayers.conf under an entry in BBPATH or in cwd working | ||
235 | # up to /. If that fails, we search for a conf/bitbake.conf in BBPATH. | ||
236 | # | ||
237 | |||
238 | def findTopdir(): | ||
239 | d = bb.data.init() | ||
240 | bbpath = None | ||
241 | if 'BBPATH' in os.environ: | ||
242 | bbpath = os.environ['BBPATH'] | ||
243 | d.setVar('BBPATH', bbpath) | ||
244 | |||
245 | layerconf = findConfigFile("bblayers.conf", d) | ||
246 | if layerconf: | ||
247 | return os.path.dirname(os.path.dirname(layerconf)) | ||
248 | if bbpath: | ||
249 | bitbakeconf = bb.utils.which(bbpath, "conf/bitbake.conf") | ||
250 | if bitbakeconf: | ||
251 | return os.path.dirname(os.path.dirname(bitbakeconf)) | ||
252 | return None | ||
253 | |||
233 | class CookerDataBuilder(object): | 254 | class CookerDataBuilder(object): |
234 | 255 | ||
235 | def __init__(self, cookercfg, worker = False): | 256 | def __init__(self, cookercfg, worker = False): |