osbuild: always pass an input_dir argument

All stages must be able to handle an input_dir argument, as we now
either pass it to all or none for agiven run. Simply set it to
'None' if it is not provided.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-06-12 18:54:31 +02:00
parent 2462f0d6e1
commit 34de8e0274
10 changed files with 11 additions and 9 deletions

View file

@ -76,6 +76,8 @@ def main(pipeline_path, input_dir, output_dir, sit):
if input_dir:
options["input_dir"] = "/tmp/input"
argv.append(f"--bind-ro={os.getcwd()}/{input_dir}:/tmp/input")
else:
options["input_dir"] = None
# Pass the tree r/w to all stages but the last one.
# The last stage gets the tree ro and optionally gets an output dir

View file

@ -70,7 +70,7 @@ product = """
product_name = Fedora
"""
def main(tree, kickstart, skip_package_install=False):
def main(tree, input_dir, kickstart, skip_package_install=False):
with open("/tmp/kickstart.ks", "w") as f:
if skip_package_install:
subprocess.run(["tar", "cvf", "/tmp/empty.tar", "--files-from", "/dev/null"])

View file

@ -6,7 +6,7 @@ import subprocess
import sys
def main(tree, playbook):
def main(tree, input_dir, playbook):
with open("/tmp/inventory", "w") as f:
f.write(f"osbuild-tree ansible_connection=chroot ansible_host={tree} ansible_python_interpreter=/usr/bin/python3")

View file

@ -7,7 +7,7 @@ import subprocess
import sys
def main(tree, repos, packages, releasever):
def main(tree, input_dir, repos, packages, releasever):
with open("/tmp/dnf.conf", "w") as conf:
p = configparser.ConfigParser()
p.read_dict(repos)

View file

@ -3,7 +3,7 @@
import json
import sys
def main(tree, language, vc_keymap=None):
def main(tree, input_dir, language, vc_keymap=None):
with open(f"{tree}/etc/locale.conf", "w") as f:
f.write(f'LANG="{language}"\n')

View file

@ -3,7 +3,7 @@
import json
import sys
def main(tree, **options):
def main(tree, input_dir, **options):
print("Not doing anything with these options:", json.dumps(options))
if __name__ == '__main__':

View file

@ -41,7 +41,7 @@ def loop_device(image):
finally:
subprocess.run(["losetup", "-d", loop], check=True)
def main(tree, target):
def main(tree, input_dir, target):
size = tree_size(tree)
with tempfile.TemporaryDirectory(dir=os.getcwd()) as workdir:

View file

@ -5,7 +5,7 @@ import json
import os
import sys
def main(tree):
def main(tree, inut_dir):
with contextlib.suppress(FileNotFoundError):
os.unlink(f"{tree}/etc/machine-id")
os.unlink(f"{tree}/var/lib/systemd/random-seed")

View file

@ -7,7 +7,7 @@ import subprocess
import sys
def main(tree, script):
def main(tree, input_dir, script):
scriptfile = f"{tree}/osbuild-script"
with open(scriptfile, "w") as f:

View file

@ -4,7 +4,7 @@ import json
import os
import subprocess
def main(tree, enabled_services):
def main(tree, input_dir, enabled_services):
for service in enabled_services:
subprocess.run([f"{tree}/usr/bin/systemctl", "--root", tree, "enable", service], check=True)