]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/wic: append bitbake executable file path in eSDK environment
authorChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Thu, 11 Jan 2018 14:55:20 +0000 (22:55 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 12 Jan 2018 08:43:54 +0000 (08:43 +0000)
wic needs a set of tools to be available from sysroots.
wic will find bitbake executable within the environment,
and wic was unable to locate bitbake executable within eSDK
because it wasn't setup with the OE build environment script.
Hence, we need to add bitbake file path into the environment
PATH for wic to be able to discover it and import bb modules.

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/wic

index 0d988757150e72e0d84fce59bc90ffda0bbf1865..293a216d71d425fc12eb60b383cb031410ec5334 100755 (executable)
@@ -46,6 +46,18 @@ sys.path.insert(0, lib_path)
 import scriptpath
 scriptpath.add_oe_lib_path()
 
+# Check whether wic is running within eSDK environment
+sdkroot = scripts_path
+if os.environ.get('SDKTARGETSYSROOT'):
+    while sdkroot != '' and sdkroot != os.sep:
+        if os.path.exists(os.path.join(sdkroot, '.devtoolbase')):
+            # .devtoolbase only exists within eSDK
+            # If found, initialize bitbake path for eSDK environment and append to PATH
+            sdkroot = os.path.join(os.path.dirname(scripts_path), 'bitbake', 'bin')
+            os.environ['PATH'] += ":" + sdkroot
+            break
+        sdkroot = os.path.dirname(sdkroot)
+
 bitbake_exe = spawn.find_executable('bitbake')
 if bitbake_exe:
     bitbake_path = scriptpath.add_bitbake_lib_path()