!167 [sync] PR-165: 提交补丁:支持先判断target(pid文件)是否存在,再执行unlink(可选)

From: @openeuler-sync-bot 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
This commit is contained in:
openeuler-ci-bot 2023-01-11 12:23:06 +00:00 committed by Gitee
commit 1342bf24c5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 32 additions and 1 deletions

View File

@ -3,7 +3,7 @@
Name: dnf
Version: 4.14.0
Release: 8
Release: 9
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
@ -16,6 +16,10 @@ Patch9003: adapt-test-another-process.patch
Patch9004: fix-dnf-history-undo-error-when-history-sqlite-missing.patch
Patch9005: huawei-lock-file-add-verify-parameter.patch
%if 0%{?check_target_before_unlink}
Patch9006: get-lockfile-exists-before-unlick.patch
%endif
%ifarch sw_64
Patch6000: dnf-4.10.0-sw.patch
%endif
@ -247,6 +251,9 @@ popd
%{_mandir}/man8/%{name}-automatic.8*
%changelog
* Tue Jan 10 2023 xiasenlin <xiasenlin1@huawei.com> - 4.14.0-9
- DESC:add get-lockfile-exists-before-unlick.patch
* Fri Jan 6 2023 Wenlong Zhang<zhangwenlong@loongson.cn> - 4.14.0-8
- DESC: fix build error for loongarch64

View File

@ -0,0 +1,24 @@
From 5cf9fbe5096c807668da3c1685c917996b91c960 Mon Sep 17 00:00:00 2001
From: Duan Pengjie <pengjieduan@gmail.com>
Date: Wed, 4 Jan 2023 11:51:23 +0800
Subject: [PATCH] add exists
---
dnf/lock.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dnf/lock.py b/dnf/lock.py
index ee7a0db..a94132a 100644
--- a/dnf/lock.py
+++ b/dnf/lock.py
@@ -161,6 +161,6 @@ class ProcessLock(object):
pid = self._try_lock(my_pid)
def __exit__(self, *exc_args):
- if self.count == 1:
+ if self.count == 1 and os.path.exists(self.target):
os.unlink(self.target)
self._unlock_thread()
--
2.37.1 (Apple Git-137.1)