Browse Source

import libdnf-0.63.0-3.el8

c8 imports/c8/libdnf-0.63.0-3.el8
CentOS Sources 9 months ago
committed by Stepan Oksanichenko
parent
commit
f76c325306
  1. 2
      .gitignore
  2. 2
      .libdnf.metadata
  3. 87
      SOURCES/0001-Better-msgs-if-basecachedir-or-proxy-password-isn-t-set-RhBug-1888946.patch
  4. 32
      SOURCES/0001-Revert-Improve-performance-for-module-query.patch
  5. 26
      SOURCES/0002-Revert-Enhance-description-of-modular-solvables.patch
  6. 73
      SOURCES/0002-modules-Add-special-handling-for-src-artifacts-RhBug-1809314.patch
  7. 101
      SOURCES/0003-Avoid-multilib-file-conflict-in-config.h-RhBug-1918818.patch
  8. 26
      SOURCES/0003-Revert-Fix-typo-lates-latest.patch
  9. 39
      SOURCES/0004-Revert-Remove-unused-code-bump-version.patch
  10. 1136
      SOURCES/0004-context-improve-retrieving-repository-configuration.patch
  11. 134
      SOURCES/0005-Allow-loading-incomplete-cache-and-loading-ext-solv-files-without-its-repodata.patch
  12. 89
      SOURCES/0005-Revert-Report-a-new-type-of-the-module-resolve-error.patch
  13. 53
      SOURCES/0006-Add-new-option-module-stream-switch.patch
  14. 62
      SOURCES/0006-Revert-Add-additional-fallback-for-module-resolve.patch
  15. 23
      SOURCES/0007-Fix-removal-step-during-modular-enable-in-context-part.patch
  16. 27
      SOURCES/0007-Revert-Decide-how-to-handle-context-according-to-sta.patch
  17. 76
      SOURCES/0008-Revert-Fix-load-update-FailSafe.patch
  18. 3698
      SOURCES/0008-Update-translations.patch
  19. 78
      SOURCES/0009-Revert-Change-mechanism-of-module-conflicts.patch
  20. 214
      SOURCES/0010-Revert-Call-addVersion2Modules-as-late-as-possible.patch
  21. 108
      SOURCES/0011-Revert-Fix-modular-queries-with-the-new-solver.patch
  22. 171
      SOURCES/0012-Revert-Add-compatible-layer-for-MdDocuments-v2.patch
  23. 77
      SOURCES/0013-Revert-Add-an-alternative-constructor-for-ModulePack.patch
  24. 113
      SOURCES/0014-Revert-Adjust-modular-solver-to-new-context-type.patch
  25. 65
      SOURCES/0015-Revert-Change-usage-of-context-and-version-in-modula.patch
  26. 34
      SOURCES/0016-Fix-failing-unittest-caused-by-the-revert-of-new-mod.patch
  27. 274
      SOURCES/0017-Modify-unit-test-after-change-of-handling-advisories.patch
  28. 34
      SOURCES/0018-Adjust-module-error-formatting-function-for-original.patch
  29. 57
      SOURCES/0019-Remove-redundant-test.patch
  30. 28
      SOURCES/0020-Fix-dnf_context_module_install-memory-leaks.patch
  31. 91
      SOURCES/0021-covscan-remove-unused-vars-mark-private-func-static-return-values.patch
  32. 32
      SOURCES/0022-hawkey-surrogateescape-error-handler-to-decode-UTF-8-strings-RhBug1893176.patch
  33. 4555
      SOURCES/0023-Update-translations.patch
  34. 94
      SPECS/libdnf.spec

2
.gitignore

@ -1 +1 @@
SOURCES/libdnf-0.55.0.tar.gz
SOURCES/libdnf-0.63.0.tar.gz

2
.libdnf.metadata

@ -1 +1 @@
5d997c2c7113cd50af986ada5ff10a62853f1943 SOURCES/libdnf-0.55.0.tar.gz
5bb88aae1c1b8c104e34916c7509b04fcf7b4de9 SOURCES/libdnf-0.63.0.tar.gz

87
SOURCES/0001-Better-msgs-if-basecachedir-or-proxy-password-isn-t-set-RhBug-1888946.patch

