Backport patches for bugs: 2029864, 2029871

Resolves: rhbz#2029864
Resolves: rhbz#2029871
This commit is contained in:
Pavla Kratochvilova 2021-12-09 08:43:06 +01:00
parent aeed50ebee
commit c20b9745dc
4 changed files with 168 additions and 2 deletions

View File

@ -0,0 +1,31 @@
From 24668777a7624a8ee3c6f53aff8f4d6675019d23 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Mon, 8 Nov 2021 16:51:56 +0100
Subject: [PATCH] groups-manager: More benevolent resolving of packages (RhBug:2013633)
= changelog =
msg: groups-manager uses for matching packages full NEVRA and not only name.
type: enhancement
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2013633
---
plugins/groups_manager.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/plugins/groups_manager.py b/plugins/groups_manager.py
index 382df37..12da183 100644
--- a/plugins/groups_manager.py
+++ b/plugins/groups_manager.py
@@ -254,7 +254,9 @@ class GroupsManagerCommand(dnf.cli.Command):
# find packages according to specifications from command line
packages = set()
for pkg_spec in self.opts.packages:
- q = self.base.sack.query().filterm(name__glob=pkg_spec).latest()
+ subj = dnf.subject.Subject(pkg_spec)
+ q = subj.get_best_query(self.base.sack, with_nevra=True,
+ with_provides=False, with_filenames=False).latest()
if not q:
logger.warning(_("No match for argument: {}").format(pkg_spec))
continue
--
libgit2 1.1.0

View File

@ -0,0 +1,95 @@
From e289904dcd9c93ad8e1c3b01878599e9d65fa2cc Mon Sep 17 00:00:00 2001
From: Nicola Sella <nsella@redhat.com>
Date: Mon, 1 Nov 2021 18:29:40 +0100
Subject: [PATCH] [versionlock] fix multi pkg lock (RhBug:2013324)
= changelog =
msg: [versionlock] Fix: Multiple package-name-spec arguments don't lock
correctly (RhBug:2001039)
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2013324
---
plugins/versionlock.py | 57 +++++++++++++++++++++++++++++++++------------------------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/plugins/versionlock.py b/plugins/versionlock.py
index 19fbd8c..32c51da 100644
--- a/plugins/versionlock.py
+++ b/plugins/versionlock.py
@@ -171,25 +171,27 @@ class VersionLockCommand(dnf.cli.Command):
cmd = self.opts.subcommand
if cmd == 'add':
- (entry, entry_cmd) = _search_locklist(self.opts.package)
- if entry == '':
- _write_locklist(self.base, self.opts.package, self.opts.raw, True,
- "\n# Added lock on %s\n" % time.ctime(),
- ADDING_SPEC, '')
- elif cmd != entry_cmd:
- raise dnf.exceptions.Error(ALREADY_EXCLUDED.format(entry))
- else:
- logger.info("%s %s", EXISTING_SPEC, entry)
+ results = _search_locklist(self.opts.package)
+ for entry, entry_cmd in results:
+ if entry_cmd == '':
+ _write_locklist(self.base, [entry], self.opts.raw, True,
+ "\n# Added lock on %s\n" % time.ctime(),
+ ADDING_SPEC, '')
+ elif cmd != entry_cmd:
+ raise dnf.exceptions.Error(ALREADY_EXCLUDED.format(entry))
+ else:
+ logger.info("%s %s", EXISTING_SPEC, entry)
elif cmd == 'exclude':
- (entry, entry_cmd) = _search_locklist(self.opts.package)
- if entry == '':
- _write_locklist(self.base, self.opts.package, self.opts.raw, False,
- "\n# Added exclude on %s\n" % time.ctime(),
- EXCLUDING_SPEC, '!')
- elif cmd != entry_cmd:
- raise dnf.exceptions.Error(ALREADY_LOCKED.format(entry))
- else:
- logger.info("%s %s", EXISTING_SPEC, entry)
+ results = _search_locklist(self.opts.package)
+ for entry, entry_cmd in results:
+ if entry_cmd == '':
+ _write_locklist(self.base, [entry], self.opts.raw, False,
+ "\n# Added exclude on %s\n" % time.ctime(),
+ EXCLUDING_SPEC, '!')
+ elif cmd != entry_cmd:
+ raise dnf.exceptions.Error(ALREADY_LOCKED.format(entry))
+ else:
+ logger.info("%s %s", EXISTING_SPEC, entry)
elif cmd == 'list':
for pat in _read_locklist():
print(pat)
@@ -237,14 +239,21 @@ def _read_locklist():
def _search_locklist(package):
+ results = []
found = action = ''
locked_specs = _read_locklist()
- for ent in locked_specs:
- if _match(ent, package):
- found = ent
- action = 'exclude' if ent.startswith('!') else 'add'
- break
- return (found, action)
+ for pkg in package:
+ match = False
+ for ent in locked_specs:
+ found = action = ''
+ if _match(ent, [pkg]):
+ found = ent
+ action = 'exclude' if ent.startswith('!') else 'add'
+ results.append((found, action))
+ match = True
+ if not match:
+ results.append((pkg, action))
+ return results
def _write_locklist(base, args, raw, try_installed, comment, info, prefix):
--
libgit2 1.1.0

