From 01f5570bb74aa923870e253007b76e8ed266a27f Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Wed, 1 Jul 2020 08:52:19 +0200 Subject: [PATCH 3/5] [debug] Use standard demands.resolving for transaction handling Do not handle the transaction in plugin, use standard demands.resolving instead. This ensures that transaction errors are correctly presented to the user. Before: $ dnf debug-restore running-kernel-remove.txt.gz $ echo $? 1 After the patch: $ dnf debug-restore running-kernel-remove.txt.gz Error: Problem: The operation would result in removing the following protected packages: kernel-core (try to add '--skip-broken' to skip uninstallable packages) $ echo $? 1 --- plugins/debug.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/debug.py b/plugins/debug.py index 29c5bf7..efe6bea 100644 --- a/plugins/debug.py +++ b/plugins/debug.py @@ -175,6 +175,8 @@ class DebugRestoreCommand(dnf.cli.Command): self.cli.demands.sack_activation = True self.cli.demands.available_repos = True self.cli.demands.root_user = True + if not self.opts.output: + self.cli.demands.resolving = True @staticmethod def set_argparser(parser): @@ -207,10 +209,6 @@ class DebugRestoreCommand(dnf.cli.Command): self.process_dump(dump_pkgs, self.opts) - if not self.opts.output: - self.base.resolve() - self.base.do_transaction() - def process_installed(self, dump_pkgs, opts): installed = self.base.sack.query().installed() installonly_pkgs = self.base._get_installonly_query(installed) -- 2.25.4