Browse Source

swupdate-common: Allow to use sha256 as version

For images that do not have a version, but could use the
install-if-different flag, the sha256 sum could be used instead.  A
previous regex would allow this because the '@filname' was replaced
with the sha256, no matter what key the value was associated with.

The current regex is updated to support using the placeholder for both
the sha256 and version keys.

Signed-off-by: Colin McAllister <colin.mcallister@garmin.com>
Colin McAllister 4 years ago
parent
commit
82882e9902
1 changed files with 1 additions and 1 deletions
  1. 1 1
      classes/swupdate-common.bbclass

+ 1 - 1
classes/swupdate-common.bbclass

@@ -80,7 +80,7 @@ def swupdate_write_sha256(s):
        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)
+          m = re.match(r"^(?P<before_placeholder>.+)[sha256|version].+[=:].*(?P<quote>[\'\"])@(?P<filename>.*)(?P=quote)", line)
           if m:
               filename = m.group('filename')
               hash = swupdate_get_sha256(s, filename)