[bitbake-devel,1/1] tinfoil.py: Check if BUILDDIR exists

Submitted by Amanda Brindle on Jan. 19, 2018, 8:53 p.m. | Patch ID: 147482

Details

Message ID 57f40b8b016e6f9e4539d919d323dd6b6d75c31a.1516394932.git.amanda.r.brindle@intel.com
State New
Headers show

Commit Message

Amanda Brindle Jan. 19, 2018, 8:53 p.m.
Check if BUILDDIR exists in order to deterimine if a tinfoil using
script is running without having called oe-init-build-env (or similar).
If not, instruct user to initialise the build environment, and then
error out immediately. Before, tinfoil would hang for 30s before
erroring out.

Fixes [YOCTO #12096]

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
---
 bitbake/lib/bb/tinfoil.py | 5 +++++
 1 file changed, 5 insertions(+)

Patch hide | download patch | download mbox

diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py
index 368264f..e156b47 100644
--- a/bitbake/lib/bb/tinfoil.py
+++ b/bitbake/lib/bb/tinfoil.py
@@ -372,6 +372,11 @@  class Tinfoil:
         """
         self.quiet = quiet
 
+        basepath = os.environ.get('BUILDDIR')
+        if not basepath:
+            print("Tinfoil can only be run after initialising the build environment (e.g. by using oe-init-build-env)")
+            sys.exit(1)
+
         if self.tracking:
             extrafeatures = [bb.cooker.CookerFeatures.BASEDATASTORE_TRACKING]
         else: