From ccbcd8ce4ec42d7d5d599d46cb32e95d2e627910 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sep 28 2021 17:16:17 +0000 Subject: Backport fix to make dnf vars load properly (#1847124) --- diff --git a/SOURCES/0001-dnf-Load-all-the-repos-and-vars-directories.patch b/SOURCES/0001-dnf-Load-all-the-repos-and-vars-directories.patch new file mode 100644 index 0000000..ac40d4d --- /dev/null +++ b/SOURCES/0001-dnf-Load-all-the-repos-and-vars-directories.patch @@ -0,0 +1,81 @@ +From fe460068335b4cfe89197b42b1b7e30b84e8ea07 Mon Sep 17 00:00:00 2001 +From: Neal Gompa +Date: Tue, 28 Apr 2020 22:00:04 -0400 +Subject: [PATCH] dnf: Load all the repos and vars directories + +Historically, the backend has internally determined its setup with +static values. However, we generally want PackageKit to load all +repositories defined in all repository directories that DNF normally +searches, since it is not guaranteed to be in /etc/yum.repos.d and +DNF supports multiple repository configuration paths. + +We also need the vars to be loaded so that repository definitions +that rely on more than the built-in vars will work. + +This bumps our dependency for libdnf to 0.43.1, as we're using APIs +introduced in this release. + +(Backport note: to avoid regenerating autofoo, the configure.ac change +has been stripped.) + +(cherry picked from commit ed73aa6317595d2c2f1bda7990cbd64efb133f84) +--- + backends/dnf/pk-backend-dnf.c | 27 ++++++++++++++++++++++++--- + 1 files changed, 24 insertions(+), 3 deletions(-) + +diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c +index 779896c2d..7fcdaddbe 100644 +--- a/backends/dnf/pk-backend-dnf.c ++++ b/backends/dnf/pk-backend-dnf.c +@@ -137,11 +137,12 @@ pk_backend_context_invalidate_cb (DnfContext *context, + static gboolean + pk_backend_setup_dnf_context (DnfContext *context, GKeyFile *conf, const gchar *release_ver, GError **error) + { ++ const gchar * const *repo_dirs; ++ const gchar * const *var_dirs; + gboolean keep_cache; + g_autofree gchar *cache_dir = NULL; + g_autofree gchar *destdir = NULL; + g_autofree gchar *lock_dir = NULL; +- g_autofree gchar *repo_dir = NULL; + g_autofree gchar *solv_dir = NULL; + + destdir = g_key_file_get_string (conf, "Daemon", "DestDir", NULL); +@@ -152,12 +153,32 @@ pk_backend_setup_dnf_context (DnfContext *context, GKeyFile *conf, const gchar * + dnf_context_set_cache_dir (context, cache_dir); + solv_dir = g_build_filename (destdir, "/var/cache/PackageKit", release_ver, "hawkey", NULL); + dnf_context_set_solv_dir (context, solv_dir); +- repo_dir = g_build_filename (destdir, "/etc/yum.repos.d", NULL); +- dnf_context_set_repo_dir (context, repo_dir); + lock_dir = g_build_filename (destdir, "/var/run", NULL); + dnf_context_set_lock_dir (context, lock_dir); + dnf_context_set_rpm_verbosity (context, "info"); + ++ /* Add prefix to repo directories */ ++ repo_dirs = dnf_context_get_repos_dir (context); ++ if (repo_dirs != NULL && repo_dirs[0] != NULL) { ++ g_auto(GStrv) full_repo_dirs = NULL; ++ guint len = g_strv_length ((gchar **)repo_dirs); ++ full_repo_dirs = g_new0 (gchar*, len + 1); ++ for (guint i = 0; i < len; i++) ++ full_repo_dirs[i] = g_build_filename (destdir, repo_dirs[i], NULL); ++ dnf_context_set_repos_dir (context, (const gchar * const*)full_repo_dirs); ++ } ++ ++ /* Add prefix to var directories */ ++ var_dirs = dnf_context_get_vars_dir (context); ++ if (var_dirs != NULL && var_dirs[0] != NULL) { ++ g_auto(GStrv) full_var_dirs = NULL; ++ guint len = g_strv_length ((gchar **)var_dirs); ++ full_var_dirs = g_new0 (gchar*, len + 1); ++ for (guint i = 0; i < len; i++) ++ full_var_dirs[i] = g_build_filename (destdir, var_dirs[i], NULL); ++ dnf_context_set_vars_dir (context, (const gchar * const*)full_var_dirs); ++ } ++ + /* use this initial data if repos are not present */ + dnf_context_set_vendor_cache_dir (context, "/usr/share/PackageKit/metadata"); + dnf_context_set_vendor_solv_dir (context, "/usr/share/PackageKit/hawkey"); +-- +2.32.0 + diff --git a/SPECS/PackageKit.spec b/SPECS/PackageKit.spec index c37d59c..8478846 100644 --- a/SPECS/PackageKit.spec +++ b/SPECS/PackageKit.spec @@ -4,7 +4,7 @@ %global bundled_libdnf 0 %global glib2_version 2.54.0 -%global libdnf_version 0.22.0 +%global libdnf_version 0.43.1 %if 0%{?bundled_libdnf} %global commit1 fe5a08bca7e2599798af7778917da2cc31f1460e @@ -14,7 +14,7 @@ Summary: Package management service Name: PackageKit Version: 1.1.12 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ and LGPLv2+ URL: http://www.freedesktop.org/software/PackageKit/ Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz @@ -38,6 +38,9 @@ Patch3: 0001-command-not-found-Don-t-use-a-bash-regex-to-fix-othe.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1814820 Patch4: revert-shutdown-on-idle.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1847124 +Patch5: 0001-dnf-Load-all-the-repos-and-vars-directories.patch + BuildRequires: glib2-devel >= %{glib2_version} BuildRequires: xmlto BuildRequires: gtk-doc @@ -338,6 +341,9 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || : %{_datadir}/vala/vapi/packagekit-glib2.vapi %changelog +* Tue Sep 28 2021 Neal Gompa - 1.1.12-7 +- Backport fix to make dnf vars load properly (#1847124) + * Fri May 22 2020 Michael Catanzaro - 1.1.12-6 - Fix documentation links in Vendor.conf - Resolves: #1837648