get information before migration

This commit is contained in:
xuezhixin 2024-11-11 11:22:07 +08:00
parent 75838ff0b5
commit 9d8a277dcf
2 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,93 @@
From acb29d91b7b13f56085bc9e9b511aef367de9a0b Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 15:04:12 +0800
Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=89=8D=E8=BD=AF=E4=BB=B6?=
=?UTF-8?q?=E5=8C=85=E5=92=8C=E7=B3=BB=E7=BB=9F=E4=BF=A1=E6=81=AF=E5=87=86?=
=?UTF-8?q?=E5=A4=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/Abisystmcompchk.py | 68 +++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
index eab8322..d717cdf 100644
--- a/sysmig_agent/Abisystmcompchk.py
+++ b/sysmig_agent/Abisystmcompchk.py
@@ -830,3 +830,71 @@ def get_system_unique_pkg(current_pkg_list, download_pkg_list):
fcw.write(data + '\n')
fcw.close()
+
+#Check the environment before migration and generate a detection report
+def migrate_before_abi_chk(q_query, task_status):
+ i=0
+ Flag='0'
+ Oth='2'
+ global percentage
+ global total_rpm_nums
+ task_status_error = '2'
+ migration_download_list = []
+
+ log = logger_init()
+ log.info('============== START TIME '+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+' ==============')
+
+ download_path = local_dir + 'uos/rpms'
+ current_packages_string = get_system_pkg_name(Flag, log)
+ if not current_packages_string:
+ msg_tup = ('0', task_status_error)
+ q_query.put(msg_tup)
+ log.info('The current progress exit:' + str(msg_tup))
+ #return False
+
+ os.system('yumdownloader --destdir=%s%s --skip-broken' %(download_path, current_packages_string))
+
+ download_list = get_system_pkg_list(migration_download_list)
+ if not download_list:
+ log.info('yumdownloader rpm pakcages failed ...')
+ msg_tup = ('0', task_status_error)
+ q_query.put(msg_tup)
+ log.info('The current progress exit:' + str(msg_tup))
+ #return False
+ total_rpm_nums = len(download_list)
+
+ current_list = get_system_pkg_name(Oth, log)
+ if not current_list:
+ msg_tup = ('0', task_status)
+ q_query.put(msg_tup)
+ log.info('The current progress exit:' + str(msg_tup_error))
+ #return False
+
+ get_system_unique_pkg(list(current_list), migration_download_list)
+
+ cur_dir = os.getcwd()
+ os.chdir(download_path)
+ rst = MutilThread(download_list, q_query, log)
+ os.chdir(cur_dir)
+
+ agent_ABI_check_result()
+
+ migrate_before_report_name = create_migrate_report_name(Flag, log)
+ if not migrate_before_report_name:
+ msg_tup = ('0', task_status)
+ q_query.put(msg_tup)
+ log.info('The current progress exit:' + str(msg_tup))
+ #return False
+
+ while i < 4:
+ write_migrate_report_rst =switch_write_migrate_report(migrate_before_report_name, i, Flag)
+ i = i + 1
+
+ task_status = '0'
+ msg_tup = (percentage, task_status)
+ q_query.put(msg_tup)
+ log.info('The current progress has been completed:' + str(msg_tup))
+ log.info('============== END TIME '+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+' ==============')
+
+ return '0'
+
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.3
Release: 1
Release: 2
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
@ -8,6 +8,7 @@ Source1: requires.tar.gz
Source2: xlwt-1.3.0-py2.py3-none-any.whl
# patches
Patch001: 0001-download-the-rpm-package-in-the-system.patch
Patch002: 0002-get-information-before-migration.patch
BuildArch: noarch
@ -107,6 +108,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-2
- 0002-get-information-before-migration.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-1
- 0001-download-the-rpm-package-in-the-system.patch