From aa470a1fcd09abbc570d3d885aff460603ef9925 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. (From OE-Core rev: 3abe23bd217315246ec2d98dc9c390b85cfe6a92) Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- scripts/lib/wic/plugins/source/rootfs.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'scripts/lib/wic/plugins/source/rootfs.py') diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index 12fbf67a6e..a90712b247 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -29,7 +29,7 @@ import os from wic import msger from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import find_bitbake_env_lines, find_artifact +from wic.utils.oe.misc import get_bitbake_var class RootfsPlugin(SourcePlugin): """ @@ -43,12 +43,7 @@ class RootfsPlugin(SourcePlugin): if os.path.isdir(rootfs_dir): return rootfs_dir - bitbake_env_lines = find_bitbake_env_lines(rootfs_dir) - if not bitbake_env_lines: - msg = "Couldn't get bitbake environment, exiting." - msger.error(msg) - - image_rootfs_dir = find_artifact(bitbake_env_lines, "IMAGE_ROOTFS") + image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) if not os.path.isdir(image_rootfs_dir): msg = "No valid artifact IMAGE_ROOTFS from image named" msg += " %s has been found at %s, exiting.\n" % \ -- cgit v1.2.3-54-g00ecf