From 283281f04784fbc72656cb96c5ee9d847724035f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Tue, 10 Sep 2019 14:03:00 +0200 Subject: [PATCH] assemblers/tar: Allow creating tar archive without any compression In tests we often use tar assembler as final stage. This means we compress the image tree and decompress it right away. For this purposes it is nice to have option to not have any compression. Actually, this could very drastically improve CI running time. A better option would be not to use tar at all and instead let osbuild just dump the resulting tree. However, we felt this behaviour needs more discussion and we need a fix asap. --- assemblers/org.osbuild.tar | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/assemblers/org.osbuild.tar b/assemblers/org.osbuild.tar index 58d23d20..078831f6 100755 --- a/assemblers/org.osbuild.tar +++ b/assemblers/org.osbuild.tar @@ -7,13 +7,18 @@ import sys def main(tree, output_dir, options): filename = options["filename"] - compression = options["compression"] + compression = options.get("compression") - if compression not in {"bzip2", "xz", "lzip", "lzma", "lzop", "gzip"}: - return 1 + command = ["tar", "-cf", f"{output_dir}/{filename}", "-C", tree] - subprocess.run(["tar", f"--{compression}", "-cf", f"{output_dir}/{filename}", "-C", tree, "."], - stdout=subprocess.DEVNULL, check=True) + if compression is not None: + if compression not in {"bzip2", "xz", "lzip", "lzma", "lzop", "gzip"}: + return 1 + command.append(f"--{compression}") + + command.append(".") + + subprocess.run(command, stdout=subprocess.DEVNULL, check=True) return 0