mirror of
https://git.yoctoproject.org/poky
synced 2026-05-01 06:32:11 +02: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:
committed by
Richard Purdie
parent
673343414f
commit
aa470a1fcd
@@ -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" % \
|
||||
|
||||
Reference in New Issue
Block a user