Commit 27d587f7 authored by Adrian Freihofer's avatar Adrian Freihofer Committed by Stefano Babic
Browse files

swupdate-common: add find bitbake variables



The new function is supposed to read all variables from sw-description
file and add them to the vardeps of the do_swuimage task. Bitbake
cannot know that the do_swuimage task which evaluates the templated
sw-description file needs to be executed if a variable which is
refered by the sw-description file but not by the recipe itself.

Using this function should be optional. That's why it is not called yet.
Signed-off-by: default avatarAdrian Freihofer <adrian.freihofer@siemens.com>
parent 512c3417
......@@ -128,6 +128,39 @@ def swupdate_expand_bitbake_variables(d, s):
for line in write_lines:
f.write(line)
# Get all the variables referred by the sw-description at parse time.
def swupdate_find_bitbake_variables(d):
import re
vardeps = []
filespath = d.getVar('FILESPATH')
sw_desc_path = bb.utils.which(filespath, "sw-description")
try:
with open(sw_desc_path, "r") as f:
for line in f:
found = False
while True:
m = re.match(r"^(?P<before_placeholder>.+)@@(?P<bitbake_variable_name>\w+)@@(?P<after_placeholder>.+)$", line)
if m:
bitbake_variable_value = m.group('bitbake_variable_name')
vardeps.append(bitbake_variable_value)
line = m.group('before_placeholder') + bitbake_variable_value + m.group('after_placeholder')
found = True
continue
else:
m = re.match(r"^(?P<before_placeholder>.+)@@(?P<bitbake_variable_name>.+)\[(?P<flag_var_name>.+)\]@@(?P<after_placeholder>.+)$", line)
if m:
bitbake_variable_value = m.group('bitbake_variable_name')
vardeps.append(bitbake_variable_value)
flag_name = m.group('flag_var_name')
vardeps.append(flag_name)
line = m.group('before_placeholder') + bitbake_variable_value + m.group('after_placeholder')
continue
break
except IOError:
pass
return ' '.join(set(vardeps))
def swupdate_expand_auto_versions(d, s):
import re
import oe.packagedata
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment