mkosi: Introduce build image

We want the exitrd image to be built with the latest systemd as well.
As the exitrd image is built as part of mkosi.images, and all subimages
are built before the main image, this implies the packages must be built
as a subimage in mkosi.images/ as well. So we introduce the build image and
move all logic related to building distribution packages there.

This also has the nice side effect of slimming down the main image as the
build dependencies are not installed into the main image anymore. It also
makes sure the packages are built in a "clean" chroot without any of the
other packages which we install in the main image available.
This commit is contained in:
Daan De Meyer
2024-07-12 15:33:49 +02:00
parent 72a8f508e5
commit 7205fc7dc3
51 changed files with 487 additions and 300 deletions

View File

@@ -33,7 +33,8 @@ def read_config(distro: str):
text = subprocess.check_output(cmd, text=True)
data = json.loads(text)
return data['Images'][-1]
images = {image["Image"]: image for image in data["Images"]}
return images["build"]
def commit_file(distro: str, file: Path, commit: str, changes: str):
message = '\n'.join((
@@ -69,7 +70,7 @@ def update_distro(args, distro: str):
print(f"+ {shlex.join(cmd)}")
changes = subprocess.check_output(cmd, text=True).strip()
conf_dir = Path('mkosi.conf.d')
conf_dir = Path('mkosi.images/build/mkosi.conf.d')
files = conf_dir.glob('*/*.conf')
for file in files:
s = file.read_text()