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

109 lines
5.1 KiB
Diff

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