assemblers/qcow2: Don't create extra level of tmp

Assemblers are always run in their own, clean environment and can be
sure that there's only one instance of themselves running. Remove the
extra layer of temporary directory and use static names.
This commit is contained in:
Lars Karlitski 2019-09-01 14:22:37 +02:00 committed by Tom Gundersen
parent 61be6985a9
commit 358ef27f9f

View file

@ -7,7 +7,6 @@ import os
import socket
import subprocess
import sys
import tempfile
import osbuild.remoteloop as remoteloop
def tree_size(tree):
@ -50,11 +49,8 @@ def main(tree, output_dir, options, loop_client):
filename = options["filename"]
root_fs_uuid = options["root_fs_uuid"]
# Create a working directory on a tmpfs, maybe we should implicitly
# always do this.
with tempfile.TemporaryDirectory() as workdir:
image = f"{workdir}/image.raw"
mountpoint = f"{workdir}/mnt"
image = f"/tmp/osbuild-image.raw"
mountpoint = f"/tmp/osbuild-mnt"
# Create an empty image file of the right size
size = int(math.ceil(tree_size(tree) * 1.2 / 512) * 512)