Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2:Staging:N
libdnf
libdnf-0.45.0-handle-all-rpmdb-variants.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libdnf-0.45.0-handle-all-rpmdb-variants.patch of Package libdnf
From 9584c58876fb571f1d8817e51c4c275f033b3417 Mon Sep 17 00:00:00 2001 From: Neal Gompa <ngompa13@gmail.com> 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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor