From 01490e647d9817065498df4e5362acd5bb54a0e8 Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Wed, 6 Nov 2024 17:01:53 +0800 Subject: [PATCH] abi basic data for reprt --- 0057-abi-basic-data-for-report.patch | 140 +++++++++++++++++++++++++++ migration-tools.spec | 7 +- 2 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 0057-abi-basic-data-for-report.patch diff --git a/0057-abi-basic-data-for-report.patch b/0057-abi-basic-data-for-report.patch new file mode 100644 index 0000000..94d50aa --- /dev/null +++ b/0057-abi-basic-data-for-report.patch @@ -0,0 +1,140 @@ +From 9031ccf7e657286dfb18fe181fe97080ce5228dc Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 09:58:36 +0800 +Subject: [PATCH] =?UTF-8?q?ABI=E6=A3=80=E6=B5=8B=E6=8A=A5=E5=91=8A?= + =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/Abisystmcompchk.py | 116 ++++++++++++++++++++++++++++++++ + 1 file changed, 116 insertions(+) + create mode 100644 sysmig_agent/Abisystmcompchk.py + +diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py +new file mode 100644 +index 0000000..abe6083 +--- /dev/null ++++ b/sysmig_agent/Abisystmcompchk.py +@@ -0,0 +1,116 @@ ++# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. ++# SPDX-License-Identifier: MulanPubL-2.0-or-later ++ ++ ++import queue,os,string ++import threading,codecs ++import time,rpm,stat,re ++import datetime ++import platform ++import json,xlrd,xlwt ++import socket ++from xlutils.copy import copy ++from shutil import copyfile ++#from sysmig_agent.share import * ++from multiprocessing import Process ++from multiprocessing import cpu_count ++ ++from logger import * ++#from connect_sql import DBHelper ++ ++workQueue = queue.Queue() ++queueLock = threading.Lock() ++ ++#为便于测试将变量、接口从share.py中拷贝到当前文件,待联调通过后删除即可 ++######################## add for test start ######################## ++local_dir = '/var/tmp/uos-migration/data/' ++exp_rst_dir = local_dir+'exp-rst/' ++ ++current_system_unique = exp_rst_dir + 'current-system-unique.csv' ++migration_system_install = exp_rst_dir + 'migration-system-install.csv' ++migration_system_total = exp_rst_dir + 'migration-system-total.csv' ++abi_comp_chk = exp_rst_dir + 'abi-comp-chk.csv' ++abi_incomp_chk = exp_rst_dir + 'abi-incomp-chk.csv' ++exitFlag = 0 ++total_rpm_nums = 0 ++percentage = '' ++deal_rpm_num = 0 ++agent_abi_check_result = exp_rst_dir + 'agent_ABI_check_result.csv' ++suffix_list = ['.mo', '.gz', '.xml', '.conf', '.png', '.page', '.woff', '.ttf', '.pyc', '.typelib', '.pdf', '.ppt', '.txt', '.ico', '.icc', '.tcc', '.gif', '.oga', '.rom', '.jpg', '.dict', '.webm', '.pyc', '.wav', '.ucode', '.ttc', '.gresource', '.otf', '.t1', '.db', '.elc', '.cache', '.fd', '.iso', '.efi', '.mmdb', '.bz2', '.img', '.bin', '.fw', '.cis', '.itb', '.inp', '.sbcf', '.ddc', '.sfi', '.bseq', '.mfa2', '.chk', '.mgc', '.stub', '.dfu', '.dat', '.sys', '.bts', '.dlmem', '.brd', '.hwm', '.pwd', '.pwi', '.exe', '.der', '.p12', '.ogg', '.signed', '.dafsa', '.gpg', '.tri', '.x86_64'] ++ ++#Queue = queue.Queue() ++ ++def os_storage(): ++ """ ++ 判断系统剩余空间大小 ++ :return: GB ++ """ ++ path = '/var/cache' ++ stat = os.statvfs(path) ++ CACHE_SPACE = 10.0 ++ state = 1 ++ ava_cache = format(stat.f_bavail * stat.f_frsize / 1024 // 1024 / 1024, '.1f') ++ if stat: ++ # with open(PRE_MIG,'a+') as pf: ++ # pf.write('/var/cache可用空间为'+ava_cache+'GB') ++ # pf.close() ++ if float(ava_cache) >= CACHE_SPACE: ++ state = 0 ++ return ava_cache ++ # data = '可用空间为'+ava_cache+'GB' ++ else: ++ return ava_cache ++ # data = '可用空间为' + ava_cache + 'GB,请清理/var/cache的空间后重试。' ++ else: ++ return ava_cache ++ # data = '可用空间为'+ava_cache+'GB,请清理/var/cache的空间后重试。' ++ # return list_to_json(keylist,valuelist) ++ ++def get_local_ip(): ++ try: ++ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ++ s.connect(('8.8.8.8', 80)) ++ ip = s.getsockname()[0] ++ return ip ++ finally: ++ s.close() ++ ++def abi_check_sys_type(): ++ path = '/etc/os-version' ++ if os.path.exists(path): ++ with open(path,'r') as v: ++ ret = v.readlines() ++ localos=ostype='' ++ for i in range(len(ret)): ++ if not ret[i]: ++ continue ++ if 'MinorVersion' in ret[i]: ++ strminor = str(ret[i]) ++ _, localos = strminor.split('=',1) ++ if 'EditionName[zh_CN]' in ret[i]: ++ strminor = str(ret[i]) ++ _, ostype = strminor.split('=',1) ++ ostype = re.sub('[^a-zA-Z]+','',ostype) ++ localos = localos.strip().strip('\n') + ostype.strip().strip('\n') ++ #localos = new_os.format(localos.strip().strip('\n')) ++ return localos ++ ++def abi_check_sys(): ++ c8 = ['1020a', '1021a', '1050a'] ++ c7 = ['1000c', '1001c', '1002a'] ++ system_type = abi_check_sys_type() ++ if not system_type: ++ os_version_ret = platform.dist() ++ osname = os_version_ret[1].strip() ++ osn = osname.split('.',-1)[0] ++ return osn.strip('\n') ++ for i in range(len(c8)): ++ if c8[i] in system_type: ++ return 8 ++ for i in range(len(c7)): ++ if c7[i] in system_type: ++ return 7 ++ return None ++ ++######################## add for test end ######################## ++######################## add for test end ######################## +\ No newline at end of file +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index 4d47d8a..95dbad4 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 56 +Release: 57 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 @@ -63,7 +63,7 @@ Patch53: 0053-get-repository-detection-result.patch Patch54: 0054-removed-detection-abi-script.patch Patch55: 0055-add-envirnment-detection-interface-before-migration.patch Patch56: 0056-modify-detection-envirnment-interface.patch - +Patch57: 0057-abi-basic-data-for-report.patch BuildArch: noarch BuildRequires: systemd @@ -162,6 +162,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Tue Nov 5 2024 xuezhixin - 1.0.2-57 +- 0057-abi-basic-data-for-report.patch + * Tue Nov 5 2024 xuezhixin - 1.0.2-56 - 0056-modify-detection-envirnment-interface.patch -- Gitee