Skip to content

Commit 127b80b

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

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

mkosi/distribution/debian.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,19 @@ 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] += (value,)
55+
suite_components[key].append(value)
56+
4557
mirror = None if for_image else context.config.mirror
4658
snapshot = None if for_image else context.config.snapshot
4759

@@ -77,6 +89,19 @@ def repositories(cls, context: Context, for_image: bool = False) -> Iterable[Apt
7789
signedby=signedby,
7890
)
7991

92+
for suite, comps in suite_components.items():
93+
if snapshot:
94+
url = join_mirror(mirror, f"archive/{suite}/{snapshot}")
95+
else:
96+
url = join_mirror(mirror, "debian")
97+
yield AptRepository(
98+
types=types,
99+
url=url,
100+
suite=suite,
101+
components=tuple(comps),
102+
signedby=signedby,
103+
)
104+
80105
# Debug repos are typically not mirrored.
81106
if snapshot:
82107
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)