fix dnf error when history sqlite missing

This commit is contained in:
yangcheng1203 2022-03-30 11:26:54 +08:00
parent d4d29f1418
commit 24effceff6
3 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,28 @@
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 ec16b73..cb1f91c 100644
--- a/dnf/cli/commands/mark.py
+++ b/dnf/cli/commands/mark.py
@@ -89,7 +89,7 @@ class MarkCommand(commands.Command):
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
--
2.27.0

View File

@ -3,7 +3,7 @@
Name: dnf
Version: 4.10.0
Release: 2
Release: 3
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
@ -13,6 +13,9 @@ Patch9000: unlock-pidfile-if-current-proccess-is-NOT-dnf.patch
Patch9001: fix-pid-file-residue.patch
Patch9002: add-rpm-transaction-debuginfo.patch
Patch9003: adapt-test-another-process.patch
Patch9004: fix-dnf-history-undo-error-when-history-sqlite-missing.patch
Patch6000: backport-fix-dnf-mark-error-when-history-sqlite-missing.patch
BuildArch: noarch
BuildRequires: cmake gettext systemd bash-completion python3-sphinx
@ -222,6 +225,9 @@ ln -sr %{buildroot}%{_sysconfdir}/%{name}/vars %{buildroot}%{_sysconfdir}/yum/v
%{_mandir}/man8/%{name}-automatic.8*
%changelog
* Wed Mar 30 2022 yangcheng <yangcheng87@h-partners.com> - 4.10.0-3
- fix dnf error when history sqlite missing
* Sat Feb 26 2022 hanhuihui <hanhuihui5@huawei.com> - 4.10.0-2
- round self-developed patch,adapt test_onother_process

View File

@ -0,0 +1,27 @@
From 4f0e1d880f5e0f28b623f3be094552553384cf98 Mon Sep 17 00:00:00 2001
From: cjavaphp <1010881517@qq.com>
Date: Fri, 18 Mar 2022 16:29:20 +0800
Subject: [PATCH] fix dnf history undo error
fix dnf history undo error when history sqlite missing
---
dnf/cli/commands/history.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dnf/cli/commands/history.py b/dnf/cli/commands/history.py
index 293d93f..dd2ea6f 100644
--- a/dnf/cli/commands/history.py
+++ b/dnf/cli/commands/history.py
@@ -265,6 +265,9 @@ class HistoryCommand(commands.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