summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-01-19 16:18:28 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:18 +0000
commit7d5f44b455ec7f6d697454ab4bf64f367463bf0e (patch)
treecae1433f2a511e0ff256a52f9336c5a2b9807903
parent253b8d7d586d8403fda5b7d49637ce250fef5cc9 (diff)
downloadpoky-7d5f44b455ec7f6d697454ab4bf64f367463bf0e.tar.gz
wic: misc.py: add parameter 'cache' to get_bitbake_vars
This parameter will be used to allow or prevent variable caching. For example, we don't want to cache value of RECIPE_SYSROOT_NATIVE wic-tools variable as we may decide to rebuild wic-tools. (From OE-Core rev: e4269fdb4c3ef06b97df063f8586f74986215c83) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/wic/utils/oe/misc.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 445109a03d..3737c4b1f0 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -160,7 +160,7 @@ class BitbakeVars(defaultdict):
160 key, val = match.groups() 160 key, val = match.groups()
161 self[image][key] = val.strip('"') 161 self[image][key] = val.strip('"')
162 162
163 def get_var(self, var, image=None): 163 def get_var(self, var, image=None, cache=True):
164 """ 164 """
165 Get bitbake variable from 'bitbake -e' output or from .env file. 165 Get bitbake variable from 'bitbake -e' output or from .env file.
166 This is a lazy method, i.e. it runs bitbake or parses file only when 166 This is a lazy method, i.e. it runs bitbake or parses file only when
@@ -202,21 +202,26 @@ class BitbakeVars(defaultdict):
202 self._parse_line(line, image) 202 self._parse_line(line, image)
203 203
204 # Make first image a default set of variables 204 # Make first image a default set of variables
205 images = [key for key in self if key] 205 if cache:
206 if len(images) == 1: 206 images = [key for key in self if key]
207 self[None] = self[image] 207 if len(images) == 1:
208 self[None] = self[image]
208 209
209 return self[image].get(var) 210 result = self[image].get(var)
211 if not cache:
212 self.pop(image, None)
213
214 return result
210 215
211# Create BB_VARS singleton 216# Create BB_VARS singleton
212BB_VARS = BitbakeVars() 217BB_VARS = BitbakeVars()
213 218
214def get_bitbake_var(var, image=None): 219def get_bitbake_var(var, image=None, cache=True):
215 """ 220 """
216 Provide old get_bitbake_var API by wrapping 221 Provide old get_bitbake_var API by wrapping
217 get_var method of BB_VARS singleton. 222 get_var method of BB_VARS singleton.
218 """ 223 """
219 return BB_VARS.get_var(var, image) 224 return BB_VARS.get_var(var, image, cache)
220 225
221def parse_sourceparams(sourceparams): 226def parse_sourceparams(sourceparams):
222 """ 227 """