From b49a62c0c263dd18d895c07a42a468d5290bcf76 Mon Sep 17 00:00:00 2001 From: Noah Meyerhans Date: Wed, 3 Dec 2025 16:31:50 -0500 Subject: [PATCH] debian: support additional suites Fixes #1755 --- mkosi/distribution/debian.py | 23 ++++++++++++++++++++++- mkosi/resources/man/mkosi.1.md | 3 ++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mkosi/distribution/debian.py b/mkosi/distribution/debian.py index ca95dd4266..0ae6efe626 100644 --- a/mkosi/distribution/debian.py +++ b/mkosi/distribution/debian.py @@ -41,7 +41,15 @@ def package_manager(cls, config: Config) -> type[Apt]: @classmethod def repositories(cls, context: Context, for_image: bool = False) -> Iterable[AptRepository]: types = ("deb", "deb-src") - components = ("main", *context.config.repositories) + components = ("main", *[s for s in context.config.repositories if ":" not in s]) + suite_components = {} + for s in [s for s in context.config.repositories if ":" in s]: + key, value = s.split(":", 1) + if key not in suite_components: + suite_components[key] = [value] + else: + suite_components[key].append(value) + mirror = None if for_image else context.config.mirror snapshot = None if for_image else context.config.snapshot @@ -77,6 +85,19 @@ def repositories(cls, context: Context, for_image: bool = False) -> Iterable[Apt signedby=signedby, ) + for suite, comps in suite_components.items(): + if snapshot: + url = join_mirror(mirror, f"archive/{suite}/{snapshot}") + else: + url = join_mirror(mirror, "debian") + yield AptRepository( + types=types, + url=url, + suite=suite, + components=tuple(comps), + signedby=signedby, + ) + # Debug repos are typically not mirrored. if snapshot: url = join_mirror(mirror, f"archive/debian-debug/{snapshot}") diff --git a/mkosi/resources/man/mkosi.1.md b/mkosi/resources/man/mkosi.1.md index da441e566f..5fb2a060a3 100644 --- a/mkosi/resources/man/mkosi.1.md +++ b/mkosi/resources/man/mkosi.1.md @@ -587,7 +587,8 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, `Repositories=`, `--repositories=` : Enable package repositories that are disabled by default. This can be used to enable the EPEL repos for - CentOS or different components of the Debian/Kali/Ubuntu repositories. + CentOS or different components of the Debian/Kali/Ubuntu repositories. Debian suites can be specified + ahead of the component, separated by a ":" (colon) character, e.g. `trixie-backports:main`. ### [Output] Section