Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
5e2e8d58e5
!190 backport fix AttributeError when IO busy and press ctrl c
From: @xzff124 
Reviewed-by: @anonymous_z 
Signed-off-by: @anonymous_z
2023-05-09 08:28:41 +00:00
xzf1234
a965e8d155 backport fix AttributeError when IO busy and press ctrl c 2023-05-05 16:50:52 +08:00
openeuler-ci-bot
342c30b78c
!170 [sync] PR-169: dnf:backport some patches
From: @openeuler-sync-bot 
Reviewed-by: @anonymous_z 
Signed-off-by: @anonymous_z
2023-02-14 06:38:58 +00:00
chenhaxing
432b0f824d dnf:backport some patches
(cherry picked from commit 7c67dd07fb9d765156111461e728ff3f9bf3b84c)
2023-02-14 14:25:51 +08:00
openeuler-ci-bot
69203eefc2
!132 [sync] PR-129: correct bad date in changelog
From: @openeuler-sync-bot 
Reviewed-by: @anonymous_z 
Signed-off-by: @anonymous_z
2022-11-11 06:24:29 +00:00
chenhaixing
3ee55cd1e2 correct bad date in changelog
(cherry picked from commit d765a9466e8892cfa33ef308a11a87a6c246dc0b)
2022-11-11 14:05:51 +08:00
openeuler-ci-bot
642a5b5d97
!108 [sync] PR-106: fix dnf error when history sqlite missing
From: @openeuler-sync-bot 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-03-30 08:21:47 +00:00
yangcheng1203
1bafba41a6 fix dnf error when history sqlite missing
(cherry picked from commit 0414d0ec135641c825162debd866be1ed6ae2ae7)
2022-03-29 19:11:45 +08:00
openeuler-ci-bot
c3c9746c23
!98 Add fail_fast parameter to _download_remote_payloads() method
From: @zhangshaoning_uniontech 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-03-29 06:51:28 +00:00
张少宁
82282f3827 Add fail_fast parameter to _download_remote_payloads() method 2022-03-29 13:19:37 +08:00
11 changed files with 496 additions and 2 deletions

View File

@ -0,0 +1,68 @@
From 39b04e98fd7c862c9e070a46b79772fa47dc3371 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Wed, 6 Oct 2021 09:56:05 +0200
Subject: [PATCH] Add fail_fast parameter to download_payloads methods
Unlike in the rpm transaction, reposync needs to switch the fail_fast
off to download as much packages from repository as possible.
---
dnf/base.py | 6 +++---
dnf/repo.py | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dnf/base.py b/dnf/base.py
index e1aa2bd..f2b9c55 100644
--- a/dnf/base.py
+++ b/dnf/base.py
@@ -1059,7 +1059,7 @@ class Base(object):
timer()
self._trans_success = True
- def _download_remote_payloads(self, payloads, drpm, progress, callback_total):
+ def _download_remote_payloads(self, payloads, drpm, progress, callback_total, fail_fast=True):
lock = dnf.lock.build_download_lock(self.conf.cachedir, self.conf.exit_on_lock)
with lock:
beg_download = time.time()
@@ -1071,7 +1071,7 @@ class Base(object):
progress.start(len(payloads), est_remote_size, total_drpms=total_drpm)
else:
progress.start(len(payloads), est_remote_size)
- errors = dnf.repo._download_payloads(payloads, drpm)
+ errors = dnf.repo._download_payloads(payloads, drpm, fail_fast)
if errors._irrecoverable:
raise dnf.exceptions.DownloadError(errors._irrecoverable)
@@ -1097,7 +1097,7 @@ class Base(object):
est_remote_size = sum(pload.download_size
for pload in payloads)
progress.start(len(payloads), est_remote_size)
- errors = dnf.repo._download_payloads(payloads, drpm)
+ errors = dnf.repo._download_payloads(payloads, drpm, fail_fast)
if errors._irrecoverable:
raise dnf.exceptions.DownloadError(errors._irrecoverable)
diff --git a/dnf/repo.py b/dnf/repo.py
index 7550897..db3ac6a 100644
--- a/dnf/repo.py
+++ b/dnf/repo.py
@@ -84,7 +84,7 @@ def _pkg2payload(pkg, progress, *factories):
raise ValueError(_('no matching payload factory for %s') % pkg)
-def _download_payloads(payloads, drpm):
+def _download_payloads(payloads, drpm, fail_fast=True):
# download packages
def _download_sort_key(payload):
return not hasattr(payload, 'delta')
@@ -94,7 +94,7 @@ def _download_payloads(payloads, drpm):
for pload in sorted(payloads, key=_download_sort_key)]
errs = _DownloadErrors()
try:
- libdnf.repo.PackageTarget.downloadPackages(libdnf.repo.VectorPPackageTarget(targets), True)
+ libdnf.repo.PackageTarget.downloadPackages(libdnf.repo.VectorPPackageTarget(targets), fail_fast)
except RuntimeError as e:
errs._fatal = str(e)
drpm.wait()
--
2.20.1

