From b505f547c9189a77b41eb941876f2a11dd337041 Mon Sep 17 00:00:00 2001 From: Packit Date: Aug 19 2020 14:20:09 +0000 Subject: Apply patch 0005-Unify-downgrade-exit-codes-with-upgrade-RhBug1759847.patch patch_name: 0005-Unify-downgrade-exit-codes-with-upgrade-RhBug1759847.patch location_in_specfile: 5 present_in_specfile: true --- diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py index 80df950..7a8d9e3 100644 --- a/dnf/cli/cli.py +++ b/dnf/cli/cli.py @@ -401,21 +401,19 @@ class BaseCli(dnf.Base): :param file_pkgs: a list of pkg objects from local files """ - oldcount = self._goal.req_length() + result = False for pkg in file_pkgs: try: self.package_downgrade(pkg, strict=strict) - continue # it was something on disk and it ended in rpm - # no matter what we don't go looking at repos + result = True except dnf.exceptions.MarkingError as e: logger.info(_('No match for argument: %s'), self.output.term.bold(pkg.location)) - # it was something on disk and it ended in rpm - # no matter what we don't go looking at repos for arg in specs: try: self.downgrade_to(arg, strict=strict) + result = True except dnf.exceptions.PackageNotFoundError as err: msg = _('No package %s available.') logger.info(msg, self.output.term.bold(arg)) @@ -424,8 +422,8 @@ class BaseCli(dnf.Base): self.output.term.bold(err.pkg_spec)) except dnf.exceptions.MarkingError: assert False - cnt = self._goal.req_length() - oldcount - if cnt <= 0: + + if not result: raise dnf.exceptions.Error(_('No packages marked for downgrade.')) def output_packages(self, basecmd, pkgnarrow='all', patterns=(), reponame=None):