From 76518a0cb5efdcc67fe6ae4f5526a6eb3f8b2248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E7=A5=81?= Date: Thu, 22 Mar 2018 20:06:21 +0800 Subject: [PATCH] Fix #362 : try to detect data.mdb for lmdb also --- libdnf/dnf-context.cpp | 14 +++++++++++--- libdnf/dnf-sack.cpp | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp index 076285963e..1d74c26132 100644 --- a/libdnf/dnf-context.cpp +++ b/libdnf/dnf-context.cpp @@ -1570,14 +1570,22 @@ dnf_context_setup(DnfContext *context, /* 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); + rpmdb_path = g_build_filename(priv->install_root, "var/lib/rpm/data.mdb", NULL); file_rpmdb = g_file_new_for_path(rpmdb_path); priv->monitor_rpmdb = g_file_monitor_file(file_rpmdb, G_FILE_MONITOR_NONE, NULL, error); - if (priv->monitor_rpmdb == NULL) - return FALSE; + if (priv->monitor_rpmdb == NULL) { + 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, + NULL, + error); + if (priv->monitor_rpmdb == NULL) + return FALSE; + } g_signal_connect(priv->monitor_rpmdb, "changed", G_CALLBACK(dnf_context_rpmdb_changed_cb), context); } diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp index a645f51c9c..fd301088fb 100644 --- a/libdnf/dnf-sack.cpp +++ b/libdnf/dnf-sack.cpp @@ -200,7 +200,8 @@ 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/data.mdb", + "/var/lib/rpm/Packages", "/usr/share/rpm/Packages" }; unsigned int i; const char *fn;