import libdnf-0.63.0-8.el8

This commit is contained in:
CentOS Sources 2022-05-10 03:16:52 -04:00 committed by Stepan Oksanichenko
parent f76c325306
commit bb211ea00b
5 changed files with 1570 additions and 254 deletions

View File

@ -0,0 +1,28 @@
From 6eb68174565ce0402cead9e45053b560e819e982 Mon Sep 17 00:00:00 2001
From: Aleš Matěj <amatej@redhat.com>
Date: Tue, 21 Sep 2021 12:10:49 +0200
Subject: [PATCH] Turn off strict validation of modulemd documents (RhBug:2004853,2007166,2007167)
https://bugzilla.redhat.com/show_bug.cgi?id=2004853
https://bugzilla.redhat.com/show_bug.cgi?id=2007166
https://bugzilla.redhat.com/show_bug.cgi?id=2007167
---
libdnf/module/modulemd/ModuleMetadata.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdnf/module/modulemd/ModuleMetadata.cpp b/libdnf/module/modulemd/ModuleMetadata.cpp
index fbdd8a1..9dcd661 100644
--- a/libdnf/module/modulemd/ModuleMetadata.cpp
+++ b/libdnf/module/modulemd/ModuleMetadata.cpp
@@ -78,7 +78,7 @@ void ModuleMetadata::addMetadataFromString(const std::string & yaml, int priorit
g_autoptr(GPtrArray) failures = NULL;
ModulemdModuleIndex * mi = modulemd_module_index_new();
- gboolean success = modulemd_module_index_update_from_string(mi, yaml.c_str(), TRUE, &failures, &error);
+ gboolean success = modulemd_module_index_update_from_string(mi, yaml.c_str(), FALSE, &failures, &error);
if(!success){
ModuleMetadata::reportFailures(failures);
}
--
libgit2 1.0.1

View File

@ -0,0 +1,58 @@
From 551a83052ff92fa975f1015e2fc25b174f85b0e6 Mon Sep 17 00:00:00 2001
From: Aleš Matěj <amatej@redhat.com>
Date: Tue, 26 Oct 2021 09:33:51 +0200
Subject: [PATCH] Add unittest for setting up repo with empty keyfile (RhBug:1994614)
The test ensures we don't crash when the keyfile is empty/not loaded.
Test for: https://github.com/rpm-software-management/libdnf/commit/be66d0908d939ddaf3022c5489012bd1dbdb0075
RHEL bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1994614
Fedora bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1946024
---
tests/libdnf/dnf-self-test.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tests/libdnf/dnf-self-test.c b/tests/libdnf/dnf-self-test.c
index 32a21e6..5295837 100644
--- a/tests/libdnf/dnf-self-test.c
+++ b/tests/libdnf/dnf-self-test.c
@@ -199,6 +199,26 @@ ch_test_repo_func(void)
g_object_unref(context);
}
+static void
+dnf_repo_setup_with_empty_keyfile(void)
+{
+ DnfContext *context = dnf_context_new();
+ dnf_context_set_release_ver(context, "33");
+ DnfRepo *repo = dnf_repo_new(context);
+ GKeyFile *empty_key_file = g_key_file_new();
+
+ dnf_repo_set_keyfile(repo, empty_key_file);
+
+ GError *error = NULL;
+ // Empty key file is not an errror, there is just no configuration to be loaded.
+ g_assert(dnf_repo_setup(repo, &error));
+ g_assert_no_error(error);
+
+ g_object_unref(repo);
+ g_object_unref(context);
+ g_key_file_free(empty_key_file);
+}
+
static guint _allow_cancel_updates = 0;
static guint _action_updates = 0;
static guint _package_progress_updates = 0;
@@ -1217,6 +1237,7 @@ main(int argc, char **argv)
g_test_add_func("/libdnf/lock", dnf_lock_func);
g_test_add_func("/libdnf/lock[threads]", dnf_lock_threads_func);
g_test_add_func("/libdnf/repo", ch_test_repo_func);
+ g_test_add_func("/libdnf/repo_empty_keyfile", dnf_repo_setup_with_empty_keyfile);
g_test_add_func("/libdnf/state", dnf_state_func);
g_test_add_func("/libdnf/state[child]", dnf_state_child_func);
g_test_add_func("/libdnf/state[parent-1-step]", dnf_state_parent_one_step_proxy_func);
--
libgit2 1.1.0

View File

