from mkosi.burn import run_burn
from mkosi.completion import print_completion
from mkosi.config import (
- PACKAGE_GLOBS,
Args,
ArtifactOutput,
Cacheonly,
with complete_step("Copying in extra packages…"):
for d in directories:
- for p in itertools.chain(*(d.glob(glob) for glob in PACKAGE_GLOBS)):
+ for p in itertools.chain.from_iterable(
+ d.glob(glob)
+ for glob in context.config.distribution.package_manager(context.config).package_globs()
+ ):
shutil.copy(p, context.repository, follow_symlinks=True)
return dataclasses.replace(cls.default(), **{k: v for k, v in j.items() if k in cls.fields()})
-PACKAGE_GLOBS = (
- "*.rpm",
- "*.pkg.tar*",
- "*.deb",
- "*.ddeb",
- "*.apk",
-)
-
-
@dataclasses.dataclass(frozen=True)
class UKIProfile:
profile: dict[str, str]
"package_directories": [
(p.name, p.stat().st_mtime_ns)
for d in self.package_directories
- for p in sorted(flatten(d.glob(glob) for glob in PACKAGE_GLOBS))
+ for p in sorted(
+ flatten(d.glob(glob) for glob in self.distribution.package_manager(self).package_globs())
+ )
],
"repositories": sorted(self.repositories),
"overlay": self.overlay,
def package_subdirs(cls, cache: Path) -> list[tuple[Path, Path]]:
return []
+ @classmethod
+ def package_globs(cls) -> list[str]:
+ return []
+
@classmethod
def state_subdirs(cls, state: Path) -> list[Path]:
return []
def package_subdirs(cls, cache: Path) -> list[tuple[Path, Path]]:
return [(Path("."), Path("."))]
+ @classmethod
+ def package_globs(cls) -> list[str]:
+ return ["*.apk"]
+
@classmethod
def scripts(cls, context: Context) -> dict[str, list[PathString]]:
return {
from pathlib import Path
from typing import Final, Optional
-from mkosi.config import PACKAGE_GLOBS, Config, ConfigFeature
+from mkosi.config import Config, ConfigFeature
from mkosi.context import Context
from mkosi.installer import PackageManager
from mkosi.log import die
def package_subdirs(cls, cache: Path) -> list[tuple[Path, Path]]:
return [(Path("archives"), Path("archives"))]
+ @classmethod
+ def package_globs(cls) -> list[str]:
+ return ["*.deb", "*.ddeb"]
+
@classmethod
def state_subdirs(cls, state: Path) -> list[Path]:
return [state / "lists"]
@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]
+ names = [d.name for glob in cls.package_globs() for d in context.repository.glob(glob)]
if not names:
return
for d in dirs
]
+ @classmethod
+ def package_globs(cls) -> list[str]:
+ return ["*.rpm"]
+
@classmethod
def scripts(cls, context: Context) -> dict[str, list[PathString]]:
return {
def package_subdirs(cls, cache: Path) -> list[tuple[Path, Path]]:
return [(Path("pkg"), Path("pkg"))]
+ @classmethod
+ def package_globs(cls) -> list[str]:
+ return ["*.pkg.tar"]
+
@classmethod
def state_subdirs(cls, state: Path) -> list[Path]:
return [state / "sync"]
def package_subdirs(cls, cache: Path) -> list[tuple[Path, Path]]:
return [(Path("packages"), Path("packages"))]
+ @classmethod
+ def package_globs(cls) -> list[str]:
+ return ["*.rpm"]
+
@classmethod
def scripts(cls, context: Context) -> dict[str, list[PathString]]:
install: list[PathString] = [