View File

@ -0,0 +1,81 @@
From a8cc5149203ad1bb2800d6c4fc3fb34c6b2b514d Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Wed, 6 Oct 2021 09:43:37 +0200
Subject: [PATCH] Fix reporting irrecoverable errors on packages download
The original _irrecoverable property returns random dictionary - either
packages irrecoverable errors, or global fatal error or even new empty
dictionary. This makes it prone to programmer errors like:
errs._irrecoverable[pkg] = [err]
which may lead to setting the error into the newly created empty
dictionary instead of packages errors dictionary as intended.
I turned the property to method which I consider more clear.
---
dnf/base.py | 8 ++++----
dnf/repo.py | 9 ++++-----
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/dnf/base.py b/dnf/base.py
index f2b9c55..3d5a255 100644
--- a/dnf/base.py
+++ b/dnf/base.py
@@ -1073,8 +1073,8 @@ class Base(object):
progress.start(len(payloads), est_remote_size)
errors = dnf.repo._download_payloads(payloads, drpm, fail_fast)
- if errors._irrecoverable:
- raise dnf.exceptions.DownloadError(errors._irrecoverable)
+ if errors._irrecoverable():
+ raise dnf.exceptions.DownloadError(errors._irrecoverable())
remote_size = sum(errors._bandwidth_used(pload)
for pload in payloads)
@@ -1099,8 +1099,8 @@ class Base(object):
progress.start(len(payloads), est_remote_size)
errors = dnf.repo._download_payloads(payloads, drpm, fail_fast)
- if errors._irrecoverable:
- raise dnf.exceptions.DownloadError(errors._irrecoverable)
+ if errors._irrecoverable():
+ raise dnf.exceptions.DownloadError(errors._irrecoverable())
remote_size += \
sum(errors._bandwidth_used(pload) for pload in payloads)
diff --git a/dnf/repo.py b/dnf/repo.py
index db3ac6a..5e6f723 100644
--- a/dnf/repo.py
+++ b/dnf/repo.py
@@ -112,7 +112,7 @@ def _download_payloads(payloads, drpm, fail_fast=True):
errs._skipped.add(pkg)
continue
pkg.repo._repo.expire()
- errs._irrecoverable[pkg] = [err]
+ errs._pkg_irrecoverable[pkg] = [err]
return errs
@@ -131,15 +131,14 @@ def _update_saving(saving, payloads, errs):
class _DownloadErrors(object):
def __init__(self):
- self._val_irrecoverable = {}
+ self._pkg_irrecoverable = {}
self._val_recoverable = {}
self._fatal = None
self._skipped = set()
- @property
def _irrecoverable(self):
- if self._val_irrecoverable:
- return self._val_irrecoverable
+ if self._pkg_irrecoverable:
+ return self._pkg_irrecoverable
if self._fatal:
return {'': [self._fatal]}
return {}
--
2.20.1

View File

@ -0,0 +1,30 @@
From 759e7a5586f279efd41b65b2f84e0dd3bcf77fbd Mon Sep 17 00:00:00 2001
From: chenhaixing123 <chenhaixing@huawei.com>
Date: Wed, 22 Feb 2023 17:27:04 +0800
Subject: [PATCH] fix AttributeError when IO busy and press ctrl c
Conflict:The content of "index" and "@@" are adapted
Reference:https://github.com/rpm-software-management/dnf/pull/1899/commits/759e7a5586f279efd41b65b2f84e0dd3bcf77fbd
---
dnf/conf/config.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dnf/conf/config.py b/dnf/conf/config.py
index 3cb561b..202fd44 100644
--- a/dnf/conf/config.py
+++ b/dnf/conf/config.py
@@ -233,8 +233,9 @@ class MainConf(BaseConfig):
self.tempfiles = []
def __del__(self):
- for file_name in self.tempfiles:
- os.unlink(file_name)
+ if hasattr(self, 'tempfiles'):
+ for file_name in self.tempfiles:
+ os.unlink(file_name)
@property
def get_reposdir(self):
--
2.33.1.windows.1

