import libdnf-0.63.0-1.el8

This commit is contained in:
CentOS Sources 2021-06-24 04:25:15 +00:00 committed by Andrew Lukoshko
parent d104fa32e0
commit 9a4eaef084
30 changed files with 1660 additions and 5333 deletions

2
.gitignore vendored
View File

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

View File

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

View File

@ -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());
}

View File

@ -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

View File

@ -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

View File

@ -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());

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
zZ1@^<e1dh-X^XmD0}(ce_ynP_;w8i#wB4csRV?0IT!q$PGlyJ>JihbYTbG8`urbz&
zAcCeAd4x4dZP9cwQc&n@%d$@U0&b!3PhIAFr-APUJW~u?gTKf@Y}&q@uF~e5FjwDq
zvzBRuKV4qqc$Eb!8hEKs2%}j*IQ0ebAY}{^!F=%3#H9{l`Y>@gB?&m5V>{r|AoIZ2
zx1Ey=8TD_;)o$Ra)1ddG7NIpC7*GnWP_pSXwfN*Fmo3sCj%Hbqah^pDts}Jdo(@zT
zTK7w1?^U5q=G*K#Spv#rp=moVv3)HJ)zp(-7Mi-ld=@yAIAl_)m0w^^8DZD<DMqqt
zJ6;r!4$7ON$gK%S=;Tz?f}3lhTtOD$quMT<#m~#L94oyvZ(|IV)vDy3S?Y~8pA}L-
z)k6I4>L#=f4SUEIs<bvT9BlTdYgPA6e7$QsDA8rLm8z~vs5<L{w=nvQkiE+wPF}ZN
zY?u{hH3IhsdvII#N`PL)PvG4uVMvcr_Yw9{bKohch2oWNAT7V@B21Z0O?#)NFw`Cu
zoA8aQw^F~5(KHz~OSMC$x4tO~Mp?nvx=$}Z;NNYkhqJuW)m^ys^`FT$YIV$W$gkjY
zFV$nH|LP)aIX~w))nVMwnjhwUv;DgP=TSDQ)4}TT1CDdwag)qW1VF|-lF*b;;bZ|1
zAaQI#T&4p%e8n;rxT^$g0fA4l#Lc{bQ1?X-INM$QwE=fnp8sjU9r1o~1Md5#dd>m&
ZqioMV;M}JUxcmQi@mJ$x7+z@#006pgY0dxu
literal 743
zcmV<D0vP=tiwFP!000001LamrZ`&{ozV}xMI&CNtTZ-gIVY@)F4(MUPhIWUY3R$LO
zBYsV`gJ!>ek{?a7SKDFTPz(qXk^D&NBSj*?`CVC{EvPoHs}Pf=jS*C`PV#CU;*U3P
z7al&3PJ$9Tk%&$p4X@e|XI<BvSyqu({oOL@H?V}Hw`P<j>$0pXJfhE3Q$FaSF&H&M
zZp0dNe2R6_NkrYQfe;%+bb?S&i4vj?+HTQ+Di&`pt^#Y&8KY1#i|#z<)?tA)2u3>*
zM9|bS3$Z4tHJUC)3JRTVS=LEkz%3Nsslz?@)c0Ipq>5u}@Ru3LP1~2#RoYBY?&$k&
z)_D@*PnXv?TBZJq`EKG-%311D!8}P_NH~XBau2*Db{L^t8)G6Eje)qtCg3nXb-~lO
zos$e1^=~QEZs4iYp!Z`f0&6xHPy($~dDCfX(aBAgw@7~kn#+QW^IX)xIznsj$)KXZ
zx<49yuL`X)-$v^45>T2Knl^C=^<0m+ntI&lg{Drp$9=*mp;M*W{0qz}L+scd!zi!X
zP80<sL*-3V@~sI++2mBzQkZL@OhFprquwsa;^*yIj-6hbw=srFYgLNQ9JQd;XGJcd
zY9V@ebrV>JialftRZ^QW90+^sTGf3MUGLfsN_1Imb5&O*RGoDpS{Qvs$lhfrPFA;F
zWSAA^Gy?aAJ-DrVB|)E}C-82SG^EF<`w07}8HfbbLWxQbkS@RKLd>|$%y=iJG0Yw-
zHsKppZ*%=ZM%AR$EY%K~+4`m_7^Q_+>p8vrfPZ(W9?tSgcX#2i*MBD4SgT{6Lw*IH
z`&>PS`mZj+m-BO;Qys<)todQy58J<6a4zFxbvjr*e!&Uh5hqUVSOTQnr7=q=lO*+p
z4>7SNb+`^p#EPffcUCdj5`2%Qv6H$!WzLIUaJIAhYYXnMJ^#~!JL3J~7Totk^_&at
ZN7<f#!8uP|aQFZ3qOUfbJ%VWp006EqV{!lh
diff --git a/data/tests/advisories/repodata/repomd.xml b/data/tests/advisories/repodata/repomd.xml
index 21630e04..c9468e82 100644
--- a/data/tests/advisories/repodata/repomd.xml
+++ b/data/tests/advisories/repodata/repomd.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<repomd xmlns="http://linux.duke.edu/metadata/repo" xmlns:rpm="http://linux.duke.edu/metadata/rpm">
- <revision>1612879414</revision>
+ <revision>1620890113</revision>
<data type="primary">
- <checksum type="sha256">b69e4467719314fdb155872cf9c8e895d5b169c0506c5180c512d693c48f0f4b</checksum>
- <open-checksum type="sha256">8606d1f777859f167f7bd0bf8a1d532abedcb4db143b719e631e1040800fd1f0</open-checksum>
+ <checksum type="sha256">f2f306a22a157730d2f13f09fc36c425b9bedfc0ecaf74d8b60d98222ebb3274</checksum>
+ <open-checksum type="sha256">ef20a9175429f9f223c4bdcd634fc218bdd85799095438d349efea159cfd2bdf</open-checksum>
<location href="repodata/primary.xml.gz"/>
- <timestamp>1612879414</timestamp>
+ <timestamp>1620890113</timestamp>
<size>743</size>
<open-size>2665</open-size>
</data>
@@ -13,7 +13,7 @@
<checksum type="sha256">efbf7f021163a3c7698a257351e327102c60bb39a7bdceee77c421f064205e99</checksum>
<open-checksum type="sha256">ca5620e2734574d04d3c01ae5a72f865313369954698d71776076b9cbd831bbd</open-checksum>
<location href="repodata/filelists.xml.gz"/>
- <timestamp>1612879414</timestamp>
+ <timestamp>1620890113</timestamp>
<size>311</size>
<open-size>511</open-size>
</data>
@@ -21,23 +21,23 @@
<checksum type="sha256">6673953e1f28f55b9d4c3f38a9e3c0e0ff88ad06fb693b7f15eb241a81b80d71</checksum>
<open-checksum type="sha256">0997c242bf1b96372d7a625a73de23dced68cae9375baff0c73215a07693b3f4</open-checksum>
<location href="repodata/other.xml.gz"/>
- <timestamp>1612879414</timestamp>
+ <timestamp>1620890113</timestamp>
<size>310</size>
<open-size>507</open-size>
</data>
<data type="modules">
- <checksum type="sha256">a815d0669b15b97dd6260713405c79045eeda10aedb6460a0f742b86cc236cca</checksum>
- <open-checksum type="sha256">0d1063b74e3a7cb4c7cdc3b2080b1901c347693140765534f8c5c3d8b964778a</open-checksum>
+ <checksum type="sha256">df1abc1ab7dacc6ea2bc16c2b14abeb32d0ec9d9ed01378488cec22540f9607b</checksum>
+ <open-checksum type="sha256">f088c4096bfc4acad99a20e06d0d4381872c10f0f27ff8bbfe1bada658ff7afd</open-checksum>
<location href="repodata/modules.yaml.gz"/>
- <timestamp>1612879414</timestamp>
- <size>300</size>
- <open-size>1019</open-size>
+ <timestamp>1620890113</timestamp>
+ <size>332</size>
+ <open-size>1117</open-size>
</data>
<data type="updateinfo">
<checksum type="sha256">9d791d16c2adc2d7d4c85b45f2a704edac62a926b09fc20df73207f4190acd49</checksum>
<open-checksum type="sha256">3cf7df860860ac7a4a8e64a1a2d71c1ec43225dacbfe09a0cff80f28be3825da</open-checksum>
<location href="repodata/updateinfo.xml.gz"/>
- <timestamp>1612879414</timestamp>
+ <timestamp>1620890113</timestamp>
<size>708</size>
<open-size>2414</open-size>
</data>
diff --git a/tests/libdnf/sack/AdvisoryTest.cpp b/tests/libdnf/sack/AdvisoryTest.cpp
index 805c35da..1abf1a95 100644
--- a/tests/libdnf/sack/AdvisoryTest.cpp
+++ b/tests/libdnf/sack/AdvisoryTest.cpp
@@ -97,11 +97,9 @@ void AdvisoryTest::testGetApplicablePackagesModulesNotSetup()
// When modules are not setup all advisory collections are applicable and we get all packages
advisory->getApplicablePackages(pkgsvector);
- CPPUNIT_ASSERT(pkgsvector.size() == 4);
+ CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(pkgsvector.size()));
CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[0].getNameString(), "test-perl-DBI"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[1].getNameString(), "test-perl-DBI-new-collection-override"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[2].getNameString(), "test-perl-DBI"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[3].getNameString(), "not-present"));
+ CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[1].getNameString(), "not-present"));
}
void AdvisoryTest::testGetApplicablePackagesModulesSetupNoneEnabled()
@@ -122,16 +120,14 @@ void AdvisoryTest::testGetApplicablePackagesOneApplicableCollection()
{
std::vector<libdnf::AdvisoryPkg> pkgsvector;
- // When I keep enabled only perl-DBI module I get packages from all collections that contain that module
+ // When I keep enabled only perl module I get packages from all collections that contain that module
libdnf::ModulePackageContainer * modules = dnf_sack_get_module_container(sack);
- modules->reset("perl");
+ modules->reset("perl-DBI");
dnf_sack_filter_modules_v2(sack, modules, nullptr, tmpdir, nullptr, true, false, false);
advisory->getApplicablePackages(pkgsvector);
- CPPUNIT_ASSERT(pkgsvector.size() == 3);
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[0].getNameString(), "test-perl-DBI"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[1].getNameString(), "test-perl-DBI-new-collection-override"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[2].getNameString(), "test-perl-DBI"));
+ CPPUNIT_ASSERT(pkgsvector.size() == 1);
+ CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[0].getNameString(), "not-present"));
}
void AdvisoryTest::testGetApplicablePackagesMultipleApplicableCollections()
@@ -141,11 +137,9 @@ void AdvisoryTest::testGetApplicablePackagesMultipleApplicableCollections()
// When I enable modules from multiple collections -> I get packages from all applicable collections
// Enabled - "perl-DBI:master", "perl:5.23"
advisory->getApplicablePackages(pkgsvector);
- CPPUNIT_ASSERT(pkgsvector.size() == 4);
+ CPPUNIT_ASSERT(pkgsvector.size() == 2);
CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[0].getNameString(), "test-perl-DBI"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[1].getNameString(), "test-perl-DBI-new-collection-override"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[2].getNameString(), "test-perl-DBI"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[3].getNameString(), "not-present"));
+ CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[1].getNameString(), "not-present"));
}
void AdvisoryTest::testGetModules()
diff --git a/tests/libdnf/sack/QueryTest.cpp b/tests/libdnf/sack/QueryTest.cpp
index 7c3a22af..d4cc28c2 100644
--- a/tests/libdnf/sack/QueryTest.cpp
+++ b/tests/libdnf/sack/QueryTest.cpp
@@ -59,12 +59,13 @@ void QueryTest::testQueryGetAdvisoryPkgs()
HyQuery query = new libdnf::Query(sack);
std::vector<libdnf::AdvisoryPkg> advisoryPkgs;
- // When modules are not setup all advisory collections are applicable
+ // Apply advisory only from active context - receave advisory package only from releted collection
query->getAdvisoryPkgs(HY_EQ, advisoryPkgs);
- CPPUNIT_ASSERT(advisoryPkgs.size() == 2);
- // We get test-perl-DBI twice because its in two collections
- CPPUNIT_ASSERT(!g_strcmp0(advisoryPkgs[0].getNameString(), "test-perl-DBI"));
- CPPUNIT_ASSERT(!g_strcmp0(advisoryPkgs[1].getNameString(), "test-perl-DBI"));
+ CPPUNIT_ASSERT(advisoryPkgs.size() == 1);
+
+ CPPUNIT_ASSERT_EQUAL(std::string("test-perl-DBI"), std::string(advisoryPkgs[0].getNameString()));
+ CPPUNIT_ASSERT_EQUAL(std::string("1-2.module_el8+6587+9879afr5"), std::string(advisoryPkgs[0].getEVRString()));
+ //CPPUNIT_ASSERT(!g_strcmp0(advisoryPkgs[1].getNameString(), "test-perl-DBI"));
// When modules are setup but none are enabled all collections are not applicable - no enabled module
libdnf::ModulePackageContainer * modules = dnf_sack_get_module_container(sack);
@@ -84,15 +85,15 @@ void QueryTest::testQueryGetAdvisoryPkgs()
query->getAdvisoryPkgs(HY_EQ, advisoryPkgs);
CPPUNIT_ASSERT(advisoryPkgs.size() == 0);
- // When I enable a module from multiple collections that contain a present package I get them
+ // When I enable a module with multiple collections I will receave advisory packages only for active context
CPPUNIT_ASSERT(modules->enable("perl-DBI", "master", false));
dnf_sack_filter_modules_v2(sack, modules, nullptr, tmpdir, nullptr, true, false, false);
advisoryPkgs.clear();
query->getAdvisoryPkgs(HY_EQ, advisoryPkgs);
- CPPUNIT_ASSERT(advisoryPkgs.size() == 2);
- CPPUNIT_ASSERT(!g_strcmp0(advisoryPkgs[0].getNameString(), "test-perl-DBI"));
- CPPUNIT_ASSERT(!g_strcmp0(advisoryPkgs[1].getNameString(), "test-perl-DBI"));
+ CPPUNIT_ASSERT(advisoryPkgs.size() == 1);
+ CPPUNIT_ASSERT_EQUAL(std::string("test-perl-DBI"), std::string(advisoryPkgs[0].getNameString()));
+ CPPUNIT_ASSERT_EQUAL(std::string("1-2.module_el8+6587+9879afr5"), std::string(advisoryPkgs[0].getEVRString()));
delete query;
}
@@ -102,16 +103,13 @@ void QueryTest::testQueryFilterAdvisory()
// When modules are not setup all advisory collections are applicable and there is no modular filtering
HyQuery query = new libdnf::Query(sack);
query->addFilter(HY_PKG_ADVISORY_TYPE, HY_EQ, "enhancement");
- CPPUNIT_ASSERT(query->size() == 2);
+ CPPUNIT_ASSERT(query->size() == 1);
// We get test-perl-DBI twice because its in two collections
libdnf::PackageSet pset = *(query->getResultPset());
DnfPackage *pkg = dnf_package_new(sack, pset[0]);
CPPUNIT_ASSERT(!g_strcmp0(dnf_package_get_name(pkg), "test-perl-DBI"));
g_object_unref(pkg);
- pkg = dnf_package_new(sack, pset[1]);
- CPPUNIT_ASSERT(!g_strcmp0(dnf_package_get_name(pkg), "test-perl-DBI"));
- g_object_unref(pkg);
delete query;
// When module are setup but none are enabled all collections are not applicable - no enabled module
--
2.31.1

