From: Daan De Meyer Date: Tue, 16 May 2023 09:16:28 +0000 (+0200) Subject: Various dnf fixes X-Git-Tag: v15~155 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d0a86234188799cdc7944ffeee0087daa2397cc;p=thirdparty%2Fmkosi.git Various dnf fixes - Put the logs in a subdirectory of the workspace - Make sure we configure the persistdir to be inside the workspace as well. Otherwise dnf5 tries to use the system directory which fails with a permission error - Use the non-compat dnf5 option names instead of the compat ones --- diff --git a/mkosi/distributions/fedora.py b/mkosi/distributions/fedora.py index 909a7b0d2..d22888e42 100644 --- a/mkosi/distributions/fedora.py +++ b/mkosi/distributions/fedora.py @@ -135,6 +135,8 @@ def invoke_dnf( release = state.config.release state.workspace.joinpath("vars").mkdir(exist_ok=True) + state.workspace.joinpath("log").mkdir(exist_ok=True) + state.workspace.joinpath("persist").mkdir(exist_ok=True) dnf = shutil.which("dnf5") or shutil.which("dnf") or "yum" @@ -152,9 +154,10 @@ def invoke_dnf( f"--setopt=cachedir={state.cache}", f"--setopt=reposdir={' '.join(str(p) for p in state.config.repo_dirs)}", f"--setopt=varsdir={state.workspace / 'vars'}", - f"--setopt=logdir={state.workspace}", + f"--setopt=logdir={state.workspace / 'log'}", + f"--setopt=persistdir={state.workspace / 'persist'}", "--setopt=check_config_file_age=0", - "--noplugins", + "--no-plugins" if shutil.which("dnf5") else "--noplugins", ] # Make sure we download filelists so all dependencies can be resolved. @@ -168,7 +171,8 @@ def invoke_dnf( cmdline += ["--nogpgcheck"] if state.config.repositories: - cmdline += [f"--enablerepo={repo}" for repo in state.config.repositories] + opt = "--enable-repo" if shutil.which("dnf5") else "--enablerepo" + cmdline += [f"{opt}={repo}" for repo in state.config.repositories] # TODO: this breaks with a local, offline repository created with 'createrepo' if state.config.cache_only and not state.config.local_mirror: @@ -178,7 +182,7 @@ def invoke_dnf( cmdline += [f"--forcearch={state.config.architecture}"] if not state.config.with_docs: - cmdline += ["--nodocs"] + cmdline += ["--no-docs" if shutil.which("dnf5") else "--nodocs"] cmdline += sort_packages(packages)