fix dnf error when history sqlite missing

(cherry picked from commit 0414d0ec135641c825162debd866be1ed6ae2ae7)
This commit is contained in:
yangcheng1203 2022-03-29 16:43:04 +08:00 committed by openeuler-sync-bot
parent c3c9746c23
commit 1bafba41a6
3 changed files with 58 additions and 1 deletions

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

@ -3,7 +3,7 @@
Name: dnf
Version: 4.2.23
Release: 7
Release: 8
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
@ -20,6 +20,9 @@ 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
BuildArch: noarch
BuildRequires: cmake gettext systemd bash-completion python3-sphinx
@ -210,6 +213,9 @@ popd
%{_mandir}/man8/%{name}-automatic.8*
%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

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