Skip to content

Commit 8e9ec3a

Browse files
author
Noah Meyerhans
committed
debian: support additional suites
Fixes #1755
1 parent 01c3854 commit 8e9ec3a

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

mkosi/distribution/debian.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,18 @@ def package_manager(cls, config: Config) -> type[Apt]:
4141
@classmethod
4242
def repositories(cls, context: Context, for_image: bool = False) -> Iterable[AptRepository]:
4343
types = ("deb", "deb-src")
44-
components = ("main", *context.config.repositories)
44+
components = ("main", *[s for s in context.config.repositories if ":" not in s])
45+
suite_components = {}
46+
for s in context.config.repositories:
47+
if ":" not in s:
48+
components += (s,)
49+
else:
50+
key, value = s.split(":", 1)
51+
if key not in suite_components:
52+
suite_components[key] = [value]
53+
else:
54+
suite_components[key].append(value)
55+
4556
mirror = None if for_image else context.config.mirror
4657
snapshot = None if for_image else context.config.snapshot
4758

@@ -77,6 +88,19 @@ def repositories(cls, context: Context, for_image: bool = False) -> Iterable[Apt
7788
signedby=signedby,
7889
)
7990

91+
for suite, comps in suite_components.items():
92+
if snapshot:
93+
url = join_mirror(mirror, f"archive/{suite}/{snapshot}")
94+
else:
95+
url = join_mirror(mirror, "debian")
96+
yield AptRepository(
97+
types=types,
98+
url=url,
99+
suite=suite,
100+
components=tuple(comps),
101+
signedby=signedby,
102+
)
103+
80104
# Debug repos are typically not mirrored.
81105
if snapshot:
82106
url = join_mirror(mirror, f"archive/debian-debug/{snapshot}")

mkosi/resources/man/mkosi.1.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,8 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
587587

588588
`Repositories=`, `--repositories=`
589589
: Enable package repositories that are disabled by default. This can be used to enable the EPEL repos for
590-
CentOS or different components of the Debian/Kali/Ubuntu repositories.
590+
CentOS or different components of the Debian/Kali/Ubuntu repositories. Debian suites can be specified
591+
ahead of the component, separated by a ":" (colon) character, e.g. `trixie-backports:main`.
591592

592593
### [Output] Section
593594

0 commit comments

Comments
 (0)