!115 add detection ELF content in abi file
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
92a5e1b82f
46
0062-add-detection-ELF-content-in-abi-file.patch
Normal file
46
0062-add-detection-ELF-content-in-abi-file.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 0827581dc9f64cfa96601fa36ae1fdc6d8e14dac Mon Sep 17 00:00:00 2001
|
||||
From: xuezhixin <xuezhixin@uniontech.com>
|
||||
Date: Mon, 13 Nov 2023 10:19:04 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?ABI=E5=A2=9E=E5=8A=A0ELF=E6=96=87=E4=BB=B6?=
|
||||
=?UTF-8?q?=E6=A3=80=E6=B5=8B?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
sysmig_agent/Abisystmcompchk.py | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
|
||||
index e442cb5..541e9a8 100644
|
||||
--- a/sysmig_agent/Abisystmcompchk.py
|
||||
+++ b/sysmig_agent/Abisystmcompchk.py
|
||||
@@ -180,3 +180,25 @@ def logger_init():
|
||||
logger.addHandler(fh)
|
||||
|
||||
return logger
|
||||
+
|
||||
+
|
||||
+# Check whether it is an ELF file
|
||||
+def is_ELFfile(filepath, logger):
|
||||
+ if not os.path.exists(filepath):
|
||||
+ logger.info('file not exit:' + filepath)
|
||||
+ return False
|
||||
+ try:
|
||||
+ FileStates = os.stat(filepath)
|
||||
+ FileMode = FileStates[stat.ST_MODE]
|
||||
+ if not stat.S_ISREG(FileMode) or stat.S_ISLNK(FileMode):
|
||||
+ return False
|
||||
+ with open(filepath, 'rb') as f:
|
||||
+ header = (bytearray(f.read(4)[1:4])).decode(encoding="utf-8")
|
||||
+ # logger.info("header is {}".format(header))
|
||||
+ if header in ["ELF"]:
|
||||
+ return True
|
||||
+ except UnicodeDecodeError as e:
|
||||
+ # logger.info("is_ELFfile UnicodeDecodeError {}".format(filepath))
|
||||
+ # logger.info(str(e))
|
||||
+ pass
|
||||
+ return False
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.2
|
||||
Release: 61
|
||||
Release: 62
|
||||
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
|
||||
@ -68,7 +68,7 @@ Patch58: 0058-get-detection-envirnment-process-interface.patch
|
||||
Patch59: 0059-add-kernel-detection-result-to-abi-report.patch
|
||||
Patch60: 0060-add-four-detection-item-to-abi-report.patch
|
||||
Patch61: 0061-detection-abi-log.patch
|
||||
|
||||
Patch62: 0062-add-detection-ELF-content-in-abi-file.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: systemd
|
||||
@ -167,6 +167,9 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-62
|
||||
- 0062-add-detection-ELF-content-in-abi-file.patch
|
||||
|
||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-61
|
||||
- 0061-detection-abi-log.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user