From: Daan De Meyer Date: Fri, 28 Feb 2025 10:49:41 +0000 (+0100) Subject: Skip createrepo() for apt if there are no debs X-Git-Tag: v26~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe2c14ac156b0db20dc1875bdd7ecf3bc607ddaa;p=thirdparty%2Fmkosi.git Skip createrepo() for apt if there are no debs reprepro fails if there are no packages passed to it so skip it if there are no packages. --- diff --git a/mkosi/installer/apt.py b/mkosi/installer/apt.py index 5a1e153ff..2b9a4a33c 100644 --- a/mkosi/installer/apt.py +++ b/mkosi/installer/apt.py @@ -235,6 +235,10 @@ class Apt(PackageManager): @classmethod def createrepo(cls, context: Context) -> None: + names = [d.name for glob in PACKAGE_GLOBS for d in context.repository.glob(glob) if "deb" in glob] + if not names: + return + if not (conf := context.repository / "conf/distributions").exists(): conf.parent.mkdir(exist_ok=True) conf.write_text( @@ -256,7 +260,7 @@ class Apt(PackageManager): "--ignore=extension", "includedeb", "mkosi", - *(d.name for glob in PACKAGE_GLOBS for d in context.repository.glob(glob) if "deb" in glob), + *names, ], sandbox=context.sandbox( options=[