diff options
author | Tom Zanussi <tom.zanussi@linux.intel.com> | 2014-02-03 19:16:55 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-04 12:57:35 +0000 |
commit | 3cb93017e64b409e887e37f255ae49bb4e274465 (patch) | |
tree | 61258e6b8d6f99c2ffc19e444ad516a00d6e00bc /scripts | |
parent | 534d9ba70a44ad601a242ed09093d21cd3f032f1 (diff) | |
download | poky-3cb93017e64b409e887e37f255ae49bb4e274465.tar.gz |
wic: Create and use new functions for getting bitbake variables
Add get_bitbake_var() and bitbake_env_lines() functions for use by
plugins, which will need access to them for customization.
(From OE-Core rev: f0bb47b0d7ab6520c105ce131844269172de3efd)
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/image/engine.py | 20 | ||||
-rw-r--r-- | scripts/lib/mic/utils/oe/misc.py | 16 | ||||
-rwxr-xr-x | scripts/wic | 6 |
3 files changed, 37 insertions, 5 deletions
diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py index 0e8b89e5f1..2dd98b968c 100644 --- a/scripts/lib/image/engine.py +++ b/scripts/lib/image/engine.py | |||
@@ -60,16 +60,26 @@ def verify_build_env(): | |||
60 | return True | 60 | return True |
61 | 61 | ||
62 | 62 | ||
63 | def find_artifacts(image_name): | 63 | def find_bitbake_env_lines(image_name): |
64 | """ | 64 | """ |
65 | Gather the build artifacts for the current image (the image_name | 65 | If image_name is empty, plugins might still be able to use the |
66 | e.g. core-image-minimal) for the current MACHINE set in local.conf | 66 | environment, so set it regardless. |
67 | """ | 67 | """ |
68 | bitbake_env_cmd = "bitbake -e %s" % image_name | 68 | bitbake_env_cmd = "bitbake -e %s" % image_name |
69 | rc, bitbake_env_lines = exec_cmd(bitbake_env_cmd) | 69 | rc, bitbake_env_lines = exec_cmd(bitbake_env_cmd) |
70 | if rc != 0: | 70 | if rc != 0: |
71 | print "Couldn't get '%s' output, exiting." % bitbake_env_cmd | 71 | print "Couldn't get '%s' output." % bitbake_env_cmd |
72 | sys.exit(1) | 72 | return None |
73 | |||
74 | return bitbake_env_lines | ||
75 | |||
76 | |||
77 | def find_artifacts(image_name): | ||
78 | """ | ||
79 | Gather the build artifacts for the current image (the image_name | ||
80 | e.g. core-image-minimal) for the current MACHINE set in local.conf | ||
81 | """ | ||
82 | bitbake_env_lines = get_bitbake_env_lines() | ||
73 | 83 | ||
74 | rootfs_dir = kernel_dir = hdddir = staging_data_dir = native_sysroot = "" | 84 | rootfs_dir = kernel_dir = hdddir = staging_data_dir = native_sysroot = "" |
75 | 85 | ||
diff --git a/scripts/lib/mic/utils/oe/misc.py b/scripts/lib/mic/utils/oe/misc.py index 097d44c057..77dfe03630 100644 --- a/scripts/lib/mic/utils/oe/misc.py +++ b/scripts/lib/mic/utils/oe/misc.py | |||
@@ -109,6 +109,15 @@ def add_wks_var(key, val): | |||
109 | 109 | ||
110 | BOOTDD_EXTRA_SPACE = 16384 | 110 | BOOTDD_EXTRA_SPACE = 16384 |
111 | 111 | ||
112 | __bitbake_env_lines = "" | ||
113 | |||
114 | def set_bitbake_env_lines(bitbake_env_lines): | ||
115 | global __bitbake_env_lines | ||
116 | __bitbake_env_lines = bitbake_env_lines | ||
117 | |||
118 | def get_bitbake_env_lines(): | ||
119 | return __bitbake_env_lines | ||
120 | |||
112 | def get_line_val(line, key): | 121 | def get_line_val(line, key): |
113 | """ | 122 | """ |
114 | Extract the value from the VAR="val" string | 123 | Extract the value from the VAR="val" string |
@@ -118,3 +127,10 @@ def get_line_val(line, key): | |||
118 | stripped_line = stripped_line.replace('\"', '') | 127 | stripped_line = stripped_line.replace('\"', '') |
119 | return stripped_line | 128 | return stripped_line |
120 | return None | 129 | return None |
130 | |||
131 | def get_bitbake_var(key): | ||
132 | for line in __bitbake_env_lines.split('\n'): | ||
133 | if (get_line_val(line, key)): | ||
134 | val = get_line_val(line, key) | ||
135 | return val | ||
136 | return None | ||
diff --git a/scripts/wic b/scripts/wic index b6fd16c5df..4ea5569576 100755 --- a/scripts/wic +++ b/scripts/wic | |||
@@ -98,6 +98,12 @@ def wic_create_subcommand(args, usage_str): | |||
98 | 98 | ||
99 | print "Creating image(s)...\n" | 99 | print "Creating image(s)...\n" |
100 | 100 | ||
101 | bitbake_env_lines = find_bitbake_env_lines(options.image_name) | ||
102 | if not bitbake_env_lines: | ||
103 | print "Couldn't get bitbake environment, exiting." | ||
104 | sys.exit(1) | ||
105 | set_bitbake_env_lines(bitbake_env_lines) | ||
106 | |||
101 | bootimg_dir = staging_data_dir = hdddir = "" | 107 | bootimg_dir = staging_data_dir = hdddir = "" |
102 | 108 | ||
103 | if options.image_name: | 109 | if options.image_name: |