]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
opensuse: Force rpm ndb backend 3081/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 30 Sep 2024 12:23:35 +0000 (14:23 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 30 Sep 2024 12:29:58 +0000 (14:29 +0200)
OpenSUSE's rpm is not built with the sqlite db backend so let's make
sure the rpm DB can be read inside the image by OpenSUSE's rpm by
forcing the ndb backend to be used.

mkosi/distributions/opensuse.py
mkosi/installer/rpm.py

index eab65f1ef32e678aa3db79c89d752c5d73d87625..6ab0bf3315fe28973f48442a6f56532f5a9f69cb 100644 (file)
@@ -49,7 +49,7 @@ class Installer(DistributionInstaller):
 
     @classmethod
     def setup(cls, context: Context) -> None:
-        setup_rpm(context)
+        setup_rpm(context, dbbackend="ndb")
 
         zypper = context.config.find_binary("zypper")
         if zypper:
index e7c3e37f5d0565d10ecbcbd5a77afbb71338ac6d..3f27a7d66972e27db3fc1f01a637c927d6a7b76d 100644 (file)
@@ -63,7 +63,12 @@ def find_rpm_gpgkey(
     return None
 
 
-def setup_rpm(context: Context, *, dbpath: str = "/usr/lib/sysimage/rpm") -> None:
+def setup_rpm(
+    context: Context,
+    *,
+    dbpath: str = "/usr/lib/sysimage/rpm",
+    dbbackend: Optional[str] = None,
+) -> None:
     confdir = context.sandbox_tree / "etc/rpm"
     confdir.mkdir(parents=True, exist_ok=True)
     if not (confdir / "macros.lang").exists() and context.config.locale:
@@ -72,6 +77,9 @@ def setup_rpm(context: Context, *, dbpath: str = "/usr/lib/sysimage/rpm") -> Non
     if not (confdir / "macros.dbpath").exists():
         (confdir / "macros.dbpath").write_text(f"%_dbpath {dbpath}")
 
+    if dbbackend:
+        (confdir / "macros.db_backend").write_text(f"%_db_backend {dbbackend}")
+
     plugindir = Path(
         run(
             ["rpm", "--eval", "%{__plugindir}"],