1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

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.

(From OE-Core rev: 3abe23bd217315246ec2d98dc9c390b85cfe6a92)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh
2015-06-26 21:27:31 +03:00
committed by Richard Purdie
parent 673343414f
commit aa470a1fcd
5 changed files with 37 additions and 102 deletions
+5 -16
View File
@@ -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()