From 3abe23bd217315246ec2d98dc9c390b85cfe6a92 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Fri, 26 Jun 2015 21:27:31 +0300 Subject: 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 --- scripts/lib/image/engine.py | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'scripts/lib/image/engine.py') diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py index 47950f8d15..92dcc5a4f9 100644 --- a/scripts/lib/image/engine.py +++ b/scripts/lib/image/engine.py @@ -60,29 +60,6 @@ def verify_build_env(): return True -def find_artifacts(image_name): - """ - Gather the build artifacts for the current image (the image_name - e.g. core-image-minimal) for the current MACHINE set in local.conf - """ - bitbake_env_lines = misc.get_bitbake_env_lines() - - rootfs_dir = kernel_dir = bootimg_dir = native_sysroot = "" - - for line in bitbake_env_lines.split('\n'): - if misc.get_line_val(line, "IMAGE_ROOTFS"): - rootfs_dir = misc.get_line_val(line, "IMAGE_ROOTFS") - continue - if misc.get_line_val(line, "DEPLOY_DIR_IMAGE"): - kernel_dir = misc.get_line_val(line, "DEPLOY_DIR_IMAGE") - continue - if misc.get_line_val(line, "STAGING_DIR_NATIVE"): - native_sysroot = misc.get_line_val(line, "STAGING_DIR_NATIVE") - continue - - return (rootfs_dir, kernel_dir, bootimg_dir, native_sysroot) - - CANNED_IMAGE_DIR = "lib/image/canned-wks" # relative to scripts SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR -- cgit v1.2.3