summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2015-04-17 16:19:01 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-19 13:34:05 +0100
commit9d86eb2e448263f7e395b48d95c380b2dc66ad8e (patch)
tree66d341a178d3285fbddf732daa36eb7c489132f8 /scripts
parent7d2b918019b0afe215a6489dad697afac34f73e9 (diff)
downloadopenembedded-core-9d86eb2e448263f7e395b48d95c380b2dc66ad8e.tar.gz
openembedded-core-9d86eb2e448263f7e395b48d95c380b2dc66ad8e.tar.bz2
openembedded-core-9d86eb2e448263f7e395b48d95c380b2dc66ad8e.zip
wic: try to find bitbake using find_executable API
Current wic code was assuming that bitbake directory is on the same level as scripts, which is not the case for oe classic. Using find_executable bitbake location should be determined better as this API uss $PATH to search for executables. Fixes [YOCTO #7621] Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/wic20
1 files changed, 15 insertions, 5 deletions
diff --git a/scripts/wic b/scripts/wic
index 5bedd90f87..7d388c9768 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -36,19 +36,25 @@ import os
import sys
import optparse
import logging
+from distutils import spawn
# External modules
scripts_path = os.path.abspath(os.path.dirname(__file__))
lib_path = scripts_path + '/lib'
-bitbake_path = os.path.join(scripts_path, '../bitbake/lib')
-sys.path = sys.path + [lib_path, bitbake_path]
+sys.path.append(lib_path)
+
+bitbake_exe = spawn.find_executable('bitbake')
+if bitbake_exe:
+ bitbake_path = os.path.join(os.path.dirname(bitbake_exe), '../lib')
+ sys.path.append(bitbake_path)
+ from bb import cookerdata
+ from bb.main import bitbake_main, BitBakeConfigParameters
+else:
+ bitbake_main = None
from image.help import *
from image.engine import *
-from bb import cookerdata
-from bb.main import bitbake_main, BitBakeConfigParameters
-
def rootfs_dir_to_args(krootfs_dir):
"""
Get a rootfs_dir dict and serialize to string
@@ -109,6 +115,10 @@ def wic_create_subcommand(args, usage_str):
parser.print_help()
sys.exit(1)
+ if options.build_rootfs and not bitbake_main:
+ logging.error("Can't build roofs as bitbake is not in the $PATH")
+ sys.exit(1)
+
if not options.image_name and not (options.rootfs_dir and
options.bootimg_dir and
options.kernel_dir and