Run shell scripts with -e (Closes: #1035)

Make sudo, init prebuild, build and Prepare fields lists and only
concatenate them with '; ' before execution. This allows arbitrary
commands inside the fileds (even && and ';') as we don't need to split
the commands again for rewritemeta.
This commit is contained in:
Jochen Sprickerhof 2022-09-09 12:36:54 +02:00 committed by Michael Pöhn
parent 49d8ba3b9b
commit 557fe87d44
10 changed files with 477 additions and 254 deletions

View file

@ -40,7 +40,17 @@ import fdroidserver.metadata # noqa
def _build_yaml_representer(dumper, data):
"""Create a YAML representation of a Build instance."""
return dumper.represent_dict(data)
# internal representation of keys were switched
# to lists instead of strings concatenated by &&
# https://gitlab.com/fdroid/fdroidserver/merge_requests/1185
output = {}
for k, v in data.items():
if k in ("build", "init", "prebuild", "sudo"):
output[k] = " && ".join(v)
else:
output[k] = v
return dumper.represent_dict(output)
parser = ArgumentParser()