Fix sack initialization to enable postponed addition of filelists

Resolves: RHEL-12355
This commit is contained in:
Petr Písař 2024-07-02 15:30:58 +02:00
parent 176677f423
commit b20b2dbef5
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From a6d89d66698f75c01539cd03c04a87ab52b6db7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Tue, 25 Jun 2024 13:38:14 +0200
Subject: [PATCH] Set pool flag to fix pool_addfileprovides_queue() without
filelists.xml
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since dnf4 now also conditionally load filelists it ran into the same
problem as dnf5 here: https://github.com/rpm-software-management/dnf5/issues/520
Additional details in: https://github.com/openSUSE/libsolv/pull/531
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
libdnf/dnf-sack.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
index 3c3a7657..e95009fb 100644
--- a/libdnf/dnf-sack.cpp
+++ b/libdnf/dnf-sack.cpp
@@ -185,6 +185,13 @@ dnf_sack_init(DnfSack *sack)
DnfSackPrivate *priv = GET_PRIVATE(sack);
priv->pool = pool_create();
pool_set_flag(priv->pool, POOL_FLAG_WHATPROVIDESWITHDISABLED, 1);
+
+ // Configures the pool_addfileprovides_queue() method to only add files from primary.xml.
+ // This ensures the method works correctly even if filelist.xml metadata are not loaded.
+ // At the same time when filelist.xml are loaded libsolv is able to search them for required
+ // files if needed.
+ pool_set_flag(priv->pool, POOL_FLAG_ADDFILEPROVIDESFILTERED, 1);
+
priv->running_kernel_id = -1;
priv->running_kernel_fn = running_kernel;
priv->considered_uptodate = TRUE;
--
2.45.2

View File

@ -56,7 +56,7 @@
Name: libdnf
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Library providing simplified C and Python API to libsolv
License: LGPL-2.1-or-later
URL: https://github.com/rpm-software-management/libdnf
@ -64,6 +64,7 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-context-use-rpmtsAddReinstallElement-when-doing-a-re.patch
Patch2: 0002-Since-we-use-rpmtsAddReinstallElement-rpm-also-unins.patch
Patch3: 0003-MergedTransaction-Fix-invalid-memory-access-when-dro.patch
Patch4: 0004-Set-pool-flag-to-fix-pool_addfileprovides_queue-with.patch
BuildRequires: cmake
BuildRequires: gcc
@ -307,6 +308,9 @@ popd
%endif
%changelog
* Tue Jul 02 2024 Petr Pisar <ppisar@redhat.com> - 0.73.1-4
- Fix sack initialization to enable postponed addition of filelists (RHEL-12355)
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 0.73.1-3
- Bump release for June 2024 mass rebuild