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.
This commit is contained in:
parent
7fabcfe333
commit
283281f047
1 changed files with 10 additions and 5 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue