coredevice: ignore .dirty in version checks correctly

This commit is contained in:
Sebastien Bourdeauducq 2017-02-25 20:05:05 +08:00
parent 98be556143
commit e82ce3ea28

View File

@ -209,12 +209,21 @@ class CommGeneric:
if runtime_id != b"AROR":
raise UnsupportedDevice("Unsupported runtime ID: {}"
.format(runtime_id))
gateware_version = self._read_string()
if gateware_version != software_version and \
gateware_version + ".dirty" != software_version:
if gateware_version.endswith(".dirty"):
gateware_version_clean = gateware_version[:-6]
else:
gateware_version_clean = gateware_version
if software_version.endswith(".dirty"):
software_version_clean = software_version[:-6]
else:
software_version_clean = software_version
if gateware_version_clean != software_version_clean:
logger.warning("Mismatch between gateware (%s) "
"and software (%s) versions",
gateware_version, software_version)
finished_cleanly = self._read_bool()
if not finished_cleanly:
logger.warning("Interrupted a running kernel")