!126 get os version and os id

From: @xuezhizone 
Reviewed-by: @xingwei-liu 
Signed-off-by: @xingwei-liu
This commit is contained in:
openeuler-ci-bot 2024-11-07 09:11:48 +00:00 committed by Gitee
commit 97b60bd93c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,42 @@
From e5178a05c2a6a2032e1db5a5d2329b8b63862dcc Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 13:57:59 +0800
Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=B3=BB=E7=BB=9F=E7=89=88?=
=?UTF-8?q?=E6=9C=AC=E5=92=8C=E7=B3=BB=E7=BB=9FID?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/Abisystmcompchk.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
index f402a74..913fef1 100644
--- a/sysmig_agent/Abisystmcompchk.py
+++ b/sysmig_agent/Abisystmcompchk.py
@@ -528,3 +528,21 @@ def incomp_pkg_num():
tmp = line.split(',')[0]
return num
+
+def system_version_id():
+ fp = open('/etc/os-release', 'r')
+ for line in fp:
+ if 'VERSION_ID' in line:
+ break
+ fp.close()
+ return line.split('=', 1)[1].replace('"', '').replace('\n', '')
+
+
+def get_cur_sys_version():
+ fp = open('/etc/os-release', 'r')
+ for line in fp:
+ if 'PRETTY_NAME' in line:
+ break
+ fp.close()
+ return line.split('=', 1)[1].replace('"', '').replace('\n', '')
+
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 72
Release: 73
License: MulanPSL-2.0
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
Source0: %{name}-%{version}.tar.gz
@ -79,7 +79,7 @@ Patch69: 0069-get-package-list-downloaded-locally-from-the-software-repositor
Patch70: 0070-interface-for-obtaining-repo-interface.patch
Patch71: 0071-get-package-list-from-repository.patch
Patch72: 0072-count-the-total-number-of-abi-compatible-lists.patch
Patch73: 0073-get-os-version-and-os-id.patch
BuildArch: noarch
@ -179,6 +179,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-73
- 0073-get-os-version-and-os-id.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-72
- 0072-count-the-total-number-of-abi-compatible-lists.patch