[bitbake-devel] [PATCH v2 1/1] tinfoil.py: Check if BUILDDIR or .devtoolbase exists
Amanda Brindle
amanda.r.brindle at intel.com
Wed Feb 7 18:27:20 UTC 2018
Check if either BUILDDIR or .devtoolbase exists in order to deterimine
if a tinfoil using script is running without having called oe-init-build-env
(or similar). If not, raise an exception that a tinfoil using application
can catch to produce an error message. Before, tinfoil would hang for 30s
before erroring out.
Fixes [YOCTO #12096]
Signed-off-by: Amanda Brindle <amanda.r.brindle at intel.com>
---
bitbake/lib/bb/tinfoil.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py
index 368264f..013e7f6 100644
--- a/bitbake/lib/bb/tinfoil.py
+++ b/bitbake/lib/bb/tinfoil.py
@@ -54,6 +54,9 @@ class TinfoilUIException(Exception):
class TinfoilCommandFailed(Exception):
"""Exception raised when run_command fails"""
+class TinfoilBuildEnvironmentException(Exception):
+ """Exception raised when build environment is not initialised"""
+
class TinfoilDataStoreConnector:
"""Connector object used to enable access to datastore objects via tinfoil"""
@@ -372,6 +375,20 @@ class Tinfoil:
"""
self.quiet = quiet
+ fixed_setup = False
+ basepath = os.path.dirname(os.path.abspath(__file__))
+ pth = basepath
+ while pth != '' and pth != os.sep:
+ if os.path.exists(os.path.join(pth, '.devtoolbase')):
+ fixed_setup = True
+ basepath = pth
+ break
+ pth = os.path.dirname(pth)
+ if not fixed_setup:
+ basepath = os.environ.get('BUILDDIR')
+ if not basepath:
+ raise TinfoilBuildEnvironmentException('Build environment not initialised')
+
if self.tracking:
extrafeatures = [bb.cooker.CookerFeatures.BASEDATASTORE_TRACKING]
else:
--
2.7.4
More information about the bitbake-devel
mailing list