metadata: normalize TYPE_BOOL to YAML 1.2 booleans

This makes the internal representation always be a boolean, and that also
means that YAML 1.2 booleans will be written out, e.g. rewritemeta.
This commit is contained in:
Hans-Christoph Steiner 2023-05-24 09:03:23 +02:00
parent aa98d67c86
commit 8374842faa
3 changed files with 15 additions and 10 deletions

View file

@ -979,6 +979,8 @@ def post_parse_yaml_metadata(yamldata):
elif _fieldtype == TYPE_STRINGMAP:
if v or v == 0: # TODO probably want just `if v:`
yamldata[k] = _normalize_type_stringmap(k, v)
elif _fieldtype == TYPE_BOOL:
yamldata[k] = bool(v)
else:
if type(v) in (float, int):
yamldata[k] = str(v)
@ -1017,6 +1019,8 @@ def post_parse_yaml_metadata(yamldata):
elif _flagtype == TYPE_STRINGMAP:
if v or v == 0:
build[k] = _normalize_type_stringmap(k, v)
elif _flagtype == TYPE_BOOL:
build[k] = bool(v)
builds.append(build)