Skip to content
Snippets Groups Projects
Commit 9cc67810 authored by Reto Schneider's avatar Reto Schneider Committed by Stefano Babic
Browse files

Allow expansion of BitBake variables in sw-description files

parent 51af7972
Branches
No related tags found
No related merge requests found
......@@ -12,6 +12,13 @@ This layer depends on:
URI: git://github.com/openembedded/meta-openembedded.git
subdirectory: meta-oe
BitBake variable expansion
--------------------------
To insert the values of BitBake variables into the update file, pre- and postfix
the names with "@@". For example, to automatically set the version tag, use the
line `version = "@@DISTRO_VERSION@@";` in your sw-description file.
Image hashing
-------------
......
......@@ -29,8 +29,30 @@ def swupdate_write_sha256(s, filename, hash):
for line in write_lines:
f.write(line)
def swupdate_expand_bitbake_variables(d, s):
write_lines = []
with open(os.path.join(s, "sw-description"), 'r') as f:
import re
for line in f:
m = re.match(r"^(?P<before_placeholder>.+)@@(?P<bitbake_variable_name>\w+)@@(?P<after_placeholder>.+)$", line)
if m:
bitbake_variable_value = d.getVar(m.group('bitbake_variable_name'), True)
if bitbake_variable_value:
write_lines.append(m.group('before_placeholder') + bitbake_variable_value + m.group('after_placeholder') + "\n");
else:
bb.fatal("BitBake variable %s not set" % (m.group('bitbake_variable_name')))
else:
write_lines.append(line)
with open(os.path.join(s, "sw-description"), 'w+') as f:
for line in write_lines:
f.write(line)
def prepare_sw_description(d, s, list_for_cpio):
swupdate_expand_bitbake_variables(d, s)
for file in list_for_cpio:
if file != 'sw-description' and swupdate_is_hash_needed(s, file):
hash = swupdate_get_sha256(s, file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment