From: Daan De Meyer Date: Sat, 2 Dec 2023 09:04:55 +0000 (+0100) Subject: Configure rpm _install_langs if locale is configured X-Git-Tag: v20~114^2~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=caba7867da1fa92c06944dc65d8fe76a2c6bbba3;p=thirdparty%2Fmkosi.git Configure rpm _install_langs if locale is configured If the _install_langs macro is defined, rpm will only install locale data corresponding to the locales in _install_langs. If Locale= is set and macros.lang doesn't exist already, let's configure it ourselves with _install_langs to save on disk space. --- diff --git a/mkosi/installer/dnf.py b/mkosi/installer/dnf.py index 08bfea87e..345b647f9 100644 --- a/mkosi/installer/dnf.py +++ b/mkosi/installer/dnf.py @@ -95,8 +95,12 @@ def setup_dnf(state: MkosiState, repos: Iterable[Repo], filelists: bool = True) f.write("\n") + macros = state.pkgmngr / "usr/lib/rpm/macros.d" + macros.mkdir(parents=True, exist_ok=True) + if not (macros / "macros.lang").exists() and state.config.locale: + (macros / "macros.lang").write_text(f"%_install_langs {state.config.locale}") + rpmconfigdir = Path(run(["rpm", "--eval", "%{_rpmconfigdir}"], stdout=subprocess.PIPE).stdout.strip()) - (state.pkgmngr / "usr/lib").mkdir(parents=True, exist_ok=True) copy_tree(state.config, rpmconfigdir, state.pkgmngr / "usr/lib/rpm", clobber=False)