Blob Blame History Raw
From a22e544907364467c9206fc196a9e43b684465a2 Mon Sep 17 00:00:00 2001
From: Aleš Matěj <amatej@redhat.com>
Date: Tue, 27 Aug 2019 10:54:14 +0200
Subject: [PATCH] Allow downgrade for all transactions microdnf does (RhBug:1725863)

It can sometimes be necessary to satisfy dependencies or if the user
wants to specifically downgrade some package.
---
 dnf/dnf-main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c
index 7c71bd0..693ad7f 100644
--- a/dnf/dnf-main.c
+++ b/dnf/dnf-main.c
@@ -272,12 +272,16 @@ main (int   argc,
             goto out;
         }
 
+      /* allow downgrades for all transaction types */
+      DnfTransaction *txn = dnf_context_get_transaction (ctx);
+      int flags = dnf_transaction_get_flags (txn) | DNF_TRANSACTION_FLAG_ALLOW_DOWNGRADE;
+
       if (opt_nodocs)
         {
-          DnfTransaction *txn = dnf_context_get_transaction (ctx);
-          dnf_transaction_set_flags (txn,
-                                     dnf_transaction_get_flags (txn) | DNF_TRANSACTION_FLAG_NODOCS);
+          flags |= DNF_TRANSACTION_FLAG_NODOCS;
         }
+
+      dnf_transaction_set_flags (txn, flags);
     }
 
   /*
--
libgit2 0.28.2