View File

@ -0,0 +1,25 @@
From 0fefe7c1ad1d9c60f6159b14871837043b5e0d1f Mon Sep 17 00:00:00 2001
From: zhanghaolian <65838930+iWhy98@users.noreply.github.com>
Date: Tue, 25 Jan 2022 15:41:16 +0800
Subject: [PATCH] dnf:fix dnf mark error when history sqlite missing
Conflict: NA
Reference:https://github.com/rpm-software-management/dnf/pull/1808
---
dnf/cli/commands/mark.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dnf/cli/commands/mark.py b/dnf/cli/commands/mark.py
index ec16b738dc..cb1f91c135 100644
--- a/dnf/cli/commands/mark.py
+++ b/dnf/cli/commands/mark.py
@@ -89,7 +89,7 @@ def run(self):
old = self.base.history.last()
if old is None:
- rpmdb_version = self.sack._rpmdb_version()
+ rpmdb_version = self.base.sack._rpmdb_version()
else:
rpmdb_version = old.end_rpmdb_version

View File

@ -0,0 +1,33 @@
From b646ae4d713615e04f4acab4575fe5eff100f350 Mon Sep 17 00:00:00 2001
From: Nicola Sella <nsella@redhat.com>
Date: Tue, 15 Mar 2022 16:26:10 +0100
Subject: [PATCH] Fix remove when no repos are enabled (RhBz:2064341)
msg: When no repositories are enabled, dnf group exits and does not
remove an installed group.
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2064341
type: bugfix
Conflict:NA
Reference:https://github.com/rpm-software-management/dnf/commit/b646ae4d713615e04f4acab4575fe5eff100f350
---
dnf/cli/commands/group.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dnf/cli/commands/group.py b/dnf/cli/commands/group.py
index e25c9be..6de8baa 100644
--- a/dnf/cli/commands/group.py
+++ b/dnf/cli/commands/group.py
@@ -358,7 +358,8 @@ class GroupCommand(commands.Command):
else:
demands.available_repos = True
- commands._checkEnabledRepo(self.base)
+ if cmd not in ('remove'):
+ commands._checkEnabledRepo(self.base)
if cmd in ('install', 'upgrade'):
commands._checkGPGKey(self.base, self.cli)
--
2.27.0

View File

@ -0,0 +1,52 @@
From e2fbdc660fb4ef83905e127fd801025461c24710 Mon Sep 17 00:00:00 2001
From: Jan Kolarik <jkolarik@redhat.com>
Date: Wed, 23 Nov 2022 08:44:41 +0000
Subject: [PATCH] Ignore processing variable files with unsupported encoding
(RhBug:2141215)
This issue could be seen for example when there are some temporary files stored by text editors in the `/etc/dnf/vars` folder. These files could be in the binary format and causes `UnicodeDecodeError` exception to be thrown during processing of the var files.
= changelog =
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2141215
Conflict:The content of "index" and "@@" are adapted
Reference:https://github.com/rpm-software-management/dnf/commit/e2fbdc660fb4ef83905e127fd801025461c24710
---
dnf/conf/substitutions.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dnf/conf/substitutions.py b/dnf/conf/substitutions.py
index 1281bdf..9d7442b 100644
--- a/dnf/conf/substitutions.py
+++ b/dnf/conf/substitutions.py
@@ -18,13 +18,15 @@
# Red Hat, Inc.
#
+import logging
import os
import re
-import dnf
-import dnf.exceptions
+from dnf.i18n import _
ENVIRONMENT_VARS_RE = re.compile(r'^DNF_VAR_[A-Za-z0-9_]+$')
+logger = logging.getLogger('dnf')
+
class Substitutions(dict):
# :api
@@ -60,7 +62,8 @@ class Substitutions(dict):
val = fp.readline()
if val and val[-1] == '\n':
val = val[:-1]
- except (OSError, IOError):
+ except (OSError, IOError, UnicodeDecodeError) as e:
+ logger.warning(_("Error when parsing a variable from file '{0}': {1}").format(filepath, e))
continue
if val is not None:
self[fsvar] = val
--
2.27.0

