fix dnf-data downgrade confilct with dnf

(cherry picked from commit f6650c1f35e14f3a3e009147a29cd8f0e33ec27c)
This commit is contained in:
chenhaxing 2022-12-13 16:29:19 +08:00 committed by openeuler-sync-bot
parent 38f93c0a31
commit 1d052ad6f7
2 changed files with 50 additions and 15 deletions

View File

@ -3,7 +3,7 @@
Name: dnf Name: dnf
Version: 4.14.0 Version: 4.14.0
Release: 4 Release: 5
Summary: A software package manager that manages packages on Linux distributions. Summary: A software package manager that manages packages on Linux distributions.
License: GPLv2+ and GPLv2 and GPL License: GPLv2+ and GPLv2 and GPL
URL: https://github.com/rpm-software-management/dnf URL: https://github.com/rpm-software-management/dnf
@ -14,6 +14,7 @@ Patch9001: fix-pid-file-residue.patch
Patch9002: add-rpm-transaction-debuginfo.patch Patch9002: add-rpm-transaction-debuginfo.patch
Patch9003: adapt-test-another-process.patch Patch9003: adapt-test-another-process.patch
Patch9004: fix-dnf-history-undo-error-when-history-sqlite-missing.patch Patch9004: fix-dnf-history-undo-error-when-history-sqlite-missing.patch
Patch9005: huawei-lock-file-add-verify-parameter.patch
%ifarch sw_64 %ifarch sw_64
Patch6000: dnf-4.10.0-sw.patch Patch6000: dnf-4.10.0-sw.patch
@ -24,7 +25,7 @@ Patch6001: 0001-Add-loongarch-architecture-support.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: cmake gettext systemd bash-completion python3-sphinx BuildRequires: cmake gettext systemd bash-completion python3-sphinx
Requires: python3-%{name} = %{version}-%{release} libreport-filesystem Requires: python3-%{name} = %{version}-%{release} libreport-filesystem
Recommends: (%{_bindir}/sqlite3 if bash-completion) (python3-dbus if NetworkManager) Recommends: (%{_bindir}/sqlite3 if bash-completion) (python3-dbus if NetworkManager)
Provides: dnf-command(alias) dnf-command(autoremove) dnf-command(check-update) dnf-command(clean) Provides: dnf-command(alias) dnf-command(autoremove) dnf-command(check-update) dnf-command(clean)
Provides: dnf-command(distro-sync) dnf-command(downgrade) dnf-command(group) dnf-command(history) Provides: dnf-command(distro-sync) dnf-command(downgrade) dnf-command(group) dnf-command(history)
@ -41,7 +42,7 @@ determines the actions required to install packages.DNF also makes it easier
to maintain groups of machines, eliminating the need to manually update each to maintain groups of machines, eliminating the need to manually update each
one using rpm. one using rpm.
%package -n yum %package -n yum
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Summary: Package manager Summary: Package manager
@ -59,7 +60,7 @@ Requires: python3-gpg %{name}-data = %{version}-%{release} libmodule
Requires: python3-hawkey >= 0.66.0 python3-libdnf >= %{relate_libdnf_version} Requires: python3-hawkey >= 0.66.0 python3-libdnf >= %{relate_libdnf_version}
Requires: python3-libcomps >= 0.1.8 python3-rpm >= 4.14.0 Requires: python3-libcomps >= 0.1.8 python3-rpm >= 4.14.0
Recommends: python3-unbound Recommends: python3-unbound
Obsoletes: python2-%{name} Obsoletes: python2-%{name}
%description -n python3-%{name} %description -n python3-%{name}
Python 3 interface to DNF. Python 3 interface to DNF.
@ -67,7 +68,7 @@ Python 3 interface to DNF.
%package data %package data
Summary: Common data and configuration files for DNF Summary: Common data and configuration files for DNF
Requires: libreport-filesystem Requires: libreport-filesystem
Obsoletes: %{name}-conf < %{version}-%{release} Obsoletes: %{name}-conf < %{version}-%{release} %{name} < %{version}-%{release}
Provides: %{name}-conf = %{version}-%{release} Provides: %{name}-conf = %{version}-%{release}
%description data %description data
@ -144,35 +145,39 @@ popd
%post %post
%systemd_post dnf-makecache.timer %systemd_post dnf-makecache.timer
%preun
%systemd_preun dnf-makecache.timer
%postun
%systemd_postun_with_restart dnf-makecache.timer
%post automatic
%systemd_post dnf-automatic.timer %systemd_post dnf-automatic.timer
%systemd_post dnf-automatic-notifyonly.timer %systemd_post dnf-automatic-notifyonly.timer
%systemd_post dnf-automatic-download.timer %systemd_post dnf-automatic-download.timer
%systemd_post dnf-automatic-install.timer %systemd_post dnf-automatic-install.timer
%preun %preun automatic
%systemd_preun dnf-automatic.timer %systemd_preun dnf-automatic.timer
%systemd_preun dnf-makecache.timer
%systemd_preun dnf-automatic-notifyonly.timer %systemd_preun dnf-automatic-notifyonly.timer
%systemd_preun dnf-automatic-download.timer %systemd_preun dnf-automatic-download.timer
%systemd_preun dnf-automatic-install.timer %systemd_preun dnf-automatic-install.timer
%postun %postun automatic
%systemd_postun_with_restart dnf-makecache.timer
%systemd_postun_with_restart dnf-automatic.timer %systemd_postun_with_restart dnf-automatic.timer
%systemd_postun_with_restart dnf-automatic-notifyonly.timer %systemd_postun_with_restart dnf-automatic-notifyonly.timer
%systemd_postun_with_restart dnf-automatic-download.timer %systemd_postun_with_restart dnf-automatic-download.timer
%systemd_postun_with_restart dnf-automatic-install.timer %systemd_postun_with_restart dnf-automatic-install.timer
%files %files
%license COPYING PACKAGE-LICENSING
%doc AUTHORS README.rst
%{_bindir}/%{name} %{_bindir}/%{name}
%{_sysconfdir}/bash_completion.d/%{name} %{_sysconfdir}/bash_completion.d/%{name}
%{_unitdir}/%{name}-makecache.timer %{_unitdir}/%{name}-makecache.timer
%{_unitdir}/%{name}-makecache.service %{_unitdir}/%{name}-makecache.service
%{_var}/cache/%{name}/ %{_var}/cache/%{name}/
%files -n yum %files -n yum
%{_bindir}/yum %{_bindir}/yum
%{_sysconfdir}/yum/vars %{_sysconfdir}/yum/vars
%{_sysconfdir}/yum.conf %{_sysconfdir}/yum.conf
@ -190,7 +195,7 @@ popd
%files data %files data
%license COPYING PACKAGE-LICENSING %license COPYING PACKAGE-LICENSING
%doc AUTHORS README.rst %doc AUTHORS README.rst
%dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/modules.d %dir %{_sysconfdir}/%{name}/modules.d
%dir %{_sysconfdir}/%{name}/modules.defaults.d %dir %{_sysconfdir}/%{name}/modules.defaults.d
%dir %{_sysconfdir}/%{name}/plugins %dir %{_sysconfdir}/%{name}/plugins
@ -210,14 +215,12 @@ popd
%ghost %attr(644,-,-) %{_sharedstatedir}/%{name}/groups.json %ghost %attr(644,-,-) %{_sharedstatedir}/%{name}/groups.json
%ghost %attr(755,-,-) %dir %{_sharedstatedir}/%{name}/yumdb %ghost %attr(755,-,-) %dir %{_sharedstatedir}/%{name}/yumdb
%ghost %attr(755,-,-) %dir %{_sharedstatedir}/%{name}/history %ghost %attr(755,-,-) %dir %{_sharedstatedir}/%{name}/history
%{_mandir}/man5/%{name}.conf.5*
%{_tmpfilesdir}/%{name}.conf %{_tmpfilesdir}/%{name}.conf
%{_sysconfdir}/libreport/events.d/collect_dnf.conf %{_sysconfdir}/libreport/events.d/collect_dnf.conf
%files automatic %files automatic
%{_bindir}/%{name}-automatic %{_bindir}/%{name}-automatic
%config(noreplace) %{_sysconfdir}/%{name}/automatic.conf %config(noreplace) %{_sysconfdir}/%{name}/automatic.conf
%{_mandir}/man8/%{name}-automatic.8*
%{_unitdir}/%{name}-automatic.service %{_unitdir}/%{name}-automatic.service
%{_unitdir}/%{name}-automatic.timer %{_unitdir}/%{name}-automatic.timer
%{_unitdir}/%{name}-automatic-notifyonly.service %{_unitdir}/%{name}-automatic-notifyonly.service
@ -243,6 +246,9 @@ popd
%{_mandir}/man8/%{name}-automatic.8* %{_mandir}/man8/%{name}-automatic.8*
%changelog %changelog
* Tue Dec 13 2022 chenhaixing <chenhaixing@huawei.com> - 4.14.0-5
- DESC:fix dnf-data downgrade confilct with dnf
* Fri Dec 9 2022 chenhaixing <chenhaixing@huawei.com> - 4.14.0-4 * Fri Dec 9 2022 chenhaixing <chenhaixing@huawei.com> - 4.14.0-4
- DESC:add sw64 and loongarch support for dnf - DESC:add sw64 and loongarch support for dnf

View File

@ -0,0 +1,29 @@
From ec8644e42ec2e0d0f98ea1aee3859b2c510f0cc0 Mon Sep 17 00:00:00 2001
From: chenhaixing <chenhaixing@huawei.com>
Date: Sat, 4 Jun 2022 17:49:53 +0800
Subject: [PATCH] verify-parameter
---
dnf/lock.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dnf/lock.py b/dnf/lock.py
index ab05a3b..12378ec 100644
--- a/dnf/lock.py
+++ b/dnf/lock.py
@@ -116,7 +116,12 @@ class ProcessLock(object):
return pid
try:
- with open('/proc/%d/status' % old_pid) as f:
+ old_pid_path = f'/proc/{old_pid}/status'
+ true_old_pid_path = os.path.realpath(old_pid_path)
+ if not true_old_pid_path.startswith("/proc/"):
+ return old_pid
+
+ with open(true_old_pid_path) as f:
if not re.findall(r'Name:(.*)(dnf|yum)', f.read(), re.I):
os.write(fd, str(pid).encode('utf-8'))
return pid
--
2.27.0