@ -1,87 +0,0 @@
From 2353dfbcb49a16bd37115915517417678fe49b19 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 13 Nov 2020 09:55:23 +0100
Subject: [PATCH] Better msgs if "basecachedir" or "proxy_password" isn't set
(RhBug:1888946)
Generates more specific error messages:
- repo '%s': 'basecachedir' is not set
- repo '%s': 'proxy_username' is set but not 'proxy_password'
- 'proxy_username' is set but not 'proxy_password'
instead of generic "GetValue(): Value not set"
---
libdnf/repo/Repo.cpp | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index d7c137d75..34539e1ee 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -484,8 +484,12 @@ std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitLocal()
handleSetOpt(h.get(), LRO_LOCAL, 1L);
#ifdef LRO_SUPPORTS_CACHEDIR
/* If zchunk is enabled, set librepo cache dir */
- if (conf->getMasterConfig().zchunk().getValue())
+ if (conf->getMasterConfig().zchunk().getValue()) {
+ if (conf->basecachedir().empty()) {
+ throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id));
+ }
handleSetOpt(h.get(), LRO_CACHEDIR, conf->basecachedir().getValue().c_str());
+ }
#endif
return h;
}
@@ -526,6 +530,9 @@ std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitRemote(const char *destdir)
handleSetOpt(h.get(), LRO_METALINKURL, tmp.c_str());
}
handleSetOpt(h.get(), LRO_FASTESTMIRROR, conf->fastestmirror().getValue() ? 1L : 0L);
+ if (conf->basecachedir().empty()) {
+ throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id));
+ }
auto fastestMirrorCacheDir = conf->basecachedir().getValue();
if (fastestMirrorCacheDir.back() != '/')
fastestMirrorCacheDir.push_back('/');
@@ -569,8 +576,12 @@ std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitRemote(const char *destdir)
#ifdef LRO_SUPPORTS_CACHEDIR
/* If zchunk is enabled, set librepo cache dir */
- if (conf->getMasterConfig().zchunk().getValue())
+ if (conf->getMasterConfig().zchunk().getValue()) {
+ if (conf->basecachedir().empty()) {
+ throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id));
+ }
handleSetOpt(h.get(), LRO_CACHEDIR, conf->basecachedir().getValue().c_str());
+ }
#endif
auto minrate = conf->minrate().getValue();
@@ -610,6 +621,9 @@ std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitRemote(const char *destdir)
if (!conf->proxy_username().empty()) {
userpwd = conf->proxy_username().getValue();
if (!userpwd.empty()) {
+ if (conf->proxy_password().empty()) {
+ throw RepoError(tfm::format(_("repo '%s': 'proxy_username' is set but not 'proxy_password'"), id));
+ }
userpwd = formatUserPassString(userpwd, conf->proxy_password().getValue(), true);
handleSetOpt(h.get(), LRO_PROXYUSERPWD, userpwd.c_str());
}
@@ -1346,6 +1360,9 @@ std::string Repo::Impl::getHash() const
std::string Repo::Impl::getCachedir() const
{
+ if (conf->basecachedir().empty()) {
+ throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id));
+ }
auto repodir(conf->basecachedir().getValue());
if (repodir.back() != '/')
repodir.push_back('/');
@@ -1690,6 +1707,9 @@ static LrHandle * newHandle(ConfigMain * conf)
if (!conf->proxy_username().empty()) {
auto userpwd = conf->proxy_username().getValue();
if (!userpwd.empty()) {
+ if (conf->proxy_password().empty()) {
+ throw RepoError(_("'proxy_username' is set but not 'proxy_password'"));
+ }
userpwd = formatUserPassString(userpwd, conf->proxy_password().getValue(), true);
handleSetOpt(h, LRO_PROXYUSERPWD, userpwd.c_str());
}

32
SOURCES/0001-Revert-Improve-performance-for-module-query.patch

@ -0,0 +1,32 @@
From 293e10c58dadc023070f959b08999b6bc2efb1b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:51 +0200
Subject: [PATCH 01/19] Revert "Improve performance for module query"
This reverts commit 38942d42b6980216e5d5e2e5798664cd08deb3ba.
---
libdnf/module/ModulePackageContainer.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index 1d5070ca..edb7e9ec 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -775,11 +775,9 @@ ModulePackageContainer::query(std::string name, std::string stream, std::string
Query query(pImpl->moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
// platform modules are installed and not in modules std::Map.
query.available();
- if (!name.empty() || !stream.empty()) {
- std::ostringstream ss;
- ss << stringFormater(name) << ":" << stringFormater(stream);
- query.addFilter(HY_PKG_DESCRIPTION, HY_GLOB, ss.str().c_str());
- }
+ std::ostringstream ss;
+ ss << stringFormater(name) << ":" << stringFormater(stream);
+ query.addFilter(HY_PKG_DESCRIPTION, HY_GLOB, ss.str().c_str());
if (!context.empty()) {
query.addFilter(HY_PKG_SUMMARY, HY_GLOB, context.c_str());
}
--
2.31.1

26
SOURCES/0002-Revert-Enhance-description-of-modular-solvables.patch

@ -0,0 +1,26 @@
From fe466856f54ed2cd261a863b2c929a064ae5e945 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:51 +0200
Subject: [PATCH 02/19] Revert "Enhance description of modular solvables"
This reverts commit 943d9a1ba905f2e10975b16edff0684964c135b6.
---
libdnf/module/ModulePackage.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/libdnf/module/ModulePackage.cpp b/libdnf/module/ModulePackage.cpp
index 3757f6ad..d0017877 100644
--- a/libdnf/module/ModulePackage.cpp
+++ b/libdnf/module/ModulePackage.cpp
@@ -50,8 +50,6 @@ namespace libdnf {
* Arch: $arch (If arch is not defined, set "noarch")
* Provides: module($name)
* Provides: module($name:$stream)
- * Summary: original_context
- * Description: name:stream
*/
static void setSovable(Pool * pool, Solvable * solvable, const std::string & name,
const std::string & stream, const std::string & version, const std::string & context, const char * arch, const std::string & original_context)
--
2.31.1

73
SOURCES/0002-modules-Add-special-handling-for-src-artifacts-RhBug-1809314.patch

@ -1,73 +0,0 @@
From 71db968178e5d8cd4c01ed36fa940c2a95f3e494 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 9 Nov 2020 18:10:37 +0100
Subject: [PATCH] [modules] Add special handling for src artifacts
(RhBug:1809314)
Source packages are special because they cannot be installed and provide
nothing, therefore they should be handled by a different way than binary
packages. Source rpm should not trigger a removal of binary packages.
---
libdnf/dnf-sack.cpp | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
index 9fd2c72d1..d44e1d86d 100644
--- a/libdnf/dnf-sack.cpp
+++ b/libdnf/dnf-sack.cpp
@@ -2335,20 +2335,29 @@ setModuleExcludes(DnfSack *sack, const char ** hotfixRepos,
{
dnf_sack_set_module_excludes(sack, nullptr);
std::vector<std::string> names;
+ std::vector<std::string> srcNames;
libdnf::DependencyContainer nameDependencies{sack};
libdnf::Nevra nevra;
for (const auto &rpm : includeNEVRAs) {
if (nevra.parse(rpm.c_str(), HY_FORM_NEVRA)) {
- names.push_back(nevra.getName());
- nameDependencies.addReldep(nevra.getName().c_str());
+ auto arch = nevra.getArch();
+ // source packages do not provide anything and must not cause excluding binary packages
+ if (arch == "src" || arch == "nosrc") {
+ srcNames.push_back(nevra.getName());
+ } else {
+ names.push_back(nevra.getName());
+ nameDependencies.addReldep(nevra.getName().c_str());
+ }
}
}
std::vector<const char *> namesCString(names.size() + 1);
+ std::vector<const char *> srcNamesCString(srcNames.size() + 1);
std::vector<const char *> excludeNEVRAsCString(excludeNEVRAs.size() + 1);
std::vector<const char *> includeNEVRAsCString(includeNEVRAs.size() + 1);
transform(names.begin(), names.end(), namesCString.begin(), std::mem_fn(&std::string::c_str));
+ transform(srcNames.begin(), srcNames.end(), srcNamesCString.begin(), std::mem_fn(&std::string::c_str));
transform(excludeNEVRAs.begin(), excludeNEVRAs.end(), excludeNEVRAsCString.begin(),
std::mem_fn(&std::string::c_str));
transform(includeNEVRAs.begin(), includeNEVRAs.end(), includeNEVRAsCString.begin(),
@@ -2363,6 +2372,7 @@ setModuleExcludes(DnfSack *sack, const char ** hotfixRepos,
libdnf::Query excludeQuery{keepPackages};
libdnf::Query excludeProvidesQuery{keepPackages};
libdnf::Query excludeNamesQuery(keepPackages);
+ libdnf::Query excludeSrcNamesQuery(keepPackages);
includeQuery.addFilter(HY_PKG_NEVRA_STRICT, HY_EQ, includeNEVRAsCString.data());
excludeQuery.addFilter(HY_PKG_NEVRA_STRICT, HY_EQ, excludeNEVRAsCString.data());
@@ -2372,8 +2382,14 @@ setModuleExcludes(DnfSack *sack, const char ** hotfixRepos,
excludeProvidesQuery.addFilter(HY_PKG_PROVIDES, &nameDependencies);
excludeProvidesQuery.queryDifference(includeQuery);
- // Requred to filtrate out source packages and packages with incompatible architectures
+ // Search for source packages with same names as included source artifacts
+ excludeSrcNamesQuery.addFilter(HY_PKG_NAME, HY_EQ, srcNamesCString.data());
+ const char * srcArchs[] = {"src", "nosrc", nullptr};
+ excludeSrcNamesQuery.addFilter(HY_PKG_ARCH, HY_EQ, srcArchs);
+
+ // Required to filtrate out source packages and packages with incompatible architectures
excludeNamesQuery.addFilter(HY_PKG_NAME, HY_EQ, namesCString.data());
+ excludeNamesQuery.queryUnion(excludeSrcNamesQuery);
excludeNamesQuery.queryDifference(includeQuery);
dnf_sack_set_module_excludes(sack, excludeQuery.getResultPset());

101
SOURCES/0003-Avoid-multilib-file-conflict-in-config.h-RhBug-1918818.patch

@ -1,101 +0,0 @@
From 3f6adc99506f065d0858e4d9d46055be9d070634 Mon Sep 17 00:00:00 2001
From: Nicola Sella <nsella@redhat.com>
Date: Fri, 22 Jan 2021 16:07:37 +0100
Subject: [PATCH] Avoid multilib file conflict in config.h (RhBug:1918818)
=changelog=
msg: Avoid multilib file conflicts in config.h
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1918818
---
.gitignore | 2 +-
libdnf/CMakeLists.txt | 8 ++++++-
libdnf/{config.h.in => config-64.h.in} | 6 +++---
libdnf/config.h | 29 ++++++++++++++++++++++++++
4 files changed, 40 insertions(+), 5 deletions(-)
rename libdnf/{config.h.in => config-64.h.in} (87%)
create mode 100644 libdnf/config.h
diff --git a/.gitignore b/.gitignore
index e17a9b9bb..0a63bdae7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,4 @@
build
*.pyc
data/tests/modules/yum.repos.d/test.repo
-libdnf/config.h
+libdnf/config-64.h
diff --git a/libdnf/CMakeLists.txt b/libdnf/CMakeLists.txt
index e82aac11e..25f33d7b0 100644
--- a/libdnf/CMakeLists.txt
+++ b/libdnf/CMakeLists.txt
@@ -35,7 +35,13 @@ set(LIBDNF_SRCS
include_directories(transaction)
add_subdirectory("transaction")
-configure_file("config.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(MULTILIB_ARCH "64")
+ configure_file("config-64.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/config-64.h)
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(MULTILIB_ARCH "32")
+ configure_file("config-64.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/config-32.h)
+endif()
configure_file("dnf-version.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/dnf-version.h)
configure_file("libdnf.pc.in" ${CMAKE_CURRENT_BINARY_DIR}/libdnf.pc @ONLY)
diff --git a/libdnf/config.h.in b/libdnf/config-64.h.in
similarity index 87%
rename from libdnf/config.h.in
rename to libdnf/config-64.h.in
index 77974f757..e2329fe71 100644
--- a/libdnf/config.h.in
+++ b/libdnf/config-64.h.in
@@ -18,9 +18,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _LIBDNF_CONFIG_H_
-#define _LIBDNF_CONFIG_H_
+#ifndef _LIBDNF_CONFIG_@MULTILIB_ARCH@_H_
+#define _LIBDNF_CONFIG_@MULTILIB_ARCH@_H_
#define DEFAULT_PLUGINS_DIRECTORY "@CMAKE_INSTALL_FULL_LIBDIR@/libdnf/plugins/"
-#endif // _LIBDNF_CONFIG_H_
+#endif // _LIBDNF_CONFIG_@MULTILIB_ARCH@_H_
diff --git a/libdnf/config.h b/libdnf/config.h
new file mode 100644
index 000000000..16121f6f5
--- /dev/null
+++ b/libdnf/config.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ * Licensed under the GNU Lesser General Public License Version 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "config-32.h"
+#elif __WORDSIZE == 64
+#include "config-64.h"
+#else
+#error "Unknown word size"
+#endif

26
SOURCES/0003-Revert-Fix-typo-lates-latest.patch

@ -0,0 +1,26 @@
From adf159cce65fa5b15f81dd3ee319e551f01def1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:51 +0200
Subject: [PATCH 03/19] Revert "Fix typo: lates -> latest"
This reverts commit 2a7a315cda61355d60fc0dd0fae9ccd48079a9c5.
---
libdnf/dnf-context.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 926681c2..ccb6fe83 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -3253,7 +3253,7 @@ report_problems(const std::vector<std::tuple<libdnf::ModulePackageContainer::Mod
logger->warning(tfm::format(_("Modular dependency problem with Defaults: %s"), report.c_str()));
break;
case libdnf::ModulePackageContainer::ModuleErrorType::ERROR_IN_LATEST:
- logger->warning(tfm::format(_("Modular dependency problem with the latest modules: %s"),
+ logger->warning(tfm::format(_("Modular dependency problem with the lates modules: %s"),
report.c_str()));
break;
case libdnf::ModulePackageContainer::ModuleErrorType::ERROR:
--
2.31.1

39
SOURCES/0004-Revert-Remove-unused-code-bump-version.patch

@ -0,0 +1,39 @@
From 291f0393b54b31228c7a4c8c112003b64632967b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:52 +0200
Subject: [PATCH 04/19] Revert "Remove unused code bump version"
This reverts commit f0fde46c42f2424135617b29fdfbcbf9e17fc79a.
---
libdnf/module/ModulePackageContainer.cpp | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index edb7e9ec..1bfdd8c1 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -1014,6 +1014,21 @@ modulePackageLatestPerRepoSorter(DnfSack * sack, const ModulePackage * first, co
return first->getVersionNum() > second->getVersionNum();
}
+static bool
+modulePackageLatestSorter(DnfSack * sack, const ModulePackage * first, const ModulePackage * second)
+{
+ int cmp = g_strcmp0(first->getNameCStr(), second->getNameCStr());
+ if (cmp != 0)
+ return cmp < 0;
+ cmp = dnf_sack_evr_cmp(sack, first->getStreamCStr(), second->getStreamCStr());
+ if (cmp != 0)
+ return cmp < 0;
+ cmp = g_strcmp0(first->getArchCStr(), second->getArchCStr());
+ if (cmp != 0)
+ return cmp < 0;
+ return first->getVersionNum() > second->getVersionNum();
+}
+
std::vector<std::vector<std::vector<ModulePackage *>>>
ModulePackageContainer::getLatestModulesPerRepo(ModuleState moduleFilter,
std::vector<ModulePackage *> modulePackages)
--
2.31.1

1136
SOURCES/0004-context-improve-retrieving-repository-configuration.patch
File diff suppressed because it is too large
View File

134
SOURCES/0005-Allow-loading-incomplete-cache-and-loading-ext-solv-files-without-its-repodata.patch

@ -1,134 +0,0 @@
From 816d18d826dc7134e553eae28f4aaca9a27e2307 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Mon, 2 Nov 2020 11:43:19 +0100
Subject: [PATCH 1/2] Allow loading ext metadata even if only cache (solv) is
present
If we have a valid (checksum matches with repomd) solv file for
requested type of metadata allow using it even if we no longer have the
original xml metadata.
---
libdnf/dnf-sack.cpp | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
index 6a43f01e3..608103d18 100644
--- a/libdnf/dnf-sack.cpp
+++ b/libdnf/dnf-sack.cpp
@@ -371,20 +371,9 @@ load_ext(DnfSack *sack, HyRepo hrepo, _hy_repo_repodata which_repodata,
auto repoImpl = libdnf::repoGetImpl(hrepo);
Repo *repo = repoImpl->libsolvRepo;
const char *name = repo->name;
- auto fn = hrepo->getMetadataPath(which_filename);
FILE *fp;
gboolean done = FALSE;
- /* nothing set */
- if (fn.empty()) {
- g_set_error (error,
- DNF_ERROR,
- DNF_ERROR_NO_CAPABILITY,
- _("no %1$s string for %2$s"),
- which_filename, name);
- return FALSE;
- }
-
char *fn_cache = dnf_sack_give_cache_fn(sack, name, suffix);
fp = fopen(fn_cache, "r");
assert(libdnf::repoGetImpl(hrepo)->checksum);
@@ -416,6 +405,17 @@ load_ext(DnfSack *sack, HyRepo hrepo, _hy_repo_repodata which_repodata,
if (done)
return TRUE;
+ auto fn = hrepo->getMetadataPath(which_filename);
+ /* nothing set */
+ if (fn.empty()) {
+ g_set_error (error,
+ DNF_ERROR,
+ DNF_ERROR_NO_CAPABILITY,
+ _("no %1$s string for %2$s"),
+ which_filename, name);
+ return FALSE;
+ }
+
fp = solv_xfopen(fn.c_str(), "r");
if (fp == NULL) {
g_set_error (error,
From aa2a372158f1b264708f960f387218deea17ef2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Thu, 10 Dec 2020 14:21:03 +0100
Subject: [PATCH 2/2] Extend repo loadCache method with ignoreMissing parameter
This allows loading even incomplete cache of xml files, only repomd.xml
is requried.
= changelog =
msg: Extend repo loadCache method with ignoreMissing parameter to allow
loading incomplete xml cache (repomd.xml is required).
type: enhancement
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1865803
---
VERSION.cmake | 2 +-
libdnf.spec | 2 +-
libdnf/repo/Repo-private.hpp | 2 +-
libdnf/repo/Repo.cpp | 8 ++++++--
libdnf/repo/Repo.hpp | 2 +-
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/libdnf/repo/Repo-private.hpp b/libdnf/repo/Repo-private.hpp
index 1e4ea4d20..c2ce369dc 100644
--- a/libdnf/repo/Repo-private.hpp
+++ b/libdnf/repo/Repo-private.hpp
@@ -111,7 +111,7 @@ class Repo::Impl {
~Impl();
bool load();
- bool loadCache(bool throwExcept);
+ bool loadCache(bool throwExcept, bool ignoreMissing=false);
void downloadMetadata(const std::string & destdir);
bool isInSync();
void fetch(const std::string & destdir, std::unique_ptr<LrHandle> && h);
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index 34539e1ee..84702c294 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -379,7 +379,7 @@ std::string Repo::getLocalBaseurl() const
}
bool Repo::load() { return pImpl->load(); }
-bool Repo::loadCache(bool throwExcept) { return pImpl->loadCache(throwExcept); }
+bool Repo::loadCache(bool throwExcept, bool ignoreMissing) { return pImpl->loadCache(throwExcept, ignoreMissing); }
void Repo::downloadMetadata(const std::string & destdir) { pImpl->downloadMetadata(destdir); }
bool Repo::getUseIncludes() const { return pImpl->useIncludes; }
void Repo::setUseIncludes(bool enabled) { pImpl->useIncludes = enabled; }
@@ -963,11 +963,15 @@ std::unique_ptr<LrResult> Repo::Impl::lrHandlePerform(LrHandle * handle, const s
return result;
}
-bool Repo::Impl::loadCache(bool throwExcept)
+bool Repo::Impl::loadCache(bool throwExcept, bool ignoreMissing)
{
std::unique_ptr<LrHandle> h(lrHandleInitLocal());
std::unique_ptr<LrResult> r;
+ if (ignoreMissing) {
+ handleSetOpt(h.get(), LRO_IGNOREMISSING, 1L);
+ }
+
// Fetch data
try {
r = lrHandlePerform(h.get(), getCachedir(), conf->repo_gpgcheck().getValue());
diff --git a/libdnf/repo/Repo.hpp b/libdnf/repo/Repo.hpp
index eeec651c3..be376f60c 100644
--- a/libdnf/repo/Repo.hpp
+++ b/libdnf/repo/Repo.hpp
@@ -167,7 +167,7 @@ struct Repo {
* @return true if fresh metadata were downloaded, false otherwise.
*/
bool load();
- bool loadCache(bool throwExcept);
+ bool loadCache(bool throwExcept, bool ignoreMissing=false);
void downloadMetadata(const std::string & destdir);
bool getUseIncludes() const;
void setUseIncludes(bool enabled);

89
SOURCES/0005-Revert-Report-a-new-type-of-the-module-resolve-error.patch

@ -0,0 +1,89 @@
From ce301450c39ebbd9fc5ec0897af2df766015e1bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 05/19] Revert "Report a new type of the module resolve error"
This reverts commit 9235436672fa413d5ac94f52a534b5abe90b5c7f.
---
libdnf/dnf-context.cpp | 4 ----
libdnf/module/ModulePackageContainer.cpp | 17 ++++++++++++-----
libdnf/module/ModulePackageContainer.hpp | 10 ++++------
3 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index ccb6fe83..55af2b26 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -3252,10 +3252,6 @@ report_problems(const std::vector<std::tuple<libdnf::ModulePackageContainer::Mod
case libdnf::ModulePackageContainer::ModuleErrorType::ERROR_IN_DEFAULTS:
logger->warning(tfm::format(_("Modular dependency problem with Defaults: %s"), report.c_str()));
break;
- case libdnf::ModulePackageContainer::ModuleErrorType::ERROR_IN_LATEST:
- logger->warning(tfm::format(_("Modular dependency problem with the lates modules: %s"),
- report.c_str()));
- break;
case libdnf::ModulePackageContainer::ModuleErrorType::ERROR:
logger->error(tfm::format(_("Modular dependency problem: %s"), report.c_str()));
return_error = true;
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index 1bfdd8c1..ee90056c 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -725,16 +725,23 @@ ModulePackageContainer::Impl::moduleSolve(const std::vector<ModulePackage *> & m
goal2name_query(goalWeak, query);
activatedModules.reset(new PackageSet(*query.runSet()));
}
- return make_pair(problems, problemType);
+ } else {
+ problemType = ModulePackageContainer::ModuleErrorType::ERROR_IN_DEFAULTS;
+ Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
+ goal2name_query(goal, query);
+ activatedModules.reset(new PackageSet(*query.runSet()));
}
- problemType = ModulePackageContainer::ModuleErrorType::ERROR_IN_LATEST;
} else {
problemType = ModulePackageContainer::ModuleErrorType::ERROR_IN_DEFAULTS;
+ Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
+ goal2name_query(goal, query);
+ activatedModules.reset(new PackageSet(*query.runSet()));
}
+ } else {
+ Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
+ goal2name_query(goal, query);
+ activatedModules.reset(new PackageSet(*query.runSet()));
}
- Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
- goal2name_query(goal, query);
- activatedModules.reset(new PackageSet(*query.runSet()));
return make_pair(problems, problemType);
}
diff --git a/libdnf/module/ModulePackageContainer.hpp b/libdnf/module/ModulePackageContainer.hpp
index f19c60fd..99fc0677 100644
--- a/libdnf/module/ModulePackageContainer.hpp
+++ b/libdnf/module/ModulePackageContainer.hpp
@@ -48,17 +48,15 @@ public:
enum class ModuleErrorType {
NO_ERROR = 0,
INFO,
- /// Error in module defaults detected during resolvement of module dependencies
+ /// Error in module defaults detected during resovement of module dependencies
ERROR_IN_DEFAULTS,
- /// Error detected during resolvement of module dependencies
+ /// Error detected during resovement of module dependencies
ERROR,
- /// Error detected during resolvement of module dependencies - Unexpected error!!!
+ /// Error detected during resovement of module dependencies - Unexpected error!!!
CANNOT_RESOLVE_MODULES,
CANNOT_RESOLVE_MODULE_SPEC,
CANNOT_ENABLE_MULTIPLE_STREAMS,
- CANNOT_MODIFY_MULTIPLE_TIMES_MODULE_STATE,
- /// Problem with latest modules during resolvement of module dependencies
- ERROR_IN_LATEST
+ CANNOT_MODIFY_MULTIPLE_TIMES_MODULE_STATE
};
struct Exception : public std::runtime_error
--
2.31.1

53
SOURCES/0006-Add-new-option-module-stream-switch.patch

@ -1,53 +0,0 @@
From a1c96ecae6f2052407345a66293710109323de3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Tue, 21 Jul 2020 15:37:05 +0200
Subject: [PATCH] Add new option module_stream_switch
= changelog =
msg: Add new options module_stream_switch
type: enhancement
---
libdnf/conf/ConfigMain.cpp | 3 +++
libdnf/conf/ConfigMain.hpp | 1 +
2 files changed, 4 insertions(+)
diff --git a/libdnf/conf/ConfigMain.cpp b/libdnf/conf/ConfigMain.cpp
index 1ffd3b336..abfc2082b 100644
--- a/libdnf/conf/ConfigMain.cpp
+++ b/libdnf/conf/ConfigMain.cpp
@@ -278,6 +278,7 @@ class ConfigMain::Impl {
OptionBool downloadonly{false}; // runtime only option
OptionBool ignorearch{false};
OptionString module_platform_id{nullptr};
+ OptionBool module_stream_switch{false};
OptionString user_agent{getUserAgent()};
OptionBool countme{false};
@@ -434,6 +435,7 @@ ConfigMain::Impl::Impl(Config & owner)
owner.optBinds().add("comment", comment);
owner.optBinds().add("ignorearch", ignorearch);
owner.optBinds().add("module_platform_id", module_platform_id);
+ owner.optBinds().add("module_stream_switch", module_stream_switch);
owner.optBinds().add("user_agent", user_agent);
owner.optBinds().add("countme", countme);
owner.optBinds().add("protect_running_kernel", protect_running_kernel);
@@ -569,6 +571,7 @@ OptionBool & ConfigMain::downloadonly() { return pImpl->downloadonly; }
OptionBool & ConfigMain::ignorearch() { return pImpl->ignorearch; }
OptionString & ConfigMain::module_platform_id() { return pImpl->module_platform_id; }
+OptionBool & ConfigMain::module_stream_switch() { return pImpl->module_stream_switch; }
OptionString & ConfigMain::user_agent() { return pImpl->user_agent; }
OptionBool & ConfigMain::countme() { return pImpl->countme; }
OptionBool & ConfigMain::protect_running_kernel() {return pImpl->protect_running_kernel; }
diff --git a/libdnf/conf/ConfigMain.hpp b/libdnf/conf/ConfigMain.hpp
index 226c74d50..835e1fc65 100644
--- a/libdnf/conf/ConfigMain.hpp
+++ b/libdnf/conf/ConfigMain.hpp
@@ -125,6 +125,7 @@ class ConfigMain : public Config {
OptionBool & ignorearch();
OptionString & module_platform_id();
+ OptionBool & module_stream_switch();
OptionString & user_agent();
OptionBool & countme();
OptionBool & protect_running_kernel();

62
SOURCES/0006-Revert-Add-additional-fallback-for-module-resolve.patch

@ -0,0 +1,62 @@
From 15a06ef27466f42a8dc39823385f0ca655e80b12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 06/19] Revert "Add additional fallback for module resolve"
This reverts commit fc98ce725181a77bbe0ab157d40443467612c0c0.
---
libdnf/module/ModulePackageContainer.cpp | 32 ++++++++----------------
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index ee90056c..e19db08b 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -702,33 +702,23 @@ ModulePackageContainer::Impl::moduleSolve(const std::vector<ModulePackage *> & m
std::vector<std::vector<std::string>> problems;
auto problemType = ModulePackageContainer::ModuleErrorType::NO_ERROR;
if (ret) {
- // Goal run ignor problem in defaults
problems = goal.describeAllProblemRules(false);
ret = goal.run(DNF_FORCE_BEST);
if (ret) {
- // Goal run ignor problem in defaults and in latest
- ret = goal.run(DNF_NONE);
+ // Conflicting modules has to be removed otherwice it could result than one of them will
+ // be active
+ auto conflictingPkgs = goal.listConflictPkgs(DNF_PACKAGE_STATE_AVAILABLE);
+ dnf_sack_add_excludes(moduleSack, conflictingPkgs.get());
+ ret = goalWeak.run(DNF_NONE);
if (ret) {
- // Conflicting modules has to be removed otherwice it could result than one of them will
- // be active
- auto conflictingPkgs = goal.listConflictPkgs(DNF_PACKAGE_STATE_AVAILABLE);
- dnf_sack_add_excludes(moduleSack, conflictingPkgs.get());
- ret = goalWeak.run(DNF_NONE);
- if (ret) {
- auto logger(Log::getLogger());
- logger->critical("Modularity filtering totally broken\n");
- problemType = ModulePackageContainer::ModuleErrorType::CANNOT_RESOLVE_MODULES;
- activatedModules.reset();
- } else {
- problemType = ModulePackageContainer::ModuleErrorType::ERROR;
- Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
- goal2name_query(goalWeak, query);
- activatedModules.reset(new PackageSet(*query.runSet()));
- }
+ auto logger(Log::getLogger());
+ logger->critical("Modularity filtering totally broken\n");
+ problemType = ModulePackageContainer::ModuleErrorType::CANNOT_RESOLVE_MODULES;
+ activatedModules.reset();
} else {
- problemType = ModulePackageContainer::ModuleErrorType::ERROR_IN_DEFAULTS;
+ problemType = ModulePackageContainer::ModuleErrorType::ERROR;
Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
- goal2name_query(goal, query);
+ goal2name_query(goalWeak, query);
activatedModules.reset(new PackageSet(*query.runSet()));
}
} else {
--
2.31.1

23
SOURCES/0007-Fix-removal-step-during-modular-enable-in-context-part.patch

@ -1,23 +0,0 @@
From 831d023c3c6fb4a28903cb3170efdd9f85645e1a Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Fri, 20 Nov 2020 16:30:17 +0100
Subject: [PATCH] Fix removal step during modular enable in context part
It resolves `free(): double free detected in tcache 2`
---
libdnf/dnf-context.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 069267119..bc4a15b68 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -3087,7 +3087,7 @@ static std::vector<std::tuple<libdnf::ModulePackageContainer::ModuleErrorType, s
}
for (auto iter = stream_dict.begin(); iter != stream_dict.end(); ) {
if (iter->first != enabledOrDefaultStream) {
- stream_dict.erase(iter);
+ stream_dict.erase(iter++);
} else {
++iter;
}

27
SOURCES/0007-Revert-Decide-how-to-handle-context-according-to-sta.patch

@ -0,0 +1,27 @@
From 0a92554dc2df3d2241b289bb796bc997c2959aaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 07/19] Revert "Decide how to handle context according to
static_context value"
This reverts commit 66439ed5a57373dfd106379637a9400b107e160c.
---
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 ee6834c6..07817ce1 100644
--- a/libdnf/module/modulemd/ModuleMetadata.cpp
+++ b/libdnf/module/modulemd/ModuleMetadata.cpp
@@ -142,7 +142,7 @@ std::vector<ModulePackage *> ModuleMetadata::getAllModulePackages(DnfSack * modu
//GPtrArray * streams = modulemd_module_index_search_streams_by_nsvca_glob(resultingModuleIndex, NULL);
for (unsigned int i = 0; i < streams->len; i++){
ModulemdModuleStream * moduleMdStream = static_cast<ModulemdModuleStream *>(g_ptr_array_index(streams, i));
- if (modulemd_module_stream_v2_is_static_context((ModulemdModuleStreamV2 *) moduleMdStream)) {
+ if (modulemd_module_stream_get_mdversion(moduleMdStream) > 2) {
result.push_back(new ModulePackage(moduleSack, repo, moduleMdStream, repoID));
} else {
g_object_ref(moduleMdStream);
--
2.31.1

76
SOURCES/0008-Revert-Fix-load-update-FailSafe.patch

@ -0,0 +1,76 @@
From 140168ce29d2425ebf2b4b5b25926611a189cd84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 08/19] Revert "Fix load/update FailSafe"
This reverts commit 244a37d772fcd5a5969085edab544fb1e7b68aad.
---
libdnf/module/ModulePackageContainer.cpp | 38 ++++++++++++++++++------
1 file changed, 29 insertions(+), 9 deletions(-)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index e19db08b..97c84c01 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -1641,7 +1641,6 @@ ModulePackageContainer::Impl::ModulePersistor::getRemovedProfiles()
void ModulePackageContainer::loadFailSafeData()
{
- pImpl->addVersion2Modules();
auto persistor = pImpl->persistor->configs;
std::map<std::string, std::pair<std::string, bool>> enabledStreams;
@@ -1696,21 +1695,42 @@ void ModulePackageContainer::loadFailSafeData()
std::vector<ModulePackage *> ModulePackageContainer::Impl::getLatestActiveEnabledModules()
{
- Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
- query.addFilter(HY_PKG, HY_EQ, activatedModules.get());
- query.addFilter(HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME);
- query.addFilter(HY_PKG_LATEST_PER_ARCH, HY_EQ, 1);
- auto set = query.runSet();
-
std::vector<ModulePackage *> activeModules;
Id moduleId = -1;
- while ((moduleId = set->next(moduleId)) != -1) {
+ while ((moduleId = activatedModules->next(moduleId)) != -1) {
auto modulePackage = modules.at(moduleId).get();
if (isEnabled(modulePackage->getName(), modulePackage->getStream())) {
activeModules.push_back(modulePackage);
}
}
- return activeModules;
+ if (activeModules.empty()) {
+ return {};
+ }
+ auto sack = moduleSack;
+ std::sort(activeModules.begin(), activeModules.end(),
+ [sack](const ModulePackage * first, const ModulePackage * second)
+ {return modulePackageLatestSorter(sack, first, second);});
+
+ auto packageFirst = activeModules[0];
+ std::vector<ModulePackage *> latest;
+ auto vectorSize = activeModules.size();
+ latest.push_back(packageFirst);
+ auto name = packageFirst->getNameCStr();
+ auto stream = packageFirst->getStreamCStr();
+ auto arch = packageFirst->getArchCStr();
+
+ for (unsigned int index = 1; index < vectorSize; ++index) {
+ auto & package = activeModules[index];
+ if (g_strcmp0(package->getNameCStr(), name) != 0 ||
+ g_strcmp0(package->getStreamCStr(), stream) != 0 ||
+ g_strcmp0(package->getArchCStr(), arch) != 0) {
+ name = package->getNameCStr();
+ stream = package->getStreamCStr();
+ arch = package->getArchCStr();
+ latest.push_back(package);
+ }
+ }
+ return latest;
}
void ModulePackageContainer::Impl::addVersion2Modules()
--
2.31.1

3698
SOURCES/0008-Update-translations.patch
File diff suppressed because it is too large
View File

78
SOURCES/0009-Revert-Change-mechanism-of-module-conflicts.patch

@ -0,0 +1,78 @@
From e43ef244e78d8563eb3cb7ff6a6074946f60c877 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 09/19] Revert "Change mechanism of module conflicts"
This reverts commit 49600ba05b474bc29651aa122a9116b5ada69f4d.
---
libdnf/dnf-sack.cpp | 1 +
libdnf/module/ModulePackage.cpp | 2 --
libdnf/module/ModulePackage.hpp | 1 -
libdnf/module/ModulePackageContainer.cpp | 1 -
libdnf/module/ModulePackageContainer.hpp | 1 -
5 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
index b5c7edc0..b9baeaef 100644
--- a/libdnf/dnf-sack.cpp
+++ b/libdnf/dnf-sack.cpp
@@ -2297,6 +2297,7 @@ void readModuleMetadataFromRepo(DnfSack * sack, libdnf::ModulePackageContainer *
modulePackages->add(sack);
modulePackages->loadFailSafeData();
if (!modulePackages->empty()) {
+ modulePackages->createConflictsBetweenStreams();
// TODO remove hard-coded path
try {
std::vector<std::string> paths{"/etc/os-release", "/usr/lib/os-release"};
diff --git a/libdnf/module/ModulePackage.cpp b/libdnf/module/ModulePackage.cpp
index d0017877..d644eca6 100644
--- a/libdnf/module/ModulePackage.cpp
+++ b/libdnf/module/ModulePackage.cpp
@@ -75,8 +75,6 @@ static void setSovable(Pool * pool, Solvable * solvable, const std::string & nam
ss << "module(" << name << ")";
auto depId = pool_str2id(pool, ss.str().c_str(), 1);
solvable_add_deparray(solvable, SOLVABLE_PROVIDES, depId, -1);
- // create Conflicts: module($name)
- solvable_add_deparray(solvable, SOLVABLE_CONFLICTS, depId, 0);
// create Provide: module($name:$stream)
ss.str(std::string());
diff --git a/libdnf/module/ModulePackage.hpp b/libdnf/module/ModulePackage.hpp
index b618df58..145c6d63 100644
--- a/libdnf/module/ModulePackage.hpp
+++ b/libdnf/module/ModulePackage.hpp
@@ -71,7 +71,6 @@ public:
std::vector<ModuleDependencies> getModuleDependencies() const;
- ///DEPRECATED
void addStreamConflict(const ModulePackage * package);
Id getId() const { return id; };
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index 97c84c01..893b839a 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -204,7 +204,6 @@ private:
/// solvable.arch = <moduleArch>
/// solvable.summary = <moduleContext>
/// solvable.description = <moduleName>:<moduleStream>
- /// solvable.conflicts = module(<moduleName>)
DnfSack * moduleSack;
std::unique_ptr<PackageSet> activatedModules;
std::string installRoot;
diff --git a/libdnf/module/ModulePackageContainer.hpp b/libdnf/module/ModulePackageContainer.hpp
index 99fc0677..c1001fce 100644
--- a/libdnf/module/ModulePackageContainer.hpp
+++ b/libdnf/module/ModulePackageContainer.hpp
@@ -115,7 +115,6 @@ public:
Id addPlatformPackage(const std::string &osReleasePath, const char * platformModule);
Id addPlatformPackage(DnfSack * sack,
const std::vector<std::string> & osReleasePath, const char * platformModule);
- /// DEPRECATED
void createConflictsBetweenStreams();
/**
--
2.31.1

214
SOURCES/0010-Revert-Call-addVersion2Modules-as-late-as-possible.patch

@ -0,0 +1,214 @@
From 058b6112374f5feb5ee57488ac3fdbc7666a2016 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 10/19] Revert "Call addVersion2Modules(); as late as possible"
This reverts commit fe27dba67384e549a3be2a91c4a6cf1151113157.
---
libdnf/module/ModulePackageContainer.cpp | 28 +++---------------------
1 file changed, 3 insertions(+), 25 deletions(-)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index 893b839a..6ee2b68f 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -346,6 +346,7 @@ ModulePackageContainer::add(DnfSack * sack)
exception.what()));
}
}
+ pImpl->addVersion2Modules();
}
void ModulePackageContainer::addDefaultsFromDisk()
@@ -427,7 +428,6 @@ void ModulePackageContainer::createConflictsBetweenStreams()
bool ModulePackageContainer::empty() const noexcept
{
- pImpl->addVersion2Modules();
return pImpl->modules.empty();
}
@@ -521,13 +521,11 @@ bool ModulePackageContainer::isDisabled(const ModulePackage * module)
std::vector<std::string> ModulePackageContainer::getDefaultProfiles(std::string moduleName,
std::string moduleStream)
{
- pImpl->addVersion2Modules();
return pImpl->moduleMetadata.getDefaultProfiles(moduleName, moduleStream);
}
const std::string & ModulePackageContainer::getDefaultStream(const std::string &name) const
{
- pImpl->addVersion2Modules();
auto it = pImpl->moduleDefaults.find(name);
if (it == pImpl->moduleDefaults.end()) {
return EMPTY_RESULT;
@@ -537,7 +535,6 @@ const std::string & ModulePackageContainer::getDefaultStream(const std::string &
const std::string & ModulePackageContainer::getEnabledStream(const std::string &name)
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getStream(name);
}
@@ -547,7 +544,6 @@ const std::string & ModulePackageContainer::getEnabledStream(const std::string &
bool
ModulePackageContainer::enable(const std::string &name, const std::string & stream, const bool count)
{
- pImpl->addVersion2Modules();
if (count) {
pImpl->persistor->getEntry(name).second.streamChangesNum++;
}
@@ -573,7 +569,6 @@ ModulePackageContainer::enable(const ModulePackage * module, const bool count)
*/
void ModulePackageContainer::disable(const std::string & name, const bool count)
{
- pImpl->addVersion2Modules();
if (count) {
pImpl->persistor->getEntry(name).second.streamChangesNum++;
}
@@ -594,11 +589,11 @@ void ModulePackageContainer::disable(const ModulePackage * module, const bool co
*/
void ModulePackageContainer::reset(const std::string & name, const bool count)
{
- pImpl->addVersion2Modules();
if (count) {
pImpl->persistor->getEntry(name).second.streamChangesNum++;
}
pImpl->persistor->changeState(name, ModuleState::UNKNOWN);
+
pImpl->persistor->changeStream(name, "");
auto & profiles = pImpl->persistor->getEntry(name).second.profiles;
profiles.clear();
@@ -638,7 +633,6 @@ bool ModulePackageContainer::isChanged()
void ModulePackageContainer::install(const std::string &name, const std::string &stream,
const std::string &profile)
{
- pImpl->addVersion2Modules();
for (const auto &iter : pImpl->modules) {
auto modulePackage = iter.second.get();
if (modulePackage->getName() == name && modulePackage->getStream() == stream) {
@@ -656,7 +650,6 @@ void ModulePackageContainer::install(const ModulePackage * module, const std::st
void ModulePackageContainer::uninstall(const std::string &name, const std::string &stream,
const std::string &profile)
{
- pImpl->addVersion2Modules();
for (const auto &iter : pImpl->modules) {
auto modulePackage = iter.second.get();
if (modulePackage->getName() == name && modulePackage->getStream() == stream) {
@@ -744,7 +737,6 @@ ModulePackageContainer::query(Nsvcap& moduleNevra)
std::vector<ModulePackage *>
ModulePackageContainer::query(std::string subject)
{
- pImpl->addVersion2Modules();
// Alternatively a search using module provides could be performed
std::vector<ModulePackage *> result;
Query query(pImpl->moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
@@ -765,7 +757,6 @@ std::vector<ModulePackage *>
ModulePackageContainer::query(std::string name, std::string stream, std::string version,
std::string context, std::string arch)
{
- pImpl->addVersion2Modules();
// Alternatively a search using module provides could be performed
std::vector<ModulePackage *> result;
Query query(pImpl->moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
@@ -847,7 +838,6 @@ ModulePackageContainer::getModuleState(const std::string& name)
std::set<std::string> ModulePackageContainer::getInstalledPkgNames()
{
- pImpl->addVersion2Modules();
auto moduleNames = pImpl->persistor->getAllModuleNames();
std::set<std::string> pkgNames;
for (auto & moduleName: moduleNames) {
@@ -1029,7 +1019,6 @@ std::vector<std::vector<std::vector<ModulePackage *>>>
ModulePackageContainer::getLatestModulesPerRepo(ModuleState moduleFilter,
std::vector<ModulePackage *> modulePackages)
{
- pImpl->addVersion2Modules();
if (modulePackages.empty()) {
return {};
}
@@ -1113,7 +1102,6 @@ ModulePackageContainer::getLatestModulesPerRepo(ModuleState moduleFilter,
std::pair<std::vector<std::vector<std::string>>, ModulePackageContainer::ModuleErrorType>
ModulePackageContainer::resolveActiveModulePackages(bool debugSolver)
{
- pImpl->addVersion2Modules();
dnf_sack_reset_excludes(pImpl->moduleSack);
std::vector<ModulePackage *> packages;
@@ -1164,7 +1152,6 @@ bool ModulePackageContainer::isModuleActive(const ModulePackage * modulePackage)
std::vector<ModulePackage *> ModulePackageContainer::getModulePackages()
{
- pImpl->addVersion2Modules();
std::vector<ModulePackage *> values;
const auto & modules = pImpl->modules;
std::transform(
@@ -1186,56 +1173,47 @@ void ModulePackageContainer::rollback()
std::map<std::string, std::string> ModulePackageContainer::getEnabledStreams()
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getEnabledStreams();
}
std::vector<std::string> ModulePackageContainer::getDisabledModules()
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getDisabledModules();
}
std::map<std::string, std::string> ModulePackageContainer::getDisabledStreams()
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getDisabledStreams();
}
std::vector<std::string> ModulePackageContainer::getResetModules()
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getResetModules();
}
std::map<std::string, std::string> ModulePackageContainer::getResetStreams()
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getResetStreams();
}
std::map<std::string, std::pair<std::string, std::string>>
ModulePackageContainer::getSwitchedStreams()
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getSwitchedStreams();
}
std::map<std::string, std::vector<std::string>> ModulePackageContainer::getInstalledProfiles()
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getInstalledProfiles();
}
std::vector<std::string> ModulePackageContainer::getInstalledProfiles(std::string moduleName)
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getProfiles(moduleName);
}
std::map<std::string, std::vector<std::string>> ModulePackageContainer::getRemovedProfiles()
{
- pImpl->addVersion2Modules();
return pImpl->persistor->getRemovedProfiles();
}
const std::string &
@@ -1641,7 +1619,7 @@ ModulePackageContainer::Impl::ModulePersistor::getRemovedProfiles()
void ModulePackageContainer::loadFailSafeData()
{
auto persistor = pImpl->persistor->configs;
-
+
std::map<std::string, std::pair<std::string, bool>> enabledStreams;
for (auto & nameConfig: persistor) {
if (nameConfig.second.second.state == ModuleState::ENABLED) {
--
2.31.1

108
SOURCES/0011-Revert-Fix-modular-queries-with-the-new-solver.patch

@ -0,0 +1,108 @@
From 83703689de978cbb5e38f04fb1d9f554026de5ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 11/19] Revert "Fix modular queries with the new solver"
This reverts commit a9f99a4969831f5d0e21d0f2b2b088ff6546604b.
---
libdnf/module/ModulePackage.cpp | 17 ++++-------------
libdnf/module/ModulePackageContainer.cpp | 13 ++-----------
libdnf/module/ModulePackageContainer.hpp | 2 +-
3 files changed, 7 insertions(+), 25 deletions(-)
diff --git a/libdnf/module/ModulePackage.cpp b/libdnf/module/ModulePackage.cpp
index d644eca6..63ee1656 100644
--- a/libdnf/module/ModulePackage.cpp
+++ b/libdnf/module/ModulePackage.cpp
@@ -52,7 +52,7 @@ namespace libdnf {
* Provides: module($name:$stream)
*/
static void setSovable(Pool * pool, Solvable * solvable, const std::string & name,
- const std::string & stream, const std::string & version, const std::string & context, const char * arch, const std::string & original_context)
+ const std::string & stream, const std::string & version, const std::string & context, const char * arch)
{
std::ostringstream ss;
// Name: $name:$stream:$context
@@ -62,14 +62,6 @@ static void setSovable(Pool * pool, Solvable * solvable, const std::string & nam
// TODO Test can be remove when modules will be always with arch
solvable_set_str(solvable, SOLVABLE_ARCH, arch ? arch : "noarch");
- // store original context in summary
- solvable_set_str(solvable, SOLVABLE_SUMMARY, original_context.c_str());
-
- // store original name:stream in description
- ss.str(std::string());
- ss << name << ":" << stream;
- solvable_set_str(solvable, SOLVABLE_DESCRIPTION, ss.str().c_str());
-
// create Provide: module($name)
ss.str(std::string());
ss << "module(" << name << ")";
@@ -105,9 +97,8 @@ ModulePackage::ModulePackage(DnfSack * moduleSack, LibsolvRepo * repo,
Pool * pool = dnf_sack_get_pool(moduleSack);
id = repo_add_solvable(repo);
Solvable *solvable = pool_id2solvable(pool, id);
- std::string original_context = getContext();
- setSovable(pool, solvable, getName(), getStream(), getVersion(), context.empty() ? original_context : context,
- getArchCStr(), original_context);
+
+ setSovable(pool, solvable, getName(), getStream(), getVersion(), context.empty() ? getContext() : context, getArchCStr());
createDependencies(solvable);
HyRepo hyRepo = static_cast<HyRepo>(repo->appdata);
libdnf::repoGetImpl(hyRepo)->needs_internalizing = 1;
@@ -649,7 +640,7 @@ ModulePackage::createPlatformSolvable(DnfSack * sack, DnfSack * moduleSack,
repoImpl->needs_internalizing = 1;
Id id = repo_add_solvable(repo);
Solvable *solvable = pool_id2solvable(pool, id);
- setSovable(pool, solvable, name, stream, version, context, "noarch", context);
+ setSovable(pool, solvable, name, stream, version, context, "noarch");
repoImpl->needs_internalizing = 1;
dnf_sack_set_provides_not_ready(moduleSack);
dnf_sack_set_considered_to_update(moduleSack);
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index 6ee2b68f..3f30037e 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -197,13 +197,6 @@ private:
class ModulePersistor;
std::unique_ptr<ModulePersistor> persistor;
std::map<Id, std::unique_ptr<ModulePackage>> modules;
- /// Internal sack with module solvables
- /// resolveContext = <moduleContext> if moduleMdVersion > 2, else generated from requires
- /// solvable.name = <moduleName>:<moduleStream>:<resolveContext>
- /// solvable.evr = <moduleVersion>
- /// solvable.arch = <moduleArch>
- /// solvable.summary = <moduleContext>
- /// solvable.description = <moduleName>:<moduleStream>
DnfSack * moduleSack;
std::unique_ptr<PackageSet> activatedModules;
std::string installRoot;
@@ -764,10 +757,8 @@ ModulePackageContainer::query(std::string name, std::string stream, std::string
query.available();
std::ostringstream ss;
ss << stringFormater(name) << ":" << stringFormater(stream);
- query.addFilter(HY_PKG_DESCRIPTION, HY_GLOB, ss.str().c_str());
- if (!context.empty()) {
- query.addFilter(HY_PKG_SUMMARY, HY_GLOB, context.c_str());
- }
+ ss << ":" << stringFormater(context);
+ query.addFilter(HY_PKG_NAME, HY_GLOB, ss.str().c_str());
if (!arch.empty()) {
query.addFilter(HY_PKG_ARCH, HY_GLOB, arch.c_str());
}
diff --git a/libdnf/module/ModulePackageContainer.hpp b/libdnf/module/ModulePackageContainer.hpp
index c1001fce..7e5071b2 100644
--- a/libdnf/module/ModulePackageContainer.hpp
+++ b/libdnf/module/ModulePackageContainer.hpp
@@ -270,7 +270,7 @@ public:
*/
std::vector<ModulePackage *> query(libdnf::Nsvcap & moduleNevra);
/**
- * @brief Requiers subject in format <name>, <name>:<stream>, or <name>:<stream>:<contex>
+ * @brief Requiers subject in format <name>, <name>:<stream>, or <name>:<stream>:<version>
*
* @param subject p_subject:...
* @return std::vector<ModulePackage *>
--
2.31.1

171
SOURCES/0012-Revert-Add-compatible-layer-for-MdDocuments-v2.patch

@ -0,0 +1,171 @@
From 833966d8a8a6c87a3d51447f2adf2aa76190ecd8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 12/19] Revert "Add compatible layer for MdDocuments v2"
This reverts commit 32ccf6743cb9ce1579ff88804855a94f30876860.
---
libdnf/module/ModulePackageContainer.cpp | 68 +----------------------
libdnf/module/modulemd/ModuleMetadata.cpp | 11 +---
libdnf/module/modulemd/ModuleMetadata.hpp | 2 +-
3 files changed, 4 insertions(+), 77 deletions(-)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index 3f30037e..6e6134d2 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -69,23 +69,6 @@ void goal2name_query(libdnf::Goal & goal, libdnf::Query & query)
query.addFilter(HY_PKG_NAME, HY_EQ, module_names.data());
}
-/**
- * @brief In python => ";".join(list.sort())
- */
-std::string concentrateVectorString(std::vector<std::string> & list)
-{
- if (list.empty()) {
- return {};
- }
- std::sort(list.begin(), list.end());
- std::ostringstream ss;
- ss << *list.begin();
- for (auto require = std::next(list.begin()); require != list.end(); ++require) {
- ss << ";" << *require;
- }
- return ss.str();
-}
-
}
namespace std {
@@ -189,8 +172,6 @@ public:
const std::vector<ModulePackage *> & modules, bool debugSolver);
bool insert(const std::string &moduleName, const char *path);
std::vector<ModulePackage *> getLatestActiveEnabledModules();
- /// Required to call after all modules v3 are in metadata
- void addVersion2Modules();
private:
friend struct ModulePackageContainer;
@@ -204,8 +185,6 @@ private:
ModuleMetadata moduleMetadata;
std::map<std::string, std::string> moduleDefaults;
- std::vector<std::tuple<LibsolvRepo *, ModulemdModuleStream *, std::string>> modulesV2;
-
bool isEnabled(const std::string &name, const std::string &stream);
};
@@ -339,7 +318,6 @@ ModulePackageContainer::add(DnfSack * sack)
exception.what()));
}
}
- pImpl->addVersion2Modules();
}
void ModulePackageContainer::addDefaultsFromDisk()
@@ -375,7 +353,7 @@ ModulePackageContainer::add(const std::string &fileContent, const std::string &
if (strcmp(r->name, "available") == 0) {
g_autofree gchar * path = g_build_filename(pImpl->installRoot.c_str(),
"/etc/dnf/modules.d", NULL);
- auto packages = md.getAllModulePackages(pImpl->moduleSack, r, repoID, pImpl->modulesV2);
+ std::vector<ModulePackage *> packages = md.getAllModulePackages(pImpl->moduleSack, r, repoID);
for(auto const& modulePackagePtr: packages) {
std::unique_ptr<ModulePackage> modulePackage(modulePackagePtr);
pImpl->modules.insert(std::make_pair(modulePackage->getId(), std::move(modulePackage)));
@@ -1701,50 +1679,6 @@ std::vector<ModulePackage *> ModulePackageContainer::Impl::getLatestActiveEnable
return latest;
}
-void ModulePackageContainer::Impl::addVersion2Modules()
-{
- if (modulesV2.empty()) {
- return;
- }
- std::map<std::string, std::map<std::string, std::vector<ModulePackage *>>> v3_context_map;
- for (auto const & module_pair : modules) {
- auto * module = module_pair.second.get();
- auto requires = module->getRequires(true);
- auto concentratedRequires = concentrateVectorString(requires);
- v3_context_map[module->getNameStream()][concentratedRequires].push_back(module);
- }
- libdnf::LibsolvRepo * repo;
- ModulemdModuleStream * mdStream;
- std::string repoID;
- g_autofree gchar * path = g_build_filename(installRoot.c_str(), "/etc/dnf/modules.d", NULL);
- for (auto & module_tuple : modulesV2) {
- std::tie(repo, mdStream, repoID) = module_tuple;
- auto nameStream = ModulePackage::getNameStream(mdStream);
- auto requires = ModulePackage::getRequires(mdStream, true);
- auto concentratedRequires = concentrateVectorString(requires);
- auto streamIterator = v3_context_map.find(nameStream);
- if (streamIterator != v3_context_map.end()) {
- auto contextIterator = streamIterator->second.find(concentratedRequires);
- if (contextIterator != streamIterator->second.end()) {
- auto v3_context = contextIterator->second[0]->getContext();
- std::unique_ptr<ModulePackage> modulePackage(new ModulePackage(moduleSack, repo, mdStream, repoID, v3_context));
- persistor->insert(modulePackage->getName(), path);
- modules.insert(std::make_pair(modulePackage->getId(), std::move(modulePackage)));
- g_object_unref(mdStream);
- continue;
- }
- }
- if (concentratedRequires.empty()) {
- concentratedRequires.append("NoRequires");
- }
- std::unique_ptr<ModulePackage> modulePackage(new ModulePackage(moduleSack, repo, mdStream, repoID, concentratedRequires));
- persistor->insert(modulePackage->getName(), path);
- modules.insert(std::make_pair(modulePackage->getId(), std::move(modulePackage)));
- g_object_unref(mdStream);
- }
- modulesV2.clear();
-}
-
void ModulePackageContainer::updateFailSafeData()
{
auto fileNames = getYamlFilenames(pImpl->persistDir.c_str());
diff --git a/libdnf/module/modulemd/ModuleMetadata.cpp b/libdnf/module/modulemd/ModuleMetadata.cpp
index 07817ce1..fbdd8a13 100644
--- a/libdnf/module/modulemd/ModuleMetadata.cpp
+++ b/libdnf/module/modulemd/ModuleMetadata.cpp
@@ -126,8 +126,7 @@ void ModuleMetadata::resolveAddedMetadata()
std::vector<ModulePackage *> ModuleMetadata::getAllModulePackages(DnfSack * moduleSack,
LibsolvRepo * repo,
- const std::string & repoID,
- std::vector<std::tuple<LibsolvRepo *, ModulemdModuleStream *, std::string>> & modulesV2)
+ const std::string & repoID)
{
std::vector<ModulePackage *> result;
if (!resultingModuleIndex)
@@ -141,13 +140,7 @@ std::vector<ModulePackage *> ModuleMetadata::getAllModulePackages(DnfSack * modu
//TODO(amatej): replace with
//GPtrArray * streams = modulemd_module_index_search_streams_by_nsvca_glob(resultingModuleIndex, NULL);
for (unsigned int i = 0; i < streams->len; i++){
- ModulemdModuleStream * moduleMdStream = static_cast<ModulemdModuleStream *>(g_ptr_array_index(streams, i));
- if (modulemd_module_stream_get_mdversion(moduleMdStream) > 2) {
- result.push_back(new ModulePackage(moduleSack, repo, moduleMdStream, repoID));
- } else {
- g_object_ref(moduleMdStream);
- modulesV2.push_back(std::make_tuple(repo, moduleMdStream, repoID));
- }
+ result.push_back(new ModulePackage(moduleSack, repo, (ModulemdModuleStream *) g_ptr_array_index(streams, i), repoID));
}
}
diff --git a/libdnf/module/modulemd/ModuleMetadata.hpp b/libdnf/module/modulemd/ModuleMetadata.hpp
index 901d7402..df753b11 100644
--- a/libdnf/module/modulemd/ModuleMetadata.hpp
+++ b/libdnf/module/modulemd/ModuleMetadata.hpp
@@ -36,7 +36,7 @@ public:
~ModuleMetadata();
void addMetadataFromString(const std::string & yaml, int priority);
void resolveAddedMetadata();
- std::vector<ModulePackage *> getAllModulePackages(DnfSack * moduleSack, LibsolvRepo * repo, const std::string & repoID, std::vector<std::tuple<LibsolvRepo *, ModulemdModuleStream *, std::string>> & modulesV2);
+ std::vector<ModulePackage *> getAllModulePackages(DnfSack * moduleSack, LibsolvRepo * repo, const std::string & repoID);
std::map<std::string, std::string> getDefaultStreams();
std::vector<std::string> getDefaultProfiles(std::string moduleName, std::string moduleStream);
ModulemdObsoletes * getNewestActiveObsolete(ModulePackage *p);
--
2.31.1

77
SOURCES/0013-Revert-Add-an-alternative-constructor-for-ModulePack.patch

@ -0,0 +1,77 @@
From b1ed6e111ce05f8f1fe7b35afc1a3ef6f0731f7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 13/19] Revert "Add an alternative constructor for
ModulePackage"
This reverts commit d05bb263de6822c13ac4bd5cca3628318f5c7ce7.
---
libdnf/module/ModulePackage.cpp | 24 ++++++++++++------------
libdnf/module/ModulePackage.hpp | 2 +-
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/libdnf/module/ModulePackage.cpp b/libdnf/module/ModulePackage.cpp
index 63ee1656..8126bcaa 100644
--- a/libdnf/module/ModulePackage.cpp
+++ b/libdnf/module/ModulePackage.cpp
@@ -43,16 +43,16 @@ extern "C" {
namespace libdnf {
-/**
- * @brief create solvable with:
- * Name: $name:$stream:$context
- * Version: $version
- * Arch: $arch (If arch is not defined, set "noarch")
- * Provides: module($name)
- * Provides: module($name:$stream)
- */
-static void setSovable(Pool * pool, Solvable * solvable, const std::string & name,
- const std::string & stream, const std::string & version, const std::string & context, const char * arch)
+ /**
+ * @brief create solvable with:
+ * Name: $name:$stream:$context
+ * Version: $version
+ * Arch: $arch (If arch is not defined, set "noarch")
+ * Provides: module($name)
+ * Provides: module($name:$stream)
+ */
+ static void setSovable(Pool * pool, Solvable *solvable, std::string & name,
+ std::string & stream, std::string & version, std::string & context, const char * arch)
{
std::ostringstream ss;
// Name: $name:$stream:$context
@@ -86,7 +86,7 @@ static std::pair<std::string, std::string> parsePlatform(const std::string & pla
}
ModulePackage::ModulePackage(DnfSack * moduleSack, LibsolvRepo * repo,
- ModulemdModuleStream * mdStream, const std::string & repoID, const std::string & context)
+ ModulemdModuleStream * mdStream, const std::string & repoID)
: mdStream(mdStream)
, moduleSack(moduleSack)
, repoID(repoID)
@@ -98,7 +98,7 @@ ModulePackage::ModulePackage(DnfSack * moduleSack, LibsolvRepo * repo,
id = repo_add_solvable(repo);
Solvable *solvable = pool_id2solvable(pool, id);
- setSovable(pool, solvable, getName(), getStream(), getVersion(), context.empty() ? getContext() : context, getArchCStr());
+ setSovable(pool, solvable, getName(), getStream(), getVersion(), getContext(), getArchCStr());
createDependencies(solvable);
HyRepo hyRepo = static_cast<HyRepo>(repo->appdata);
libdnf::repoGetImpl(hyRepo)->needs_internalizing = 1;
diff --git a/libdnf/module/ModulePackage.hpp b/libdnf/module/ModulePackage.hpp
index 145c6d63..47cc995c 100644
--- a/libdnf/module/ModulePackage.hpp
+++ b/libdnf/module/ModulePackage.hpp
@@ -95,7 +95,7 @@ private:
friend struct ModuleMetadata;
ModulePackage(DnfSack * moduleSack, LibsolvRepo * repo,
- ModulemdModuleStream * mdStream, const std::string & repoID, const std::string & context = {});
+ ModulemdModuleStream * mdStream, const std::string & repoID);
ModulePackage(const ModulePackage & mpkg);
ModulePackage & operator=(const ModulePackage & mpkg);
--
2.31.1

113
SOURCES/0014-Revert-Adjust-modular-solver-to-new-context-type.patch

@ -0,0 +1,113 @@
From 6c9540be5ac3e3bc3f9a60133b402945705b934f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 14/19] Revert "Adjust modular solver to new context type"
This reverts commit 921d4db62cda41f7999aff67882ad0c01c766916.
---
libdnf/module/ModulePackageContainer.cpp | 46 +++++-------------------
1 file changed, 8 insertions(+), 38 deletions(-)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index 6e6134d2..c0ad1260 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -49,28 +49,6 @@ extern "C" {
#include "modulemd/ModuleMetadata.hpp"
#include "modulemd/ModuleProfile.hpp"
-
-namespace {
-
-/// Requires resolved goal
-/// Takes listInstalls() from goal and keep solvables with the solvable-name (<name>:<stream>:<context>) in query
-void goal2name_query(libdnf::Goal & goal, libdnf::Query & query)
-{
- auto pool = dnf_sack_get_pool(goal.getSack());
- auto installList = goal.listInstalls();
- std::vector<const char *> module_names;
- Id id = -1;
- while ((id = installList.next(id)) != -1) {
- Solvable * s = pool_id2solvable(pool, id);
- const char * name = pool_id2str(pool, s->name);
- module_names.push_back(name);
- }
- module_names.push_back(nullptr);
- query.addFilter(HY_PKG_NAME, HY_EQ, module_names.data());
-}
-
-}
-
namespace std {
template<>
@@ -651,14 +629,14 @@ ModulePackageContainer::Impl::moduleSolve(const std::vector<ModulePackage *> & m
for (const auto &module : modules) {
std::ostringstream ss;
auto name = module->getName();
- ss << "module(" << name << ":" << module->getStream() << ")";
+ ss << "module(" << name << ":" << module->getStream() << ":" << module->getVersion() << ")";
Selector selector(moduleSack);
bool optional = persistor->getState(name) == ModuleState::DEFAULT;
selector.set(HY_PKG_PROVIDES, HY_EQ, ss.str().c_str());
goal.install(&selector, optional);
goalWeak.install(&selector, true);
}
- auto ret = goal.run(static_cast<DnfGoalActions>(DNF_IGNORE_WEAK | DNF_FORCE_BEST));
+ auto ret = goal.run(DNF_IGNORE_WEAK);
if (debugSolver) {
goal.writeDebugdata("debugdata/modules");
}
@@ -666,7 +644,7 @@ ModulePackageContainer::Impl::moduleSolve(const std::vector<ModulePackage *> & m
auto problemType = ModulePackageContainer::ModuleErrorType::NO_ERROR;
if (ret) {
problems = goal.describeAllProblemRules(false);
- ret = goal.run(DNF_FORCE_BEST);
+ ret = goal.run(DNF_NONE);
if (ret) {
// Conflicting modules has to be removed otherwice it could result than one of them will
// be active
@@ -680,20 +658,14 @@ ModulePackageContainer::Impl::moduleSolve(const std::vector<ModulePackage *> & m
activatedModules.reset();
} else {
problemType = ModulePackageContainer::ModuleErrorType::ERROR;
- Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
- goal2name_query(goalWeak, query);
- activatedModules.reset(new PackageSet(*query.runSet()));
+ activatedModules.reset(new PackageSet(std::move(goalWeak.listInstalls())));
}
} else {
problemType = ModulePackageContainer::ModuleErrorType::ERROR_IN_DEFAULTS;
- Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
- goal2name_query(goal, query);
- activatedModules.reset(new PackageSet(*query.runSet()));
+ activatedModules.reset(new PackageSet(std::move(goal.listInstalls())));
}
} else {
- Query query(moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES);
- goal2name_query(goal, query);
- activatedModules.reset(new PackageSet(*query.runSet()));
+ activatedModules.reset(new PackageSet(std::move(goal.listInstalls())));
}
return make_pair(problems, problemType);
}
@@ -735,14 +707,12 @@ ModulePackageContainer::query(std::string name, std::string stream, std::string
query.available();
std::ostringstream ss;
ss << stringFormater(name) << ":" << stringFormater(stream);
- ss << ":" << stringFormater(context);
+ ss << ":" << stringFormater(version) << ":";
+ ss << stringFormater(context);
query.addFilter(HY_PKG_NAME, HY_GLOB, ss.str().c_str());
if (!arch.empty()) {
query.addFilter(HY_PKG_ARCH, HY_GLOB, arch.c_str());
}
- if (!version.empty()) {
- query.addFilter(HY_PKG_VERSION, HY_GLOB, version.c_str());
- }
auto pset = query.runSet();
Id moduleId = -1;
while ((moduleId = pset->next(moduleId)) != -1) {
--
2.31.1

65
SOURCES/0015-Revert-Change-usage-of-context-and-version-in-modula.patch

@ -0,0 +1,65 @@
From 50aa9f29dbfc1523a3b6aea41c6caa37f30c1bf0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Sun, 25 Apr 2021 19:47:53 +0200
Subject: [PATCH 15/19] Revert "Change usage of context and version in modular
solver"
This reverts commit 1f4c5b2a37ec333b23a12b882b046fac858155aa.
---
libdnf/module/ModulePackage.cpp | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/libdnf/module/ModulePackage.cpp b/libdnf/module/ModulePackage.cpp
index 8126bcaa..eea4a8b5 100644
--- a/libdnf/module/ModulePackage.cpp
+++ b/libdnf/module/ModulePackage.cpp
@@ -43,25 +43,19 @@ extern "C" {
namespace libdnf {
- /**
- * @brief create solvable with:
- * Name: $name:$stream:$context
- * Version: $version
- * Arch: $arch (If arch is not defined, set "noarch")
- * Provides: module($name)
- * Provides: module($name:$stream)
- */
- static void setSovable(Pool * pool, Solvable *solvable, std::string & name,
- std::string & stream, std::string & version, std::string & context, const char * arch)
+static void setSovable(Pool * pool, Solvable *solvable, std::string name,
+ std::string stream, std::string version, std::string context, const char * arch)
{
std::ostringstream ss;
- // Name: $name:$stream:$context
- ss << name << ":" << stream << ":" << context;
+ // create solvable with:
+ // Name: $name:$stream:$version:$context
+ // Version: 0
+ // Arch: $arch
+ ss << name << ":" << stream << ":" << version << ":" << context;
solvable_set_str(solvable, SOLVABLE_NAME, ss.str().c_str());
- solvable_set_str(solvable, SOLVABLE_EVR, version.c_str());
+ solvable_set_str(solvable, SOLVABLE_EVR, "0");
// TODO Test can be remove when modules will be always with arch
solvable_set_str(solvable, SOLVABLE_ARCH, arch ? arch : "noarch");
-
// create Provide: module($name)
ss.str(std::string());
ss << "module(" << name << ")";
@@ -73,6 +67,12 @@ namespace libdnf {
ss << "module(" << name << ":" << stream << ")";
depId = pool_str2id(pool, ss.str().c_str(), 1);
solvable_add_deparray(solvable, SOLVABLE_PROVIDES, depId, -1);
+
+ // create Provide: module($name:$stream:$version)
+ ss.str(std::string());
+ ss << "module(" << name << ":" << stream << ":" << version << ")";
+ depId = pool_str2id(pool, ss.str().c_str(), 1);
+ solvable_add_deparray(solvable, SOLVABLE_PROVIDES, depId, -1);
}
--
2.31.1

34
SOURCES/0016-Fix-failing-unittest-caused-by-the-revert-of-new-mod.patch

@ -0,0 +1,34 @@
From faaa64a51445b6edffe6f1e65c465dea63f11bf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Tue, 27 Apr 2021 10:24:53 +0200
Subject: [PATCH 16/19] Fix failing unittest, caused by the revert of new
modular implementation
The problem is not caused by advisory filtering which we are testing
here, the `query` is already created with just one package.
---
tests/libdnf/sack/QueryTest.cpp | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tests/libdnf/sack/QueryTest.cpp b/tests/libdnf/sack/QueryTest.cpp
index ee9eeaf4..7c3a22af 100644
--- a/tests/libdnf/sack/QueryTest.cpp
+++ b/tests/libdnf/sack/QueryTest.cpp
@@ -139,13 +139,10 @@ void QueryTest::testQueryFilterAdvisory()
dnf_sack_filter_modules_v2(sack, modules, nullptr, tmpdir, nullptr, true, false, false);
query = new libdnf::Query(sack);
query->addFilter(HY_PKG_ADVISORY_TYPE, HY_EQ, "enhancement");
- CPPUNIT_ASSERT(query->size() == 2);
+ CPPUNIT_ASSERT(query->size() == 1);
libdnf::PackageSet pset2 = *(query->getResultPset());
pkg = dnf_package_new(sack, pset2[0]);
CPPUNIT_ASSERT(!g_strcmp0(dnf_package_get_name(pkg), "test-perl-DBI"));
g_object_unref(pkg);
- pkg = dnf_package_new(sack, pset2[1]);
- CPPUNIT_ASSERT(!g_strcmp0(dnf_package_get_name(pkg), "test-perl-DBI"));
- g_object_unref(pkg);
delete query;
}
--
2.31.1

274
SOURCES/0017-Modify-unit-test-after-change-of-handling-advisories.patch

@ -0,0 +1,274 @@
From a61b0105aafeea8487902463f789e6ed00021eb3 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Wed, 5 May 2021 15:55:43 +0200
Subject: [PATCH 17/19] Modify unit test after change of handling advisories
The patch modifies also yaml with multicollection situation by adding
module requires.
---
data/tests/advisories/modules.yaml | 6 +++++
.../tests/advisories/repodata/modules.yaml.gz | Bin 300 -> 332 bytes
data/tests/advisories/repodata/primary.xml.gz | Bin 743 -> 743 bytes
data/tests/advisories/repodata/repomd.xml | 24 +++++++++---------
tests/libdnf/sack/AdvisoryTest.cpp | 22 ++++++----------
tests/libdnf/sack/QueryTest.cpp | 24 ++++++++----------
6 files changed, 37 insertions(+), 39 deletions(-)
diff --git a/data/tests/advisories/modules.yaml b/data/tests/advisories/modules.yaml
index 6db5053a..b5f23f7d 100644
--- a/data/tests/advisories/modules.yaml
+++ b/data/tests/advisories/modules.yaml
@@ -32,6 +32,9 @@ data:
license:
module:
- MIT
+ dependencies:
+ - requires:
+ perl: ["5.23"]
profiles:
default:
rpms: ["test-perl-DBI"]
@@ -52,6 +55,9 @@ data:
license:
module:
- MIT
+ dependencies:
+ - requires:
+ perl: ["5.25"]
profiles:
default:
rpms: ["test-perl-DBI"]
diff --git a/data/tests/advisories/repodata/modules.yaml.gz b/data/tests/advisories/repodata/modules.yaml.gz
index 7158e6c515720c87373762d722e9c438ac7fd8d3..ed39532dfcdec084a661d51d86e07bd3e4246f69 100644
GIT binary patch
literal 332
zcmV-S0ki%eiwFP!000001I>{=Ps1<}hWGr6Q`gE7ag#Rnz<^jfATh8ZR2}w3Sc;us
zJE;77+&V2`Kt&yZ?cV$H`F$8;nd;<V$OZwXQ$tHeWpCuX?yLZwDGVqw0E>nM^yJzo
zd~k$Dz^uyoVipspfg%do*+9Fv4>2lq@<qU|UT&A=esnMf-MfJMv`UeePWRz3ea&J9
zj-^&hvYx~tmu^cjgS*W`jC$8Kx+R~oiW(f+kOYA1jX%Z=0{Otk>(K?>pbTUAvvJbK
zu0;G>$%;HZyrs6DS4GX|H7^S!#q;q?d7fwN0vp-w&1Pz)K_AF{F_TZt<j-f!92b6P
z=vY2$s-m8(A}e(=mVu+!K|4CRxxZe(<DUJ~g%rkPencX+Mj8d<QxwapUd`9_YK@Jn
eejSDUe<-TIL$NBWgd)&lisAzcI?AeD1ONa}51~l_
literal 300
zcmV+{0n`2;iwFP!000001Kp56Ps1<}#rJ%QQ`g85ar4LZz<^jfATh94hka2a*-2zO
zsC;`&okAE82nhzZd++X^&p*akrbjhf8iE8n>e-Oh*%LY6kAnoBX$&YcfB`K@n8=wZ
zd~k$T!lo|xb`y=ag)#~?4uMWF4>2lq>L}qPnnP2)uFlq?dzNsYqBMEs`YD{ZuUT~9
z(lWiG!IM0D>9$lexZ6L(YI0-O8}iB3)ZuJG5&&+p{!%jt<O5r-M;H1IRan~ZgR3!i
zCF9>JRu<{u0~wLmrQo^XRf(i|v3#j0ij4gLBfGuXuTfg`f!qg}d<~O7egSg{{0!*Q
y{uQW8_P4;s(FnI>d`-5gMVs$LyTi`ae@<5YXR>WoC$fRIYqBpd!@UUm0{{Tgm5(X_
diff --git a/data/tests/advisories/repodata/primary.xml.gz b/data/tests/advisories/repodata/primary.xml.gz
index da9ffaf08328659c47be8721a9c478ff64ba0a4d..96cbaa2a5a2361b1e5cd59ddb7de937339982c5f 100644
GIT binary patch
literal 743
zcmV<D0vP=tiwFP!000001Lao9Zrd;rz2_?ko>~O9B%0I`ND2@%1#&3RBI%*0fTBhg
zVQr-(BktFi)Dqj>k`zsgpnzeM!#6X0Z#V;o=XYg+wxC*BR}prWHbzj1I+fKr!XIzm
zE_{3*pM)iJJmnon8eX*#&bzKTv#df^{oOL{H?V}Xw`P<j>awgWJfhE3Q$FaSF&H&m