From 69fdfcdda423b55c7251e4d46e82563cda98a63d Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 27 May 2021 11:54:04 +0200 Subject: add new field .output.artifacts to schema Using the field you can specify an ORed set of positive glob-style patterns for artifacts to retain in the .output.directory. It defaults to including all artifacts. --- mdbp/streamapi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mdbp/streamapi.py') diff --git a/mdbp/streamapi.py b/mdbp/streamapi.py index 8f67366..f36208a 100644 --- a/mdbp/streamapi.py +++ b/mdbp/streamapi.py @@ -12,6 +12,7 @@ Differences to the regular backend API: """ import argparse +import fnmatch import json import pathlib import subprocess @@ -67,7 +68,9 @@ def main() -> None: sys.exit(code) with tarfile.open(fileobj=sys.stdout.buffer, mode="w|") as outtar: for elem in outdir.iterdir(): - tar_add(outtar, elem) + if any(fnmatch.fnmatchcase(elem.name, pattern) + for pattern in build["output"].get("artifacts", ["*"])): + tar_add(outtar, elem) if __name__ == "__main__": main() -- cgit v1.2.3