[Libguestfs] [supermin PATCH] rpm: check for SQLite-based RPM DB

Pino Toscano ptoscano at redhat.com
Wed Aug 26 16:57:43 UTC 2020


Fedora 33 switched the DB of RPM to SQLite, so no more Packages/Name/etc
files. Because any missing file exception is ignored when checking for
--if-newer, the lack of the Package files was not properly noticed, so
the appliance was always considered out out date.

Check for the SQLite-based DB first, falling back to the old format.

Signed-off-by: Pino Toscano <ptoscano at redhat.com>
---
 src/ph_rpm.ml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
index dbe3bda..0821126 100644
--- a/src/ph_rpm.ml
+++ b/src/ph_rpm.ml
@@ -234,7 +234,10 @@ let rpm_package_name pkg =
   rpm.name
 
 let rpm_get_package_database_mtime () =
-  (lstat "/var/lib/rpm/Packages").st_mtime
+  try
+    (lstat "/var/lib/rpm/rpmdb.sqlite").st_mtime
+  with Unix_error (ENOENT, _, _) ->
+    (lstat "/var/lib/rpm/Packages").st_mtime
 
 (* Return the best provider of a particular RPM requirement.
  *
-- 
2.26.2




More information about the Libguestfs mailing list