!73 fix errors when use "yum module remove --all per:common" command and fix test test_mode_tty failed

From: @eaglegai
Reviewed-by: @yanan-rock
Signed-off-by: @yanan-rock
This commit is contained in:
openeuler-ci-bot 2021-06-03 10:10:40 +08:00 committed by Gitee
commit f3ec731089
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From 7d10ddea6291399b3ed794c1d7fff326d2ec3e86 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Tue, 8 Dec 2020 08:48:34 +0100
Subject: [PATCH] Fix module remove --all when no match spec (RhBug:1904490)
It resolves a traceback.
https://bugzilla.redhat.com/show_bug.cgi?id=1904490
Closes: #1699
Approved by: kontura
---
dnf/cli/commands/module.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dnf/cli/commands/module.py b/dnf/cli/commands/module.py
index 4cdc915e21..0f584f9080 100644
--- a/dnf/cli/commands/module.py
+++ b/dnf/cli/commands/module.py
@@ -45,6 +45,9 @@ def _get_modules_from_name_stream_specs(self):
modules_from_specs = set()
for module_spec in self.opts.module_spec:
__, nsvcap = self.module_base._get_modules(module_spec)
+ # When there is no match, the problem was already reported by module_base.remove()
+ if nsvcap is None:
+ continue
name = nsvcap.name if nsvcap.name else ""
stream = nsvcap.stream if nsvcap.stream else ""
if (nsvcap.version and nsvcap.version != -1) or nsvcap.context:

View File

@ -2,12 +2,14 @@
Name: dnf
Version: 4.2.23
Release: 4
Release: 5
Summary: A software package manager that manages packages on Linux distributions.
License: GPLv2+ and GPLv2 and GPL
URL: https://github.com/rpm-software-management/dnf
Source0: https://github.com/rpm-software-management/dnf/archive/%{version}/%{name}-%{version}.tar.gz
Patch0: Fix-module-remove-all-when-no-match.patch
BuildArch: noarch
BuildRequires: cmake gettext systemd bash-completion python3-sphinx
Requires: python3-%{name} = %{version}-%{release} libreport-filesystem
@ -100,6 +102,7 @@ ln -sr %{buildroot}%{_sysconfdir}/%{name}/protected.d %{buildroot}%{_sysconfdir
ln -sr %{buildroot}%{_sysconfdir}/%{name}/vars %{buildroot}%{_sysconfdir}/yum/vars
%check
export TERM=linux
pushd build-py3
ctest -VV
popd
@ -196,6 +199,13 @@ popd
%{_mandir}/man8/%{name}-automatic.8*
%changelog
* Tue Mar 30 2021 gaihuiying <gaihuiying1@huawei.com> - 4.2.23-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix errors when use "yum module remove --all per:common" command
fix test test_mode_tty failed
* Fri Nov 20 2020 lunankun <lunankun@huawei.com> - 4.2.23-4
- Type:requirement
- ID:NA