@ -0,0 +1,90 @@
From e83ff88f8e4604024e4d5f4fd9f2fa4e5d4f03f9 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Tue, 23 Nov 2021 14:14:23 +0100
Subject: [PATCH] Add getLatestModules()
It returns latest module packages for each module name, stream, and
architecture.
It is an alternative implementation to code base with
the old modular solver.
Alternative to 73868368120ceea97ada628a1aa42236fb42b89d
---
libdnf/module/ModulePackageContainer.cpp | 39 +++++++++++++++++++++++++++++++++++++++
libdnf/module/ModulePackageContainer.hpp | 9 +++++++++
2 files changed, 48 insertions(+)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index efab497..f9f861c 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -1037,6 +1037,45 @@ ModulePackageContainer::getLatestModulesPerRepo(ModuleState moduleFilter,
return output;
}
+std::vector<ModulePackage *>
+ModulePackageContainer::getLatestModules(const std::vector<ModulePackage *> modulePackages, bool activeOnly)
+{
+ std::vector<ModulePackage *> latestModules;
+ if (activeOnly) {
+ // When no active module return
+ if (!pImpl->activatedModules) {
+ return latestModules;
+ }
+ }
+ std::map<std::string, std::vector<ModulePackage *>> latest;
+
+ for (auto modulePackage : modulePackages) {
+ if (activeOnly && !isModuleActive(modulePackage)) {
+ continue;
+ }
+ auto nameStreamArch = modulePackage->getNameStream();
+ nameStreamArch.append(":");
+ nameStreamArch.append(modulePackage->getArchCStr());
+ auto & entries = latest[nameStreamArch];
+ if (entries.empty()) {
+ entries.push_back(modulePackage);
+ } else {
+ auto version = (*entries.begin())->getVersionNum();
+ if (version < modulePackage->getVersionNum()) {
+ entries.clear();
+ entries.push_back(modulePackage);
+ } else if (version == modulePackage->getVersionNum()) {
+ entries.push_back(modulePackage);
+ }
+ }
+ }
+ for (auto & entries : latest) {
+ for (auto modulePackage : entries.second) {
+ latestModules.push_back(modulePackage);
+ }
+ }
+ return latestModules;
+}
std::pair<std::vector<std::vector<std::string>>, ModulePackageContainer::ModuleErrorType>
ModulePackageContainer::resolveActiveModulePackages(bool debugSolver)
diff --git a/libdnf/module/ModulePackageContainer.hpp b/libdnf/module/ModulePackageContainer.hpp
index 7e5071b..42d5a9e 100644
--- a/libdnf/module/ModulePackageContainer.hpp
+++ b/libdnf/module/ModulePackageContainer.hpp
@@ -132,6 +132,15 @@ public:
std::vector<std::vector<std::vector<ModulePackage *>>> getLatestModulesPerRepo(
ModuleState moduleFilter, std::vector<ModulePackage *> modulePackages);
+ /**
+ * @brief Return all latest ModulePackages for each module Name, stream and architecture. In case of
+ * multiple latest packages, all will be returned. When activeOnly is true, it returns only the latest active
+ * packages.
+ *
+ * @return std::vector<ModulePackage *>
+ */
+ std::vector<ModulePackage *> getLatestModules(const std::vector<ModulePackage *> modulePackages, bool activeOnly);
+
std::vector<ModulePackage *> requiresModuleEnablement(const libdnf::PackageSet & packages);
/**
--
libgit2 1.1.0

View File

@ -56,7 +56,7 @@
Name: libdnf Name: libdnf
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version} Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 3%{?dist} Release: 8%{?dist}
Summary: Library providing simplified C and Python API to libsolv Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+ License: LGPLv2+
URL: https://github.com/rpm-software-management/libdnf URL: https://github.com/rpm-software-management/libdnf
@ -83,7 +83,10 @@ Patch19: 0019-Remove-redundant-test.patch
Patch20: 0020-Fix-dnf_context_module_install-memory-leaks.patch Patch20: 0020-Fix-dnf_context_module_install-memory-leaks.patch
Patch21: 0021-covscan-remove-unused-vars-mark-private-func-static-return-values.patch Patch21: 0021-covscan-remove-unused-vars-mark-private-func-static-return-values.patch
Patch22: 0022-hawkey-surrogateescape-error-handler-to-decode-UTF-8-strings-RhBug1893176.patch Patch22: 0022-hawkey-surrogateescape-error-handler-to-decode-UTF-8-strings-RhBug1893176.patch
Patch23: 0023-Update-translations.patch Patch23: 0023-Turn-off-strict-validation-of-modulemd-documents-RhBug200485320071662007167.patch
Patch24: 0024-Add-unittest-for-setting-up-repo-with-empty-keyfile-RhBug1994614.patch
Patch25: 0025-Add-getLatestModules.patch
Patch26: 0026-Update-translations-RhBug-2017272.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
@ -328,8 +331,23 @@ popd
%endif %endif
%changelog %changelog
* Mon Sep 13 2021 Marek Blaha <mblaha@redhat.com> - 0.63.0-3 * Fri Mar 18 2022 Marek Blaha <mblaha@redhat.com> - 0.63.0-8
- Update translations (RhBug:1961634) - Update translations
* Fri Jan 14 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-7
- Rebuild with new release number
* Tue Jan 11 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-6
- Add getLatestModules()
* Mon Nov 29 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-5
- Add unittest for setting up repo with empty keyfile (RhBug:1994614)
* Tue Nov 09 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-4
- Bump release number because of conflicting version of 8.5 build
* Tue Nov 09 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-3
- Turn off strict validation of modulemd documents (RhBug:2004853,2007166,2007167)
* Tue Jul 27 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-2 * Tue Jul 27 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-2
- Fix: dnf_context_module_install: memory leaks - Fix: dnf_context_module_install: memory leaks