summaryrefslogtreecommitdiff
path: root/scripts/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-06-26 21:27:31 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-02 23:01:17 +0100
commit3abe23bd217315246ec2d98dc9c390b85cfe6a92 (patch)
tree088fc8e061b3008d9ceab7b52175148243e259c2 /scripts/wic
parent8becfc2281282a2e63b3bf511936df36315c9cb1 (diff)
downloadopenembedded-core-3abe23bd217315246ec2d98dc9c390b85cfe6a92.tar.gz
openembedded-core-3abe23bd217315246ec2d98dc9c390b85cfe6a92.tar.bz2
openembedded-core-3abe23bd217315246ec2d98dc9c390b85cfe6a92.zip
wic: Refactor getting bitbake variables
Wic gets bitbake variables by parsing output of 'bitbake -e' command. This implementation improves this procedure as it runs 'bitbake -e' only when API is called and does it only once, i.e. in a "lazy" way. As parsing results are cached 'bitbake -e' is run only once and results are parsed only once per requested set of variables. get_bitbake_var became the only API call. It replaces find_artifacts, find_artifact, find_bitbake_env_lines, get_bitbake_env_lines, set_bitbake_env_lines and get_line_val calls making API much more clear. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Diffstat (limited to 'scripts/wic')
-rwxr-xr-xscripts/wic21
1 files changed, 5 insertions, 16 deletions
diff --git a/scripts/wic b/scripts/wic
index a39ec95e0b..b75d122482 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -52,7 +52,7 @@ if bitbake_exe:
else:
bitbake_main = None
-from wic.utils.oe.misc import find_bitbake_env_lines, set_bitbake_env_lines
+from wic.utils.oe.misc import get_bitbake_var
from wic.utils.errors import WicError
from image import engine
from image import help as hlp
@@ -141,12 +141,6 @@ def wic_create_subcommand(args, usage_str):
else:
print "Done.\n"
- bitbake_env_lines = find_bitbake_env_lines(options.image_name)
- if not bitbake_env_lines:
- print "Couldn't get bitbake environment, exiting."
- sys.exit(1)
- set_bitbake_env_lines(bitbake_env_lines)
-
bootimg_dir = ""
if options.image_name:
@@ -160,9 +154,10 @@ def wic_create_subcommand(args, usage_str):
cookerdata.CookerConfiguration()):
sys.exit(1)
- (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) \
- = engine.find_artifacts(options.image_name)
-
+ rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", options.image_name)
+ kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE", options.image_name)
+ native_sysroot = get_bitbake_var("STAGING_DIR_NATIVE",
+ options.image_name)
else:
if options.build_rootfs:
print "Image name is not specified, exiting. (Use -e/--image-name to specify it)\n"
@@ -244,12 +239,6 @@ def wic_list_subcommand(args, usage_str):
(options, args) = parser.parse_args(args)
- bitbake_env_lines = find_bitbake_env_lines(None)
- if not bitbake_env_lines:
- print "Couldn't get bitbake environment, exiting."
- sys.exit(1)
- set_bitbake_env_lines(bitbake_env_lines)
-
if not engine.wic_list(args, scripts_path, options.properties_file):
logging.error("Bad list arguments, exiting\n")
parser.print_help()