View File

@ -0,0 +1,66 @@
From d7bfd194129b496851ed07ac7efd07c6ddc0ab49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Wed, 7 Sep 2022 14:40:32 +0200
Subject: [PATCH] Pass whole URL in relativeUrl to PackageTarget for RPM URL
download
The PackageTarget supports baseUrl and relativeUrl on the API, but then
the relativeUrl is just a path fragment with no definition on whether it
should be encoded. It's being passed unencoded paths from other places,
and so there's a conditional encode (only if not full URL) in libdnf.
But full URLs are actually supported in relativeUrl (in that case
baseUrl should be empty) and in that case the URL is expected to be
encoded and is not encoded for the second time.
Hence, pass the full URL to relativeUrl instead of splitting it. We also
need to decode the file name we store, as on the filesystem the RPM file
name is also decoded.
= changelog =
msg: Don't double-encode RPM URLs passed on CLI
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103015
Conflict:@@ adapt: "@@ import string" and "@@ class RemoteRPMPayload(PackagePayload):" check is not 3e36c99d401530dc026712523a7c445da17ee299(commitID)
which is not backported
Reference:https://github.com/rpm-software-management/dnf/commit/d7bfd194129b496851ed07ac7efd07c6ddc0ab49
---
dnf/repo.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dnf/repo.py b/dnf/repo.py
index 1822cf0..8751de3 100644
--- a/dnf/repo.py
+++ b/dnf/repo.py
@@ -47,6 +47,7 @@ import string
import sys
import time
import traceback
+import urllib
_PACKAGES_RELATIVE_DIR = "packages"
_MIRRORLIST_FILENAME = "mirrorlist"
@@ -295,7 +296,7 @@ class RemoteRPMPayload(PackagePayload):
self.local_path = os.path.join(self.pkgdir, self.__str__().lstrip("/"))
def __str__(self):
- return os.path.basename(self.remote_location)
+ return os.path.basename(urllib.parse.unquote(self.remote_location))
def _progress_cb(self, cbdata, total, done):
self.remote_size = total
@@ -308,8 +309,8 @@ class RemoteRPMPayload(PackagePayload):
def _librepo_target(self):
return libdnf.repo.PackageTarget(
- self.conf._config, os.path.basename(self.remote_location),
- self.pkgdir, 0, None, 0, os.path.dirname(self.remote_location),
+ self.conf._config, self.remote_location,
+ self.pkgdir, 0, None, 0, None,
True, 0, 0, self.callbacks)
@property
--
2.27.0

View File

@ -0,0 +1,38 @@
From f8fed338a73f1780b394142e371250b9b8ee8f7c Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 11 Jul 2022 12:27:14 +0200
Subject: [PATCH] Set default value for variable to prevent crash
(RhBug:2091636)
It ensure that read of file ended successfully.
https://bugzilla.redhat.com/show_bug.cgi?id=2091636
Conflict:NA
Reference:https://github.com/rpm-software-management/dnf/commit/f8fed338a73f1780b394142e371250b9b8ee8f7c
---
dnf/conf/substitutions.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dnf/conf/substitutions.py b/dnf/conf/substitutions.py
index 703e4a4..1281bdf 100644
--- a/dnf/conf/substitutions.py
+++ b/dnf/conf/substitutions.py
@@ -53,6 +53,7 @@ class Substitutions(dict):
continue
for fsvar in fsvars:
filepath = os.path.join(dir_fsvars, fsvar)
+ val = None
if os.path.isfile(filepath):
try:
with open(filepath) as fp:
@@ -61,4 +62,5 @@ class Substitutions(dict):
val = val[:-1]
except (OSError, IOError):
continue
- self[fsvar] = val
+ if val is not None:
+ self[fsvar] = val
--
2.27.0

View File

