Commit 2bce5b50 authored by Stefano Babic's avatar Stefano Babic
Browse files

swupdate-common: change logic to add sha256

Instead of setting hash just for files going into SWU, scans
sw-description for any occurencies of sha256 attribute.
Signed-off-by: Stefano Babic's avatarStefano Babic <>
parent cfb7ca5b
......@@ -74,12 +74,20 @@ def swupdate_encrypt_file(f, out, key, ivt):
encargs += ["-K", key, "-iv", ivt, "-nosalt"], check=True)
def swupdate_write_sha256(s, filename, hash):
def swupdate_write_sha256(s):
import re
write_lines = []
with open(os.path.join(s, "sw-description"), 'r') as f:
for line in f:
write_lines.append(line.replace("@%s" % (filename), hash))
for line in f:
shastr = r"sha256.+=.+@(.+\")"
#m = re.match(r"^(?P<before_placeholder>.+)sha256.+=.+(?P<filename>\w+)", line)
m = re.match(r"^(?P<before_placeholder>.+)sha256.+=.+(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
if m:
filename ='filename')
hash = swupdate_get_sha256(s, filename)
write_lines.append(line.replace("@%s" % (filename), hash))
with open(os.path.join(s, "sw-description"), 'w+') as f:
for line in write_lines:
......@@ -192,10 +200,7 @@ def prepare_sw_description(d, s, list_for_cpio):
swupdate_expand_bitbake_variables(d, s)
swupdate_expand_auto_versions(d, s, list_for_cpio)
for file in list_for_cpio:
if file != 'sw-description' and swupdate_is_hash_needed(s, file):
hash = swupdate_get_sha256(s, file)
swupdate_write_sha256(s, file, hash)
encrypt = d.getVar('SWUPDATE_ENCRYPT_SWDESC', True)
if encrypt:
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