Message ID | 20210909171657.3804360-2-adrian.freihofer@siemens.com |
---|---|
State | Accepted |
Headers | show |
Series | swupdate-common: get do_swuimage vardeps | expand |
On 09.09.21 19:16, Adrian Freihofer wrote: > 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. You missed your Signed-off-by, I added it by merging. Best regards, Stefano Babic > --- > classes/swupdate-common.bbclass | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass > index dabd466..ed7f188 100644 > --- a/classes/swupdate-common.bbclass > +++ b/classes/swupdate-common.bbclass > @@ -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 >
diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass index dabd466..ed7f188 100644 --- a/classes/swupdate-common.bbclass +++ b/classes/swupdate-common.bbclass @@ -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