if not names:
return
- if not (conf := context.repository / "conf/distributions").exists():
- conf.parent.mkdir(exist_ok=True)
- distconfig = textwrap.dedent(
- f"""\
- Origin: mkosi
- Label: mkosi
- Architectures: {context.config.distribution.architecture(context.config.architecture)}
- Codename: mkosi
- Components: main
- Description: mkosi local repository
- """
- )
- for distconfinclude in ("usr/lib/reprepro/", "etc/reprepro/"):
- if (context.sandbox_tree / distconfinclude).exists():
- distconfig += f"!include: /{distconfinclude}\n"
- conf.write_text(distconfig)
-
- run(
- [
- "reprepro",
- "--ignore=extension",
- "includedeb",
- "mkosi",
- *names,
- ],
- sandbox=context.sandbox(
- options=[
- "--bind", context.repository, workdir(context.repository),
- "--chdir", workdir(context.repository),
- ],
- ),
- ) # fmt: skip
+ with (context.repository / "Packages").open("wb") as f:
+ run(
+ ["apt-ftparchive", "packages", "."],
+ stdout=f,
+ sandbox=context.sandbox(
+ options=[
+ "--ro-bind", context.repository, workdir(context.repository),
+ "--chdir", workdir(context.repository),
+ ],
+ ),
+ ) # fmt: skip
(context.sandbox_tree / "etc/apt/sources.list.d").mkdir(parents=True, exist_ok=True)
(context.sandbox_tree / "etc/apt/sources.list.d/mkosi-local.sources").write_text(
Enabled: yes
Types: deb
URIs: file:///repository
- Suites: mkosi
- Components: main
+ Suites: ./
Trusted: yes
"""
)
running scripts. If the `mkosi.packages/` directory is found in the local
directory it is also used for this purpose.
- On deb-based distributions the local repository will be created with **reprepro** and additional
- configuration for reprepro will be included from `/usr/lib/reprepro` and `/etc/reprepro` in the sandbox
- trees, see **reprepro(1)** for details on reprepro configuration includes.
-
`VolatilePackageDirectories=`, `--volatile-package-directory=`
: Like `PackageDirectories=`, but any changes to the packages in these
directories will not invalidate the cached images if `Incremental=`