From: Joerg Behrmann Date: Wed, 7 Jun 2023 09:15:23 +0000 (+0200) Subject: debian: move workspace package manager configuration into a tree X-Git-Tag: v15~120^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=493829483f119d70bd54a9701d69f3fc84edf5f9;p=thirdparty%2Fmkosi.git debian: move workspace package manager configuration into a tree --- diff --git a/mkosi/distributions/debian.py b/mkosi/distributions/debian.py index 5ee962a26..e5e4ec5f2 100644 --- a/mkosi/distributions/debian.py +++ b/mkosi/distributions/debian.py @@ -159,11 +159,12 @@ class DebianInstaller(DistributionInstaller): def setup_apt(state: MkosiState, repos: Sequence[str]) -> None: - state.workspace.joinpath("apt").mkdir(exist_ok=True) - state.workspace.joinpath("apt/apt.conf.d").mkdir(exist_ok=True) - state.workspace.joinpath("apt/preferences.d").mkdir(exist_ok=True) - state.workspace.joinpath("apt/sources.list.d").mkdir(exist_ok=True) - state.workspace.joinpath("apt/log").mkdir(exist_ok=True) + state.pkgmngr.joinpath("etc/apt").mkdir(exist_ok=True, parents=True) + state.pkgmngr.joinpath("etc/apt/apt.conf.d").mkdir(exist_ok=True, parents=True) + state.pkgmngr.joinpath("etc/apt/preferences.d").mkdir(exist_ok=True, parents=True) + state.pkgmngr.joinpath("etc/apt/sources.list.d").mkdir(exist_ok=True, parents=True) + state.pkgmngr.joinpath("var/log/apt").mkdir(exist_ok=True, parents=True) + state.pkgmngr.joinpath("var/lib/apt").mkdir(exist_ok=True, parents=True) # TODO: Drop once apt 2.5.4 is widely available. state.root.joinpath("var").mkdir(mode=0o755, exist_ok=True) @@ -171,7 +172,7 @@ def setup_apt(state: MkosiState, repos: Sequence[str]) -> None: state.root.joinpath("var/lib/dpkg").mkdir(mode=0o755, exist_ok=True) state.root.joinpath("var/lib/dpkg/status").touch() - config = state.workspace / "apt/apt.conf" + config = state.pkgmngr / "etc/apt/apt.conf" debarch = state.installer.architecture(state.config.architecture) config.write_text( @@ -187,16 +188,16 @@ def setup_apt(state: MkosiState, repos: Sequence[str]) -> None: APT::Get::Allow-Remove-Essential "true"; APT::Sandbox::User "root"; Dir::Cache "{state.cache_dir}"; - Dir::State "{state.workspace / "apt"}"; + Dir::State "{state.pkgmngr / "var/lib/apt"}"; Dir::State::status "{state.root / "var/lib/dpkg/status"}"; - Dir::Etc "{state.workspace / "apt"}"; + Dir::Etc "{state.pkgmngr / "etc/apt"}"; Dir::Etc::trusted "/usr/share/keyrings/{state.config.release}-archive-keyring"; Dir::Etc::trustedparts "/usr/share/keyrings"; - Dir::Log "{state.workspace / "apt/log"}"; + Dir::Log "{state.pkgmngr / "var/log/apt"}"; Dir::Bin::dpkg "{shutil.which("dpkg")}"; Debug::NoLocking "true"; DPkg::Options:: "--root={state.root}"; - DPkg::Options:: "--log={state.workspace / "apt/dpkg.log"}"; + DPkg::Options:: "--log={state.pkgmngr / "var/log/apt/dpkg.log"}"; DPkg::Options:: "--force-unsafe-io"; DPkg::Options:: "--force-architecture"; DPkg::Options:: "--force-depends"; @@ -207,7 +208,7 @@ def setup_apt(state: MkosiState, repos: Sequence[str]) -> None: ) ) - with state.workspace.joinpath("apt/sources.list").open("w") as f: + with state.workspace.joinpath("pkgmngr/etc/apt/sources.list").open("w") as f: for repo in repos: f.write(f"{repo}\n") @@ -216,7 +217,7 @@ def setup_apt(state: MkosiState, repos: Sequence[str]) -> None: if not src.is_file(): continue if src.suffix in (".list", ".sources"): - shutil.copyfile(src, state.workspace.joinpath("apt/sources.list.d", src.name)) + shutil.copyfile(src, state.workspace.joinpath("pkgmngr/etc/apt/sources.list.d", src.name)) def invoke_apt( @@ -226,7 +227,7 @@ def invoke_apt( apivfs: bool = True, ) -> CompletedProcess: env: dict[str, PathString] = dict( - APT_CONFIG=state.workspace / "apt/apt.conf", + APT_CONFIG=state.pkgmngr / "etc/apt/apt.conf", DEBIAN_FRONTEND="noninteractive", DEBCONF_INTERACTIVE_SEEN="true", KERNEL_INSTALL_BYPASS="1", @@ -247,7 +248,7 @@ def install_apt_sources(state: MkosiState, repos: Sequence[str]) -> None: f.write(f"{repo}\n") # Already contains a merged tree of repo_dirs after setup_apt - for src in state.workspace.joinpath("apt/sources.list.d").iterdir(): + for src in state.workspace.joinpath("pkgmngr/etc/apt/sources.list.d").iterdir(): dst = state.root.joinpath("etc/apt/sources.list.d", src.name) if dst.exists(): continue