import libdnf-0.63.0-7.el8

This commit is contained in:
CentOS Sources 2022-02-05 05:27:04 +00:00 committed by Stepan Oksanichenko
parent 9ebcaadd0e
commit 672cf65cd6
2 changed files with 98 additions and 1 deletions

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
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 5%{?dist}
Release: 7%{?dist}
Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+
URL: https://github.com/rpm-software-management/libdnf
@ -85,6 +85,7 @@ Patch21: 0021-covscan-remove-unused-vars-mark-private-func-static-return-
Patch22: 0022-hawkey-surrogateescape-error-handler-to-decode-UTF-8-strings-RhBug1893176.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
BuildRequires: cmake
BuildRequires: gcc
@ -329,6 +330,12 @@ popd
%endif
%changelog
* 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)