From 926e8dc94c5e880d86c66b17e070f102759a47b7 Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Thu, 7 Nov 2024 14:49:36 +0800 Subject: [PATCH] get package list from repository --- 0071-get-package-list-from-repository.patch | 70 +++++++++++++++++++++ migration-tools.spec | 6 +- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 0071-get-package-list-from-repository.patch diff --git a/0071-get-package-list-from-repository.patch b/0071-get-package-list-from-repository.patch new file mode 100644 index 0000000..f4fadd0 --- /dev/null +++ b/0071-get-package-list-from-repository.patch @@ -0,0 +1,70 @@ +From 10648fa7ce12f1e01c97d91429c11f0b6fae907b Mon Sep 17 00:00:00 2001 +From: lixin +Date: Mon, 13 Nov 2023 11:00:36 +0800 +Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=BD=AF=E4=BB=B6=E4=BB=93?= + =?UTF-8?q?=E5=BA=93=E4=BF=A1=E6=81=AF?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + index.py | 1 + + views/server.py | 30 ++++++++++++++++++++++++++++++ + 2 files changed, 31 insertions(+) + +diff --git a/index.py b/index.py +index 8629ae3..d9a564b 100644 +--- a/index.py ++++ b/index.py +@@ -34,6 +34,7 @@ mods = { + 'get_repo_data': server.get_repo_data, + 'check_environment':migration.check_environment, + 'get_environment_data': server.get_environment_data, ++ 'get_repo_arch_info': server.get_repo_arch_info, + } + + +diff --git a/views/server.py b/views/server.py +index c959c2a..0a8eeed 100644 +--- a/views/server.py ++++ b/views/server.py +@@ -291,5 +291,35 @@ def get_environment_data(data): + res['info'] = info_list + res['num'] = len(finall_progress) + ++ json_res = json.dumps(res) ++ return json_res ++ ++ ++def get_repo_arch_info(data): ++ """ ++ 获取软件仓库架构和系统信息 ++ :param data: ++ :return: ++ """ ++ sql = "select agent_os,agent_arch from agent_info where agent_online_status='0' and agent_storage>='10' " \ ++ "and agent_migration_os is null;" ++ get_info = DBHelper().execute(sql).fetchall() ++ get_info_list = [] ++ for i in get_info: ++ get_info_list.append(list(i)) ++ ++ for i in get_info_list : ++ if i[0] == 'redhat7': ++ i[0] = 'centos7' ++ if i[0] == 'redhat8': ++ i[0] = 'centos8' ++ ++ info_list = [] ++ info_dict_keys_list = ['agent_os', 'agent_arch'] ++ for i in get_info_list: ++ info_list.append(dict(zip(info_dict_keys_list, i))) ++ ++ res = {} ++ res['info'] = info_list + json_res = json.dumps(res) + return json_res +\ No newline at end of file +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index 80752a5..4394ad4 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 70 +Release: 71 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 @@ -77,6 +77,7 @@ Patch67: 0067-add-an-abi-comparation-function.patch Patch68: 0068-get-file-list-and-provide-file-path-to-compare.patch Patch69: 0069-get-package-list-downloaded-locally-from-the-software-repository.patch Patch70: 0070-interface-for-obtaining-repo-interface.patch +Patch71: 0071-get-package-list-from-repository.patch BuildArch: noarch @@ -176,6 +177,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Tue Nov 5 2024 xuezhixin - 1.0.2-71 +- 0071-get-package-list-from-repository.patch + * Tue Nov 5 2024 xuezhixin - 1.0.2-70 - 0070-interface-for-obtaining-repo-interface.patch -- Gitee