summaryrefslogtreecommitdiffstats
path: root/scripts/wic
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:43 +0100
commit9a664b91da58871f8ad3fbfac07f7292d357ce54 (patch)
tree022bf159a74148f836b25f7c3507c12a9a1241e0 /scripts/wic
parentd7a9b5ea5553dff3330523f85d358dd6b8503c1c (diff)
downloadpoky-9a664b91da58871f8ad3fbfac07f7292d357ce54.tar.gz
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] (From OE-Core rev: 9d86eb2e448263f7e395b48d95c380b2dc66ad8e) 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/wic')
-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
36import sys 36import sys
37import optparse 37import optparse
38import logging 38import logging
39from distutils import spawn
39 40
40# External modules 41# External modules
41scripts_path = os.path.abspath(os.path.dirname(__file__)) 42scripts_path = os.path.abspath(os.path.dirname(__file__))
42lib_path = scripts_path + '/lib' 43lib_path = scripts_path + '/lib'
43bitbake_path = os.path.join(scripts_path, '../bitbake/lib') 44sys.path.append(lib_path)
44sys.path = sys.path + [lib_path, bitbake_path] 45
46bitbake_exe = spawn.find_executable('bitbake')
47if bitbake_exe:
48 bitbake_path = os.path.join(os.path.dirname(bitbake_exe), '../lib')
49 sys.path.append(bitbake_path)
50 from bb import cookerdata
51 from bb.main import bitbake_main, BitBakeConfigParameters
52else:
53 bitbake_main = None
45 54
46from image.help import * 55from image.help import *
47from image.engine import * 56from image.engine import *
48 57
49from bb import cookerdata
50from bb.main import bitbake_main, BitBakeConfigParameters
51
52def rootfs_dir_to_args(krootfs_dir): 58def rootfs_dir_to_args(krootfs_dir):
53 """ 59 """
54 Get a rootfs_dir dict and serialize to string 60 Get a rootfs_dir dict and serialize to string
@@ -109,6 +115,10 @@ def wic_create_subcommand(args, usage_str):
109 parser.print_help() 115 parser.print_help()
110 sys.exit(1) 116 sys.exit(1)
111 117
118 if options.build_rootfs and not bitbake_main:
119 logging.error("Can't build roofs as bitbake is not in the $PATH")
120 sys.exit(1)
121
112 if not options.image_name and not (options.rootfs_dir and 122 if not options.image_name and not (options.rootfs_dir and
113 options.bootimg_dir and 123 options.bootimg_dir and
114 options.kernel_dir and 124 options.kernel_dir and