Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libdnf for openSUSE:Factory checked 
in at 2021-02-17 18:09:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libdnf (Old)
 and      /work/SRC/openSUSE:Factory/.libdnf.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libdnf"

Wed Feb 17 18:09:53 2021 rev:23 rq:871993 version:0.58.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/libdnf/libdnf.changes    2021-02-07 
15:18:00.777666998 +0100
+++ /work/SRC/openSUSE:Factory/.libdnf.new.28504/libdnf.changes 2021-02-17 
18:09:55.113861012 +0100
@@ -1,0 +2,19 @@
+Sat Feb 13 17:23:23 UTC 2021 - Neal Gompa <[email protected]>
+
+- Backport another fix for adding controls to installonlypkgs
+  + Patch: 0001-context-Fix-dnf_package_is_installonly-RhBug-1928056.patch
+
+-------------------------------------------------------------------
+Sat Feb 13 16:58:25 UTC 2021 - Neal Gompa <[email protected]>
+
+- Add patch to move directory for dnf state data to /usr/lib/sysimage
+ + Patch: libdnf-0.58.0-Use-usr-lib-sysimage-for-the-persistent-state-dir.patch
+
+-------------------------------------------------------------------
+Fri Feb 12 13:30:06 UTC 2021 - Neal Gompa <[email protected]>
+
+- Backport fixes to add controls for installonlypkgs and protected_packages
+  + Patch: 0001-context-Support-config-file-option-installonlypkgs.patch
+  + Patch: 0002-context-Support-config-file-option-protected_package.patch
+
+-------------------------------------------------------------------

New:
----
  0001-context-Fix-dnf_package_is_installonly-RhBug-1928056.patch
  0001-context-Support-config-file-option-installonlypkgs.patch
  0002-context-Support-config-file-option-protected_package.patch
  libdnf-0.58.0-Use-usr-lib-sysimage-for-the-persistent-state-dir.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libdnf.spec ++++++
--- /var/tmp/diff_new_pack.ebPJ2O/_old  2021-02-17 18:09:55.845861611 +0100
+++ /var/tmp/diff_new_pack.ebPJ2O/_new  2021-02-17 18:09:55.849861614 +0100
@@ -42,6 +42,9 @@
 Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
 
 # Backports from upstream
+Patch0001:      0001-context-Support-config-file-option-installonlypkgs.patch
+Patch0002:      0002-context-Support-config-file-option-protected_package.patch
+Patch0003:      0001-context-Fix-dnf_package_is_installonly-RhBug-1928056.patch
 
 # Fixes proposed upstream
 
@@ -52,6 +55,8 @@
 Patch1001:      libdnf-0.54.2-Switch-default-reposdir-to-etc-dnf-repos.d.patch
 ## Switch allow_vendor_change off by default
 Patch1002:      libdnf-0.55.0-Switch-allow_vendor_change-off.patch
+## Migrate DNF persistent state directory to /usr/lib/sysimage
+Patch1003:      
libdnf-0.58.0-Use-usr-lib-sysimage-for-the-persistent-state-dir.patch
 
 BuildRequires:  cmake
 BuildRequires:  gcc

++++++ 0001-context-Fix-dnf_package_is_installonly-RhBug-1928056.patch ++++++
>From 1c0627ae37742dce3e3ba08c1f37fe739f862082 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <[email protected]>
Date: Fri, 12 Feb 2021 12:47:17 +0100
Subject: [PATCH] [context] Fix: dnf_package_is_installonly (RhBug:1928056)

The previous implementation of "dnf_package_is_installonly" incorrectly used
the "dnf_context_get_installonly_pkgs" function. Instead of the required
argument - a pointer to "context" - it passed NULL.
The old version of "dnf_context_get_installonly_pkgs" with NULL happened
to work even though according to the documentation it requires a pointer
to "context". But, after its update, the problem came.

https://bugzilla.redhat.com/show_bug.cgi?id=1928056
---
 libdnf/dnf-package.cpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/libdnf/dnf-package.cpp b/libdnf/dnf-package.cpp
index 5d5521b4..9eef6a57 100644
--- a/libdnf/dnf-package.cpp
+++ b/libdnf/dnf-package.cpp
@@ -41,6 +41,7 @@
 #include <memory>
 
 #include "catch-error.hpp"
+#include "dnf-context.hpp"
 #include "dnf-package.h"
 #include "dnf-types.h"
 #include "dnf-utils.h"