@ -0,0 +1,41 @@
From 8f3f98ee710c9909f448c2d11143d9dffb919a46 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Tue, 4 Jan 2022 09:48:23 +0100
Subject: [PATCH] Switch install/remove parts of swap command (RhBug:2036434)
In case the install spec refers to a local rpm file the swap command
would fail with this error:
Error: Cannot add local packages, because transaction job already exists
Changing the order in which the installation and removal parts are
performed fixes the issue.
= changelog =
msg: Fix swap command to work with local rpm files correctly
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2036434
Conflict:NA
Reference:https://github.com/rpm-software-management/dnf/commit/8f3f98ee710c9909f448c2d11143d9dffb919a46
---
dnf/cli/commands/swap.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dnf/cli/commands/swap.py b/dnf/cli/commands/swap.py
index 5f23880..d44b3f4 100644
--- a/dnf/cli/commands/swap.py
+++ b/dnf/cli/commands/swap.py
@@ -58,5 +58,8 @@ class SwapCommand(commands.Command):
cmd.run()
def run(self):
- self._perform('remove', self.opts.remove_spec)
+ # The install part must be performed before the remove one because it can
+ # operate on local rpm files. Command line packages cannot be added
+ # to the sack once the goal is created.
self._perform('install', self.opts.install_spec)
+ self._perform('remove', self.opts.remove_spec)
--
2.27.0

View File

@ -3,7 +3,7 @@
Name: dnf
Version: 4.2.23
Release: 6
Release: 11
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
@ -18,6 +18,17 @@ Patch5: Add-missing-check-if-path-exists-fixes-dead-code.patch
Patch6: dnf-rpm-miscutils.py-fix-usage-of-_.patch
Patch7: Pass-the-package-to-rpmkeys-stdin.patch
Patch8: Use-rpmkeys-alone-to-verify-signature.patch
Patch9: Add-fail_fast-parameter-to-download_payloads-methods.patch
Patch10: Fix-reporting-irrecoverable-errors-on-packages-downl.patch
Patch6000: backport-fix-dnf-mark-error-when-history-sqlite-missing.patch
Patch9000: fix-dnf-history-undo-error-when-history-sqlite-missing.patch
Patch6001: backport-switch-install-remove-parts-of-swap-command.patch
Patch6002: backport-fix-remove-when-no-repos-are-enabled.patch
Patch6003: backport-set-default-value-for-variable-to-prevent-crash.patch
Patch6004: backport-pass-whole-url-in-relativeUrl-to-packageTarget-for-rpm-url-download.patch
Patch6005: backport-ignore-processing-variable-files-with-unsupported-encoding.patch
Patch6006: backport-fix-AttributeError-when-IO-busy-and-press-ctrl-c.patch
BuildArch: noarch
BuildRequires: cmake gettext systemd bash-completion python3-sphinx
@ -208,7 +219,30 @@ popd
%{_mandir}/man8/%{name}-automatic.8*
%changelog
* Tue Aur 3 2021 Jianmin <jianmin@iscas.ac.cn> - 4.2.23-6
* Fri May 5 2023 xzf1244 <xzf1244@hust.edu.cn> 4.2.23-11
- CVE:NA
- SUG:NA
- DESC:dnf:fix AttributeError when io busy and press ctrl c
* Tue Feb 14 2023 chenhaixing <chenhaixing@huawei.com> - 4.2.23-10
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:dnf:backport some patches
* Thu Nov 10 2022 chenhaixing <chenhaixing@huawei.com> - 4.2.23-9
- DESC:correct the bad date in changelog
* Tue Mar 29 2022 yangcheng <yangcheng87@h-partners.com> - 4.2.23-8
- fix dnf error when history sqlite missing
* Thu Mar 10 2022 zhangshaoning <zhangshaoning@uniontech.com> - 4.2.23-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Add fail_fast parameter to _download_remote_payloads() method
* Tue Aug 3 2021 Jianmin <jianmin@iscas.ac.cn> - 4.2.23-6
- Type:enhancement
- ID:NA
- SUG:NA

View File

@ -0,0 +1,26 @@
From 57455df96b6dc9f8c90e8d783a2654896ac483e5 Mon Sep 17 00:00:00 2001
From: zhujunhao <zhujunhao11@huawei.com>
Date: Thu, 17 Mar 2022 11:40:59 +0800
Subject: [PATCH]
fix-dnf-history-undo-error-when-history-sqlite-missing
---
dnf/cli/commands/__init__.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dnf/cli/commands/__init__.py b/dnf/cli/commands/__init__.py
index 86f560b..088e958 100644
--- a/dnf/cli/commands/__init__.py
+++ b/dnf/cli/commands/__init__.py
@@ -954,6 +954,9 @@ class HistoryCommand(Command):
s = s[4:]
transaction_id = int(s)
if transaction_id <= 0:
+ if not self.output.history.last():
+ logger.critical("Not found given transaction ID")
+ raise ValueError
transaction_id += self.output.history.last().tid
return transaction_id
--
2.27.0