Hello community, here is the log from the commit of package libdnf for openSUSE:Factory checked in at 2020-03-27 21:54:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libdnf (Old) and /work/SRC/openSUSE:Factory/.libdnf.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libdnf" Fri Mar 27 21:54:52 2020 rev:14 rq:787280 version:0.45.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libdnf/libdnf.changes 2020-02-27 16:57:41.954843785 +0100 +++ /work/SRC/openSUSE:Factory/.libdnf.new.3160/libdnf.changes 2020-03-27 21:54:53.850708993 +0100 @@ -1,0 +2,6 @@ +Sun Mar 22 14:47:59 UTC 2020 - Neal Gompa <[email protected]> + +- Add patch to support monitoring non-bdb rpmdb variants + + Patch: libdnf-0.45.0-handle-all-rpmdb-variants.patch + +------------------------------------------------------------------- New: ---- libdnf-0.45.0-handle-all-rpmdb-variants.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libdnf.spec ++++++ --- /var/tmp/diff_new_pack.e5TF4V/_old 2020-03-27 21:54:54.590709423 +0100 +++ /var/tmp/diff_new_pack.e5TF4V/_new 2020-03-27 21:54:54.590709423 +0100 @@ -45,6 +45,8 @@ Patch1000: libdnf-0.39.1-with-static-libsolvext.patch # PATCH-FIX-OPENSUSE: Switch default reposdir to /etc/dnf/repos.d Patch1001: libdnf-0.39.1-Switch-default-reposdir-to-etc-dnf-repos.d.patch +# PATCH-FIX-OPENSUSE: Handle monitoring non-bdb rpmdb variants +Patch1002: libdnf-0.45.0-handle-all-rpmdb-variants.patch BuildRequires: cmake BuildRequires: gcc ++++++ libdnf-0.45.0-handle-all-rpmdb-variants.patch ++++++ >From 9584c58876fb571f1d8817e51c4c275f033b3417 Mon Sep 17 00:00:00 2001 From: Neal Gompa <[email protected]> Date: Wed, 18 Mar 2020 08:02:48 -0400 Subject: [PATCH] context, sack: Support all rpmdb path variants We rely on identifying whether the rpmdb path has changed to determine whether we need to re-cache data from there. Now that RPM has multiple rpmdb options and there are two common paths in use by RPM-based systems, we need to handle all of these. --- libdnf/dnf-context.cpp | 23 ++++++++++++++++++++++- libdnf/dnf-sack.cpp | 9 ++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp index e69213ba..17c1d496 100644 --- a/libdnf/dnf-context.cpp +++ b/libdnf/dnf-context.cpp @@ -2094,6 +2094,15 @@ dnf_context_setup(DnfContext *context, g_autoptr(GString) buf = NULL; g_autofree char *rpmdb_path = NULL; g_autoptr(GFile) file_rpmdb = NULL; + const gchar *rpmdb_path_variants[] = { "var/lib/rpm/rpmdb.sqlite", + "usr/lib/sysimage/rpm/rpmdb.sqlite", + "var/lib/rpm/Packages.db", + "usr/lib/sysimage/rpm/Packages.db", + "var/lib/rpm/Packages", + "usr/lib/sysimage/rpm/Packages", + "var/lib/rpm/data.mdb", + "usr/lib/sysimage/rpm/data.mdb", + NULL }; if (libdnf::getGlobalMainConfig().plugins().getValue() && !pluginsDir.empty()) { priv->plugins->loadPlugins(pluginsDir); @@ -2177,9 +2186,21 @@ dnf_context_setup(DnfContext *context, !dnf_context_set_os_release(context, error)) return FALSE; + /* identify correct rpmdb file */ + for (i = 0; rpmdb_path_variants[i] != NULL; i++) { + rpmdb_path = g_build_filename(priv->install_root, rpmdb_path_variants[i], NULL); + if (g_file_test(rpmdb_path, G_FILE_TEST_EXISTS)) + break; + rpmdb_path = NULL; + } + + /* if we can't identify an rpmdb path for any reason, fallback to legacy value */ + if (rpmdb_path == NULL) { + rpmdb_path = g_build_filename(priv->install_root, "var/lib/rpm/Packages", NULL); + } + /* setup a file monitor on the rpmdb, if we're operating on the native / */ if (g_strcmp0(priv->install_root, "/") == 0) { - rpmdb_path = g_build_filename(priv->install_root, "var/lib/rpm/Packages", NULL); file_rpmdb = g_file_new_for_path(rpmdb_path); priv->monitor_rpmdb = g_file_monitor_file(file_rpmdb, G_FILE_MONITOR_NONE, diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp index b281f590..0ecf4fc9 100644 --- a/libdnf/dnf-sack.cpp +++ b/libdnf/dnf-sack.cpp @@ -226,7 +226,14 @@ dnf_sack_new(void) static int current_rpmdb_checksum(Pool *pool, unsigned char csout[CHKSUM_BYTES]) { - const char *rpmdb_prefix_paths[] = { "/var/lib/rpm/Packages", + const char *rpmdb_prefix_paths[] = { "/var/lib/rpm/rpmdb.sqlite", + "/usr/lib/sysimage/rpm/rpmdb.sqlite", + "/var/lib/rpm/Packages.db", + "/usr/lib/sysimage/rpm/Packages.db", + "/var/lib/rpm/Packages", + "/usr/lib/sysimage/rpm/Packages", + "/var/lib/rpm/data.mdb", + "/usr/lib/sysimage/rpm/data.mdb", "/usr/share/rpm/Packages" }; unsigned int i; const char *fn; -- 2.25.0
