diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2023-04-10 12:54:53 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2023-04-10 13:08:42 +0000 |
commit | 87dfad0c8505a641599765081d455fc3eb74e1d4 (patch) | |
tree | 41b720c71b2f58026a8d8ea8bbd0d0bc6b94a813 | |
parent | 5f366be3000e8c00f7ce73d64606095d3ba4c22e (diff) | |
download | libqmi-87dfad0c8505a641599765081d455fc3eb74e1d4.tar.gz |
qmi-codegen: support 'since' tag in common TLVs
If the common TLV field defines its own 'since' tag, prefer it over
the 'since' tag specified by the message. This supports the rare case
where a TLV format is updated while keeping the original message name
untouched.
Fixes https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/issues/104
-rw-r--r-- | build-aux/qmi-codegen/Container.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/build-aux/qmi-codegen/Container.py b/build-aux/qmi-codegen/Container.py index 0ecb5eac..7ac97918 100644 --- a/build-aux/qmi-codegen/Container.py +++ b/build-aux/qmi-codegen/Container.py @@ -74,10 +74,12 @@ class Container: copy = dict(common) if 'prerequisites' in field_dictionary: copy['prerequisites'] = field_dictionary['prerequisites'] - # Fix 'since' in the copy + # If an explicit 'since' is given in the field, prefer it over any other one if 'since' in field_dictionary: copy['since'] = field_dictionary['since'] - else: + # If the common type does not have any explicit 'since', take the one from the message + # If the common type has a 'since', take it only if it is newer than the one from the message + elif not 'since' in copy or utils.version_compare(copy['since'],self.since) > 0: copy['since'] = self.since new_dict.append(copy) break |