View File

@ -0,0 +1,34 @@
From c7f0b13bf32cfba63a2db6257c50ae1ba5c8f9ba Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Thu, 6 May 2021 11:18:20 +0200
Subject: [PATCH 18/19] Adjust module error formatting function for original
modular solver
The new solver uses libsolv solvable by another way. The revert requires
also change in formatting function.
---
libdnf/goal/Goal.cpp | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/libdnf/goal/Goal.cpp b/libdnf/goal/Goal.cpp
index a6f11a4f..6b2f91a2 100644
--- a/libdnf/goal/Goal.cpp
+++ b/libdnf/goal/Goal.cpp
@@ -58,12 +58,8 @@ std::string moduleSolvid2str(Pool * pool, Id source)
{
std::ostringstream ss;
auto * solvable = pool_id2solvable(pool, source);
- // Add name:stream
- ss << solvable_lookup_str(solvable, SOLVABLE_DESCRIPTION);
- //Add version
- ss << ":" << pool_id2str(pool, solvable->evr);
- // Add original context
- ss << ":" << solvable_lookup_str(solvable, SOLVABLE_SUMMARY);
+ // Add name:stream:version:context
+ ss << pool_id2str(pool, solvable->name);
ss << "." << pool_id2str(pool, solvable->arch);
return ss.str();
}
--
2.31.1

