summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 """