From: Daan De Meyer Date: Tue, 16 May 2023 12:17:58 +0000 (+0200) Subject: Use slightly better dnf5 check X-Git-Tag: v15~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ccb4350c662e66c300f2a6d9fa4441511cbee49;p=thirdparty%2Fmkosi.git Use slightly better dnf5 check Instead of checking whether dnf5 exists all the time, just reuse the first check results --- diff --git a/mkosi/distributions/fedora.py b/mkosi/distributions/fedora.py index d22888e42..e4b885caa 100644 --- a/mkosi/distributions/fedora.py +++ b/mkosi/distributions/fedora.py @@ -157,7 +157,7 @@ def invoke_dnf( f"--setopt=logdir={state.workspace / 'log'}", f"--setopt=persistdir={state.workspace / 'persist'}", "--setopt=check_config_file_age=0", - "--no-plugins" if shutil.which("dnf5") else "--noplugins", + "--no-plugins" if dnf.endswith("dnf5") else "--noplugins", ] # Make sure we download filelists so all dependencies can be resolved. @@ -171,7 +171,7 @@ def invoke_dnf( cmdline += ["--nogpgcheck"] if state.config.repositories: - opt = "--enable-repo" if shutil.which("dnf5") else "--enablerepo" + opt = "--enable-repo" if dnf.endswith("dnf5") else "--enablerepo" cmdline += [f"{opt}={repo}" for repo in state.config.repositories] # TODO: this breaks with a local, offline repository created with 'createrepo' @@ -182,7 +182,7 @@ def invoke_dnf( cmdline += [f"--forcearch={state.config.architecture}"] if not state.config.with_docs: - cmdline += ["--no-docs" if shutil.which("dnf5") else "--nodocs"] + cmdline += ["--no-docs" if dnf.endswith("dnf5") else "--nodocs"] cmdline += sort_packages(packages)