dcavalca / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone

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

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