@@ -655,15 +656,13 @@ dnf_package_is_downloaded(DnfPackage *pkg)
 gboolean
 dnf_package_is_installonly(DnfPackage *pkg)
 {
-    const gchar **installonly_pkgs;
-    const gchar *pkg_name;
-    guint i;
-
-    installonly_pkgs = dnf_context_get_installonly_pkgs(NULL);
-    pkg_name = dnf_package_get_name(pkg);
-    for (i = 0; installonly_pkgs[i] != NULL; i++) {
-        if (g_strcmp0(pkg_name, installonly_pkgs[i]) == 0)
-            return TRUE;
+    if (auto * pkg_name = dnf_package_get_name(pkg)) {
+        auto & mainConf = libdnf::getGlobalMainConfig();
+        for (auto & inst_only_pkg_name : 
mainConf.installonlypkgs().getValue()) {
+            if (inst_only_pkg_name == pkg_name) {
+                return TRUE;
+            }
+        }
     }
     return FALSE;
 }
-- 
2.29.2

++++++ 0001-context-Support-config-file-option-installonlypkgs.patch ++++++
>From 3889d693b0b497afa721237ac5aba8c767b77249 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <[email protected]>
Date: Mon, 8 Feb 2021 08:08:28 +0100
Subject: [PATCH 1/2] [context] Support config file option "installonlypkgs"

The "installonlypkgs" option was ignored. Instead, a hard-coded list
of installation packages was always used.
It now works as in DNF.

= changelog =
msg: Support main config file option "installonlypkgs".
     Changes behaviour of microdnf and PackageKit.
type: bugfix
---
 libdnf/dnf-context.cpp | 47 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 38 insertions(+), 9 deletions(-)

diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 682f3bdf..28b23330 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -137,6 +137,7 @@ typedef struct
 {
     gchar            **repos_dir;
     gchar            **vars_dir;
+    gchar            **installonlypkgs;
     gchar            *base_arch;
     gchar            *release_ver;
     gchar            *platform_module;
@@ -220,6 +221,7 @@ dnf_context_finalize(GObject *object)
 
     g_strfreev(priv->repos_dir);
     g_strfreev(priv->vars_dir);
+    g_strfreev(priv->installonlypkgs);
     g_free(priv->base_arch);
     g_free(priv->release_ver);
     g_free(priv->platform_module);
@@ -1092,20 +1094,47 @@ dnf_context_get_cache_age(DnfContext *context)
  *
  * Gets the packages that are allowed to be installed more than once.
  *
+ * The return value is valid until the value of the global configuration 
"installonlypkgs" changes.
+ * E.g. using dnf_conf_main_set_option() or dnf_conf_add_setopt().
+ *
  * Returns: (transfer none): array of package names
  */
 const gchar **
 dnf_context_get_installonly_pkgs(DnfContext *context)
 {
-    static const gchar *installonly_pkgs[] = {
-        "kernel",
-        "kernel-PAE",
-        "installonlypkg(kernel)",
-        "installonlypkg(kernel-module)",
-        "installonlypkg(vm)",
-        "multiversion(kernel)",
-        NULL };
-    return installonly_pkgs;
+    DnfContextPrivate *priv = GET_PRIVATE(context);
+    auto & mainConf = libdnf::getGlobalMainConfig();
+    auto & packages = mainConf.installonlypkgs().getValue();
+
+    // If "installonlypkgs" is not initialized (first run), set "differs" to 
true.
+    bool differs = !priv->installonlypkgs;
+
+    // Test if they are not different.
+    if (!differs) {
+        size_t i = 0;
+        while (i < packages.size()) {
+            if (!priv->installonlypkgs[i] || 
packages[i].compare(priv->installonlypkgs[i]) != 0) {
+                differs = true;
+                break;
+            }
+            ++i;
+        }
+        if (priv->installonlypkgs[i]) {
+            differs = true;
+        }
+    }
+
+    // Re-initialize "installonlypkgs" only if it differs from the values in 
mainConf.
+    if (differs) {
+        g_strfreev(priv->installonlypkgs);
+        priv->installonlypkgs = g_new0(gchar*, packages.size() + 1);
+
+        for (size_t i = 0; i < packages.size(); ++i) {
+            priv->installonlypkgs[i] = g_strdup(packages[i].c_str());
+        }
+    }
+
+    return const_cast<const gchar **>(priv->installonlypkgs);
 }
 
 /**
-- 
2.29.2

++++++ 0002-context-Support-config-file-option-protected_package.patch ++++++
>From c48791a37827b2d18683cae3a4883ebd0b0b78c0 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <[email protected]>
Date: Fri, 4 Dec 2020 09:36:50 +0100
Subject: [PATCH 2/2] [context] Support config file option "protected_packages"

The "protected_packages" were ignored.
Now dnf_goal_depsolve() takes into account the "protected_packages"
configuration.

= changelog =
msg: Support main config file option "protected_packages".
     Changes behaviour of microdnf and PackageKit.
type: bugfix
---
 libdnf/dnf-goal.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libdnf/dnf-goal.cpp b/libdnf/dnf-goal.cpp
index e27727f3..b877eaca 100644
--- a/libdnf/dnf-goal.cpp
+++ b/libdnf/dnf-goal.cpp
@@ -40,11 +40,14 @@
 #include "dnf-package.h"
 #include "hy-packageset-private.hpp"
 #include "hy-iutil-private.hpp"
+#include "dnf-context.hpp"
 #include "dnf-sack-private.hpp"
 #include "dnf-utils.h"
 #include "utils/bgettext/bgettext-lib.h"
 #include "../goal/Goal.hpp"
 
+#include <vector>
+
 /**
  * dnf_goal_depsolve:
  * @goal: a #HyGoal.
@@ -63,6 +66,20 @@ dnf_goal_depsolve(HyGoal goal, DnfGoalActions flags, GError 
**error) try
     gint rc;
     g_autoptr(GString) string = NULL;
 
+    DnfSack * sack = hy_goal_get_sack(goal);
+
+    libdnf::Query query(sack);
+    const auto & protected_packages = 
libdnf::getGlobalMainConfig().protected_packages().getValue();
+    std::vector<const char *> cprotected_packages;
+    cprotected_packages.reserve(protected_packages.size() + 1);
+    for (const auto & package : protected_packages) {
+        cprotected_packages.push_back(package.c_str());
+    }
+    cprotected_packages.push_back(nullptr);
+    query.addFilter(HY_PKG_NAME, HY_EQ, cprotected_packages.data());
+    auto pkgset = *query.runSet();
+    goal->addProtected(pkgset);
+
     rc = hy_goal_run_flags(goal, flags);
     if (rc) {
         string = g_string_new(_("Could not depsolve transaction; "));
@@ -101,7 +118,6 @@ dnf_goal_depsolve(HyGoal goal, DnfGoalActions flags, GError 
**error) try
                             "The transaction was empty");
         return FALSE;
     }
-    DnfSack * sack = hy_goal_get_sack(goal);
     auto moduleContainer = dnf_sack_get_module_container(sack);
     if (moduleContainer) {
         auto installSet = goal->listInstalls();
-- 
2.29.2

++++++ libdnf-0.58.0-Use-usr-lib-sysimage-for-the-persistent-state-dir.patch 
++++++
>From 59a89fc7ec6153c94666afa4faa4666d5767f035 Mon Sep 17 00:00:00 2001
From: Neal Gompa <[email protected]>
Date: Mon, 8 Feb 2021 09:17:27 -0500
Subject: [PATCH] Use /usr/lib/sysimage for the persistent state directory

This aligns us with the location where the RPM database is stored.
---
 libdnf/conf/Const.hpp       | 2 +-
 libdnf/transaction/Swdb.hpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libdnf/conf/Const.hpp b/libdnf/conf/Const.hpp
index ba21bbe6..ae981ebe 100644
--- a/libdnf/conf/Const.hpp
+++ b/libdnf/conf/Const.hpp
@@ -26,7 +26,7 @@
 
 namespace libdnf {
 
-constexpr const char * PERSISTDIR = "/var/lib/dnf";
+constexpr const char * PERSISTDIR = "/usr/lib/sysimage/dnf";
 constexpr const char * SYSTEM_CACHEDIR = "/var/cache/dnf";
 
 constexpr const char * CONF_FILENAME = "/etc/dnf/dnf.conf";
diff --git a/libdnf/transaction/Swdb.hpp b/libdnf/transaction/Swdb.hpp
index 5b2342c8..e0fac438 100644
--- a/libdnf/transaction/Swdb.hpp
+++ b/libdnf/transaction/Swdb.hpp
@@ -54,7 +54,7 @@ public:
 
     // Database
     // FIXME load this from conf
-    static constexpr const char *defaultPath = "/var/lib/dnf/history.sqlite";
+    static constexpr const char *defaultPath = 
"/usr/lib/sysimage/dnf/history.sqlite";
     static constexpr const char *defaultDatabaseName = "history.sqlite";
 
     const std::string &getPath() { return conn->getPath(); }
-- 
2.29.2

Reply via email to