assemblers/qemu: don't try to compress raw or vdi formats

qemu-img convert fails when passing `-c` to vdi or raw outputs.
This commit is contained in:
Lars Karlitski 2019-10-07 14:22:17 +02:00 committed by Tom Gundersen
parent 2be0530047
commit eab8cbff5e

View file

@ -98,7 +98,13 @@ def main(tree, output_dir, options, loop_client):
mount(loop, mountpoint):
subprocess.run(["cp", "-a", f"{tree}/.", mountpoint], check=True)
subprocess.run(["qemu-img", "convert", "-O", fmt, "-c", image, f"{output_dir}/{filename}"], check=True)
extra_args = []
# raw and vdi don't suppport compression
if fmt != "raw" and fmt != "vdi":
extra_args.append("-c")
subprocess.run(["qemu-img", "convert", "-O", fmt, *extra_args, image, f"{output_dir}/{filename}"], check=True)
if __name__ == '__main__':
args = json.load(sys.stdin)