feat: track Decman configuration
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"""Package concern loading for Decman profiles."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import decman
|
||||
from decman.plugins import aur, pacman
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
PACKAGES = ROOT / "packages"
|
||||
|
||||
|
||||
def _names(path: Path) -> set[str]:
|
||||
return {
|
||||
line.strip()
|
||||
for line in path.read_text(encoding="utf-8").splitlines()
|
||||
if line.strip()
|
||||
}
|
||||
|
||||
|
||||
class PackageConcern(decman.Module):
|
||||
"""One named concern backed by native and AUR package lists."""
|
||||
|
||||
def __init__(self, concern: str) -> None:
|
||||
super().__init__(f"packages:{concern}")
|
||||
self.concern = concern
|
||||
|
||||
@pacman.packages
|
||||
def native_packages(self) -> set[str]:
|
||||
return _names(PACKAGES / f"{self.concern}-repo.txt")
|
||||
|
||||
@aur.packages
|
||||
def aur_packages(self) -> set[str]:
|
||||
return _names(PACKAGES / f"{self.concern}-aur.txt")
|
||||
|
||||
|
||||
def configure_no_removal_guard() -> None:
|
||||
"""Keep Decman from pruning current dependency-orphans during adoption."""
|
||||
if decman.pacman is None or decman.aur is None:
|
||||
raise decman.SourceError("pacman and AUR plugins must be available")
|
||||
decman.pacman.ignored_packages |= _names(PACKAGES / "ignored/repo-dependencies.txt")
|
||||
decman.aur.ignored_packages |= _names(PACKAGES / "ignored/aur-dependencies.txt")
|
||||
Reference in New Issue
Block a user