View File

@ -0,0 +1,57 @@
From eb7217d0a71b92ac0d8c3773caa1a2d3a2c20071 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Thu, 13 May 2021 09:10:42 +0200
Subject: [PATCH 19/19] Remove redundant test
The test is identical to
testGetApplicablePackagesMultipleApplicableCollections().
---
tests/libdnf/sack/AdvisoryTest.cpp | 11 -----------
tests/libdnf/sack/AdvisoryTest.hpp | 2 --
2 files changed, 13 deletions(-)
diff --git a/tests/libdnf/sack/AdvisoryTest.cpp b/tests/libdnf/sack/AdvisoryTest.cpp
index 1abf1a95..f5892634 100644
--- a/tests/libdnf/sack/AdvisoryTest.cpp
+++ b/tests/libdnf/sack/AdvisoryTest.cpp
@@ -91,17 +91,6 @@ void AdvisoryTest::testGetPackages()
CPPUNIT_ASSERT(pkgsvector.size() == 4);
}
-void AdvisoryTest::testGetApplicablePackagesModulesNotSetup()
-{
- std::vector<libdnf::AdvisoryPkg> pkgsvector;
-
- // When modules are not setup all advisory collections are applicable and we get all packages
- advisory->getApplicablePackages(pkgsvector);
- CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(pkgsvector.size()));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[0].getNameString(), "test-perl-DBI"));
- CPPUNIT_ASSERT(!g_strcmp0(pkgsvector[1].getNameString(), "not-present"));
-}
-
void AdvisoryTest::testGetApplicablePackagesModulesSetupNoneEnabled()
{
std::vector<libdnf::AdvisoryPkg> pkgsvector;
diff --git a/tests/libdnf/sack/AdvisoryTest.hpp b/tests/libdnf/sack/AdvisoryTest.hpp
index 6eb25a57..cb0d8c05 100644
--- a/tests/libdnf/sack/AdvisoryTest.hpp
+++ b/tests/libdnf/sack/AdvisoryTest.hpp
@@ -19,7 +19,6 @@ class AdvisoryTest : public CppUnit::TestCase
CPPUNIT_TEST(testGetSeverity);
CPPUNIT_TEST(testGetTitle);
CPPUNIT_TEST(testGetPackages);
- CPPUNIT_TEST(testGetApplicablePackagesModulesNotSetup);
CPPUNIT_TEST(testGetApplicablePackagesModulesSetupNoneEnabled);
CPPUNIT_TEST(testGetApplicablePackagesOneApplicableCollection);
CPPUNIT_TEST(testGetApplicablePackagesMultipleApplicableCollections);
@@ -38,7 +37,6 @@ public:
void testGetSeverity();
void testGetTitle();
void testGetPackages();
- void testGetApplicablePackagesModulesNotSetup();
void testGetApplicablePackagesModulesSetupNoneEnabled();
void testGetApplicablePackagesOneApplicableCollection();
void testGetApplicablePackagesMultipleApplicableCollections();
--
2.31.1

View File

@ -1,10 +1,10 @@
%global libsolv_version 0.7.7
%global libmodulemd_version 2.5.0
%global librepo_version 1.12.0
%global libsolv_version 0.7.17
%global libmodulemd_version 2.11.2-2
%global librepo_version 1.13.1
%global dnf_conflict 4.3.0
%global swig_version 3.0.12
%global libdnf_major_version 0
%global libdnf_minor_version 55
%global libdnf_minor_version 63
%global libdnf_micro_version 0
%define __cmake_in_source_build 1
@ -56,20 +56,30 @@
Name: libdnf
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 7%{?dist}
Release: 1%{?dist}
Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+
URL: https://github.com/rpm-software-management/libdnf
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch0: 0001-Better-msgs-if-basecachedir-or-proxy-password-isn-t-set-RhBug-1888946.patch
Patch1: 0002-modules-Add-special-handling-for-src-artifacts-RhBug-1809314.patch
Patch2: 0003-Avoid-multilib-file-conflict-in-config.h-RhBug-1918818.patch
Patch3: 0004-context-improve-retrieving-repository-configuration.patch
Patch4: 0005-Allow-loading-incomplete-cache-and-loading-ext-solv-files-without-its-repodata.patch
Patch5: 0006-Add-new-option-module-stream-switch.patch
Patch6: 0007-Fix-removal-step-during-modular-enable-in-context-part.patch
Patch7: 0008-Update-translations.patch
Patch1: 0001-Revert-Improve-performance-for-module-query.patch
Patch2: 0002-Revert-Enhance-description-of-modular-solvables.patch
Patch3: 0003-Revert-Fix-typo-lates-latest.patch
Patch4: 0004-Revert-Remove-unused-code-bump-version.patch
Patch5: 0005-Revert-Report-a-new-type-of-the-module-resolve-error.patch
Patch6: 0006-Revert-Add-additional-fallback-for-module-resolve.patch
Patch7: 0007-Revert-Decide-how-to-handle-context-according-to-sta.patch
Patch8: 0008-Revert-Fix-load-update-FailSafe.patch
Patch9: 0009-Revert-Change-mechanism-of-module-conflicts.patch
Patch10: 0010-Revert-Call-addVersion2Modules-as-late-as-possible.patch
Patch11: 0011-Revert-Fix-modular-queries-with-the-new-solver.patch
Patch12: 0012-Revert-Add-compatible-layer-for-MdDocuments-v2.patch
Patch13: 0013-Revert-Add-an-alternative-constructor-for-ModulePack.patch
Patch14: 0014-Revert-Adjust-modular-solver-to-new-context-type.patch
Patch15: 0015-Revert-Change-usage-of-context-and-version-in-modula.patch
Patch16: 0016-Fix-failing-unittest-caused-by-the-revert-of-new-mod.patch
Patch17: 0017-Modify-unit-test-after-change-of-handling-advisories.patch
Patch18: 0018-Adjust-module-error-formatting-function-for-original.patch
Patch19: 0019-Remove-redundant-test.patch
BuildRequires: cmake
BuildRequires: gcc
@ -99,9 +109,9 @@ BuildRequires: gettext
BuildRequires: gpgme-devel
%if %{with sanitizers}
BuildRequires: libasan-static
BuildRequires: liblsan-static
BuildRequires: libubsan-static
BuildRequires: libasan
BuildRequires: liblsan
BuildRequires: libubsan
%endif
Requires: libmodulemd%{?_isa} >= %{libmodulemd_version}
@ -167,11 +177,6 @@ Python 3 bindings for the libdnf library.
Summary: Python 2 bindings for the hawkey library
%{?python_provide:%python_provide python2-hawkey}
BuildRequires: python2-devel
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: python-nose
%else
BuildRequires: python2-nose
%endif
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python2-%{name} = %{version}-%{release}
# Fix problem with hawkey - dnf version incompatibility
@ -189,7 +194,6 @@ Python 2 bindings for the hawkey library.
Summary: Python 3 bindings for the hawkey library
%{?python_provide:%python_provide python3-hawkey}
BuildRequires: python3-devel
BuildRequires: python3-nose
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python3-%{name} = %{version}-%{release}
# Fix problem with hawkey - dnf version incompatibility
@ -203,7 +207,7 @@ Python 3 bindings for the hawkey library.
%endif
%prep
%autosetup -p1
%autosetup -S git -p1
%if %{with python2}
mkdir build-py2
%endif
@ -289,6 +293,9 @@ popd
%dir %{_libdir}/libdnf/
%dir %{_libdir}/libdnf/plugins/
%{_libdir}/libdnf/plugins/README
%if %{with sanitizers}
%{_sysconfdir}/profile.d/dnf-sanitizers.sh
%endif
%files devel
%doc %{_datadir}/gtk-doc/html/%{name}/
@ -317,8 +324,31 @@ popd
%endif
%changelog
* Mon Mar 8 2021 Marek Blaha <mblaha@redhat.com> - 0.55.0-7
- Update translations (RhBug:1820548)
* Wed May 19 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-1
- Update to 0.62.0
- Hardening: add signature check with rpmcliVerifySignatures (RhBug:1932079)
- Support allow_vendor_change setting in dnf context API
- Add a new option module_obsoletes
- Add new API applyObsoletes() function to apply modular obsoletes
- Do not allow 1 as installonly_limit value (RhBug:1926261)
- Add a config option to check TLS certificate revocation status (using OCSP stapling), defaults to false (RhBug:1814383)
- Swdb: Add a method to get the current transaction
- [context,API] Functions for accessing main/global configuration options
- [context,API] Function for adding setopt
- Add getter for modular obsoletes from ModuleMetadata
- Add ModulePackage.getStaticContext() and getRequires()
- Fix modular queries with the new solver
- Fix: Fully set ssl in newHandle function
- [conf] Add options for working with certificates used with proxy
- Modify module NSVCA parsing - context definition (RhBug:1926771)
- [context] Fix: dnf_package_is_installonly (RhBug:1928056)
- Add getApplicablePackages to advisory and isApplicable to advisorymodule
- Keep isAdvisoryApplicable to preserve API
- [context] Support config file option "proxy_auth_method", defaults "any"
- Support main config file options "installonlypkgs" and "protected_packages". Changes behaviour of microdnf and PackageKit.
- Properly handle multiple collections in updateinfo.xml (RhBug:1804234)
- Fix a crash when [media] section in .treeinfo is missing for bootable media (RhBug:1946024)
- Add new dnf_context_module_install() C API
* Fri Feb 12 2021 Nicola Sella <nsella@redhat.com> - 0.55.0-6
- Fix removal step during modular enable in context part