From: Daan De Meyer Date: Fri, 14 Jul 2023 13:00:46 +0000 (+0200) Subject: Fix logdir handling for dnf X-Git-Tag: v15~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c79599e8bf63207a30c35647764063c3506ceb5;p=thirdparty%2Fmkosi.git Fix logdir handling for dnf logdir= is always taken relative to the installroot. Let's leave it at it's default value and remove any log files from the install root after running dnf. --- diff --git a/mkosi/distributions/fedora.py b/mkosi/distributions/fedora.py index f8509e264..3be11ae60 100644 --- a/mkosi/distributions/fedora.py +++ b/mkosi/distributions/fedora.py @@ -170,7 +170,6 @@ def invoke_dnf( state.pkgmngr.joinpath("etc/dnf/vars").mkdir(exist_ok=True, parents=True) state.pkgmngr.joinpath("etc/yum.repos.d").mkdir(exist_ok=True, parents=True) - state.pkgmngr.joinpath("var/log").mkdir(exist_ok=True, parents=True) state.pkgmngr.joinpath("var/lib/dnf").mkdir(exist_ok=True, parents=True) # dnf5 does not support building for foreign architectures yet (missing --forcearch) @@ -189,7 +188,6 @@ def invoke_dnf( f"--setopt=cachedir={state.cache_dir}", f"--setopt=reposdir={state.pkgmngr / 'etc/yum.repos.d'}", f"--setopt=varsdir={state.pkgmngr / 'etc/dnf/vars'}", - f"--setopt=logdir={state.pkgmngr / 'var/log'}", f"--setopt=persistdir={state.pkgmngr / 'var/lib/dnf'}", "--setopt=check_config_file_age=0", "--no-plugins" if dnf.endswith("dnf5") else "--noplugins", @@ -232,6 +230,12 @@ def invoke_dnf( fixup_rpmdb_location(state.root) + # The log directory is always interpreted relative to the install root so there's nothing we can do but + # to remove the log files from the install root afterwards. + for p in (state.root / "var/log").iterdir(): + if p.name.startswith("dnf"): + p.unlink() + def fixup_rpmdb_location(root: Path) -> None: distribution, _ = detect_distribution()