From: Daan De Meyer Date: Tue, 25 Feb 2025 17:46:16 +0000 (+0100) Subject: Enable Hyperscale rpm COW plugin X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3553%2Fhead;p=thirdparty%2Fmkosi.git Enable Hyperscale rpm COW plugin The CentOS Hyperscale SIG provides rpm/dnf plugins to enable rpm COW which drastically speeds up image builds so let's ship the necessary logic to make use of it when building images with the Hyperscale experimental repositories. --- diff --git a/mkosi/installer/dnf.py b/mkosi/installer/dnf.py index af5de1452..13b97edff 100644 --- a/mkosi/installer/dnf.py +++ b/mkosi/installer/dnf.py @@ -62,6 +62,20 @@ class Dnf(PackageManager): if cls.executable(context.config) == "dnf5" and filelists: f.write("[main]\noptional_metadata_types=filelists\n") + # The CentOS Hyperscale ships a COW plugin for dnf that's disabled by default. Let's enable it so we + # can take advantage of faster rpm package installations. + reflink = context.sandbox_tree / "etc/dnf/plugins/reflink.conf" + if not reflink.exists(): + reflink.parent.mkdir(parents=True, exist_ok=True) + reflink.write_text( + textwrap.dedent( + """\ + [main] + enabled=1 + """ + ) + ) + # The versionlock plugin will fail if enabled without a configuration file so lets' write a noop # configuration file to make it happy which can be overridden by users. versionlock = context.sandbox_tree / "etc/dnf/plugins/versionlock.conf" @@ -140,7 +154,7 @@ class Dnf(PackageManager): "--disable-plugin=*" if dnf == "dnf5" else "--disableplugin=*", ] # fmt: skip - for plugin in ("builddep", "versionlock"): + for plugin in ("builddep", "versionlock", "reflink"): cmdline += ["--enable-plugin", plugin] if dnf == "dnf5" else ["--enableplugin", plugin] if ARG_DEBUG.get(): diff --git a/mkosi/resources/mkosi-tools/mkosi.conf.d/centos/mkosi.conf.d/20-hyperscale-experimental-packages.conf b/mkosi/resources/mkosi-tools/mkosi.conf.d/centos/mkosi.conf.d/20-hyperscale-experimental-packages.conf new file mode 100644 index 000000000..4ddeff6f9 --- /dev/null +++ b/mkosi/resources/mkosi-tools/mkosi.conf.d/centos/mkosi.conf.d/20-hyperscale-experimental-packages.conf @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Repositories=hyperscale-packages-experimental + +[Content] +Packages= + rpm-plugin-reflink + python3-dnf-plugin-cow