View File

@ -0,0 +1,31 @@
From 2c5c1a00fde93b25ffaaa9ad5eea6f0d5712efe4 Mon Sep 17 00:00:00 2001
From: Nicola Sella <nsella@redhat.com>
Date: Thu, 11 Nov 2021 13:48:39 +0100
Subject: [PATCH] Update documentation for adding specific version (RhBug:2013332)
=changelog=
msg: [versionlock] update documentation for adding specifi version
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2013332
---
doc/versionlock.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/versionlock.rst b/doc/versionlock.rst
index 061ce80..1ac7196 100644
--- a/doc/versionlock.rst
+++ b/doc/versionlock.rst
@@ -97,6 +97,10 @@ Subcommands
Adding versionlock on: mutt-5:1.11.4-1.fc30.*
Adding versionlock on: mutt-5:1.12.1-3.fc30.*
+ .. note:: Be careful when adding specific versions
+
+ If you add a package specifying a version with ``dnf versionlock mutt-5:1.11.4-1.fc30.x86_64`` then, if you run ``dnf versionlock add mutt``
+ versionlock will not add ``mutt-5:1.12.1-3.fc30.x86_64``.
``dnf versionlock exclude <package-name-spec>``
Add an exclude (within versionlock) for the available packages matching the spec. It means that
--
libgit2 1.1.0

View File

@ -34,11 +34,15 @@
Name: dnf-plugins-core
Version: 4.0.24
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Core Plugins for DNF
License: GPLv2+
URL: https://github.com/rpm-software-management/dnf-plugins-core
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-groups-manager-More-benevolent-resolving-of-packages-RhBug2013633.patch
Patch2: 0002-versionlock-fix-multi-pkg-lock-RhBug2013324.patch
Patch3: 0003-Update-documentation-for-adding-specific-version-RhBug2013332.patch
BuildArch: noarch
BuildRequires: cmake
BuildRequires: gettext
@ -404,7 +408,7 @@ updated by newer versions.
%endif
%prep
%autosetup
%autosetup -p1
%if %{with python2}
mkdir build-py2
%endif
@ -764,6 +768,11 @@ ln -sf %{_mandir}/man1/%{yum_utils_subpackage_name}.1.gz %{buildroot}%{_mandir}/
%endif
%changelog
* Thu Dec 09 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 4.0.24-2
- [groups-manager] Use full NEVRA for matching packages instead of only name (RhBug:2029864)
- [versionlock] Fix: Multiple package-name-spec arguments don't lock (RhBug:2029871)
- [versionlock] Update documentation for adding specifi version (RhBug:2013332)
* Mon Oct 25 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 4.0.24-1
- Update to 4.0.24
- [repomanage] Allow running only with metadata