chantra / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone
Blob Blame History Raw
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