revise the query method for installed kernel package
This commit is contained in:
parent
d42086f6f8
commit
92712bdfbb
@ -0,0 +1,57 @@
|
|||||||
|
From 0e84a02e690017f62fc42f3ea1597a4e40c2ec66 Mon Sep 17 00:00:00 2001
|
||||||
|
From: wang-guangge <wangguangge@huawei.com>
|
||||||
|
Date: Mon, 23 Oct 2023 21:37:39 +0800
|
||||||
|
Subject: [PATCH] revise the query method for installed kernel packages
|
||||||
|
|
||||||
|
---
|
||||||
|
hotpatch/updateinfo_parse.py | 26 +++++++++++++++++++++++++-
|
||||||
|
1 file changed, 25 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/hotpatch/updateinfo_parse.py b/hotpatch/updateinfo_parse.py
|
||||||
|
index 7395dc6..4322eee 100644
|
||||||
|
--- a/hotpatch/updateinfo_parse.py
|
||||||
|
+++ b/hotpatch/updateinfo_parse.py
|
||||||
|
@@ -286,8 +286,14 @@ class HotpatchUpdateInfo(object):
|
||||||
|
# check whether the relevant target required package is installed on this machine
|
||||||
|
if not inst_pkgs:
|
||||||
|
return
|
||||||
|
+ # for kernel rpm, inst_pkgs is based on the kernel version of the current system
|
||||||
|
+ if required_pkg_name == "kernel":
|
||||||
|
+ inst_pkgs = [self.get_kernel_version_of_system()]
|
||||||
|
for inst_pkg in inst_pkgs:
|
||||||
|
- inst_pkg_vere = '%s-%s' % (inst_pkg.version, inst_pkg.release)
|
||||||
|
+ if isinstance(inst_pkg, str):
|
||||||
|
+ inst_pkg_vere = inst_pkg.rsplit(".", 1)[0]
|
||||||
|
+ else:
|
||||||
|
+ inst_pkg_vere = '%s-%s' % (inst_pkg.version, inst_pkg.release)
|
||||||
|
if not self.version.larger_than(required_pkg_vere, inst_pkg_vere):
|
||||||
|
hotpatch.state = self.UNRELATED
|
||||||
|
elif required_pkg_vere != inst_pkg_vere:
|
||||||
|
@@ -304,6 +310,24 @@ class HotpatchUpdateInfo(object):
|
||||||
|
hotpatch.state = self.INSTALLABLE
|
||||||
|
return
|
||||||
|
|
||||||
|
+ def get_kernel_version_of_system(self) -> str:
|
||||||
|
+ """
|
||||||
|
+ Get the kernel version of current system, according to the command of 'uname -r'.
|
||||||
|
+
|
||||||
|
+ Returns:
|
||||||
|
+ str: kernel version
|
||||||
|
+ """
|
||||||
|
+ cmd = ["uname", "-r"]
|
||||||
|
+ kernel_version = ''
|
||||||
|
+ kernel_version, return_code = cmd_output(cmd)
|
||||||
|
+ # 'uname -r' show the kernel version-release.arch of the current system
|
||||||
|
+ # [root@openEuler hotpatch]# uname -r
|
||||||
|
+ # 5.10.0-136.12.0.86.oe2203sp1.x86_64
|
||||||
|
+ if return_code != SUCCEED:
|
||||||
|
+ return kernel_version
|
||||||
|
+ kernel_version = kernel_version.split('\n')[0]
|
||||||
|
+ return kernel_version
|
||||||
|
+
|
||||||
|
def _parse_and_store_from_xml(self, updateinfoxml: str):
|
||||||
|
"""
|
||||||
|
Parse and store hotpatch update information from xxx-updateinfo.xml.gz
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,10 +1,11 @@
|
|||||||
Name: aops-ceres
|
Name: aops-ceres
|
||||||
Version: v1.3.3
|
Version: v1.3.3
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: An agent which needs to be adopted in client, it managers some plugins, such as gala-gopher(kpi collection), fluentd(log collection) and so on.
|
Summary: An agent which needs to be adopted in client, it managers some plugins, such as gala-gopher(kpi collection), fluentd(log collection) and so on.
|
||||||
License: MulanPSL2
|
License: MulanPSL2
|
||||||
URL: https://gitee.com/openeuler/%{name}
|
URL: https://gitee.com/openeuler/%{name}
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
Patch0001: 0001-revise-the-query-method-for-installed-kernel-package.patch
|
||||||
|
|
||||||
|
|
||||||
BuildRequires: python3-setuptools
|
BuildRequires: python3-setuptools
|
||||||
@ -28,7 +29,7 @@ dnf hotpatch plugin, it's about hotpatch query and fix
|
|||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{name}-%{version}
|
%autosetup -n %{name}-%{version} -p1
|
||||||
|
|
||||||
|
|
||||||
# build for aops-ceres
|
# build for aops-ceres
|
||||||
@ -57,6 +58,9 @@ cp -r hotpatch %{buildroot}/%{python3_sitelib}/dnf-plugins/
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Oct 23 2023 wangguangge<wangguangge@huawei.com> - v1.3.3-2
|
||||||
|
- revise the query method for installed kernel packages
|
||||||
|
|
||||||
* Wed Oct 11 2023 wenxin<shusheng.wen@outlook.com> - v1.3.3-1
|
* Wed Oct 11 2023 wenxin<shusheng.wen@outlook.com> - v1.3.3-1
|
||||||
- add hotpatch plugin
|
- add hotpatch plugin
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user