]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Enable Hyperscale rpm COW plugin 3553/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Feb 2025 17:46:16 +0000 (18:46 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Feb 2025 18:20:46 +0000 (19:20 +0100)
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.

mkosi/installer/dnf.py
mkosi/resources/mkosi-tools/mkosi.conf.d/centos/mkosi.conf.d/20-hyperscale-experimental-packages.conf [new file with mode: 0644]

index af5de14525924e1b3f6105ae481a281b89e2d546..13b97edff539a7034f0ab358669289be87825b63 100644 (file)
@@ -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 (file)
index 0000000..4ddeff6
--- /dev/null
@@ -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