[oe-commits] [bitbake] 03/23: cookerdata: Add a function to find TOPDIR

git at git.openembedded.org git at git.openembedded.org
Tue Jul 18 21:32:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit f6b8c33cb6a7ec18cf13d0ecc323019d11efbc63
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Tue Jul 18 22:18:53 2017 +0100

    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 at linuxfoundation.org>
---
 lib/bb/cookerdata.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index 644bb38..aa0a641 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):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list