aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-18 22:18:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-18 22:39:35 +0100
commitd196afe68032898c31a8599ca7d3ceba58d96b0a (patch)
tree27f1a59962a60855d8b493346290e0798d611f7d
parenta1c6151420d86bac658c08ae714647062edd6ef2 (diff)
downloadbitbake-contrib-d196afe68032898c31a8599ca7d3ceba58d96b0a.tar.gz
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/cookerdata.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index c2aeee63f..6511dcbfa 100644
--- a/lib/bb/cookerdata.py
+++ b/lib/bb/cookerdata.py
@@ -230,6 +230,27 @@ def findConfigFile(configfile, data):
return None
+#
+# We search for a conf/bblayers.conf under an entry in BBPATH or in cwd working
+# up to /. If that fails, we search for a conf/bitbake.conf in BBPATH.
+#
+
+def findTopdir():
+ d = bb.data.init()
+ bbpath = None
+ if 'BBPATH' in os.environ:
+ bbpath = os.environ['BBPATH']
+ d.setVar('BBPATH', bbpath)
+
+ layerconf = findConfigFile("bblayers.conf", d)
+ if layerconf:
+ return os.path.dirname(os.path.dirname(layerconf))
+ if bbpath:
+ bitbakeconf = bb.utils.which(bbpath, "conf/bitbake.conf")
+ if bitbakeconf:
+ return os.path.dirname(os.path.dirname(bitbakeconf))
+ return None
+
class CookerDataBuilder(object):
def __init__(self, cookercfg, worker = False):