diff options
author | Ed Bartosh <eduard.bartosh@intel.com> | 2015-04-17 16:19:01 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-19 13:34:43 +0100 |
commit | 9a664b91da58871f8ad3fbfac07f7292d357ce54 (patch) | |
tree | 022bf159a74148f836b25f7c3507c12a9a1241e0 /scripts | |
parent | d7a9b5ea5553dff3330523f85d358dd6b8503c1c (diff) | |
download | poky-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')
-rwxr-xr-x | scripts/wic | 20 |
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 | |||
36 | import sys | 36 | import sys |
37 | import optparse | 37 | import optparse |
38 | import logging | 38 | import logging |
39 | from distutils import spawn | ||
39 | 40 | ||
40 | # External modules | 41 | # External modules |
41 | scripts_path = os.path.abspath(os.path.dirname(__file__)) | 42 | scripts_path = os.path.abspath(os.path.dirname(__file__)) |
42 | lib_path = scripts_path + '/lib' | 43 | lib_path = scripts_path + '/lib' |
43 | bitbake_path = os.path.join(scripts_path, '../bitbake/lib') | 44 | sys.path.append(lib_path) |
44 | sys.path = sys.path + [lib_path, bitbake_path] | 45 | |
46 | bitbake_exe = spawn.find_executable('bitbake') | ||
47 | if 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 | ||
52 | else: | ||
53 | bitbake_main = None | ||
45 | 54 | ||
46 | from image.help import * | 55 | from image.help import * |
47 | from image.engine import * | 56 | from image.engine import * |
48 | 57 | ||
49 | from bb import cookerdata | ||
50 | from bb.main import bitbake_main, BitBakeConfigParameters | ||
51 | |||
52 | def rootfs_dir_to_args(krootfs_dir): | 58 | def 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 |