Name:       migration-tools
Version:    1.0.3
Release:    14
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
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
Patch003:   0003-export-migration-check-report.patch
Patch004:   0004-complete-information-report-after-abi-detection.patch
Patch005:   0005-abi-detection-through-multi-threads.patch
Patch006:   0006-add-message-query-to-update-abi-process.patch
Patch007:   0007-start-task-to-check-migration.patch
Patch008:   0008-add-system-migration-task.patch
Patch009:   0009-get-abi-detection-process.patch
Patch010:   0010-update-abi-result-to-database.patch
Patch011:   0011-initializate-the-migration-status.patch
Patch012:   0012-get-agent-kernel-version.patch
Patch013:   0013-set-agent-migration-task.patch
Patch014:   0014-compare-with-request-agent-ip.patch


BuildArch:  noarch
BuildRequires:  systemd	
%description
UOS Migration Software

%if 0%{?rhel} >= 7
%package -n migration-tools-agent
Summary:        migration-tools-agent
License:        MulanPSL-2.0
Requires:       dnf
Requires:       libabigail
Requires:       python3
Requires:       python3-flask
Requires:       python3-paramiko
Requires:       python3-requests
Requires:       python3-xlrd
Requires:       python3-xlwt
Requires:       openssl
Requires:       rsync
Requires:       yum-utils

%description -n migration-tools-agent
Migration software agent side
%endif

%package -n migration-tools-server
Summary: 	migration-tools-server
License:	MulanPSL-2.0
Requires:	python3
Requires:	python3-pip
Requires:	python3-paramiko
Requires:	python3-flask
Requires:	python3-requests

%description -n migration-tools-server
Migration software server side


%prep
%autosetup -p1


%if 0%{?openEuler}
mkdir -p agent-requires/
cp -f %SOURCE1 agent-requires/
cp -f %SOURCE2 agent-requires/
%endif

%install
rm -rf %{buildroot}
mkdir -p $RPM_BUILD_ROOT/usr/lib/migration-tools-server
mkdir -p $RPM_BUILD_ROOT/var/tmp/uos-migration
mkdir -p $RPM_BUILD_ROOT/etc/migration-tools
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
%{__cp} -r * $RPM_BUILD_ROOT/usr/lib/migration-tools-server/


%if 0%{?rhel} >= 7
mkdir -p $RPM_BUILD_ROOT/usr/lib/migration-tools-agent
%{__cp} -r * $RPM_BUILD_ROOT/usr/lib/migration-tools-agent/

%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools-agent.service $RPM_BUILD_ROOT%{_unitdir}
%endif

# Install server config
%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/uos-sysmig.conf $RPM_BUILD_ROOT/etc/migration-tools
%{__cp} -r $RPM_BUILD_ROOT/usr/lib/migration-tools-server/server/migration-tools-server.service $RPM_BUILD_ROOT%{_unitdir}

%posttrans
%{_bindir}/systemctl daemon-reload

%post -n migration-tools-server
pip3 install /usr/lib/migration-tools-server/agent-requires/xlwt-1.3.0-py2.py3-none-any.whl --no-cache-dir
chmod +x /usr/lib/migration-tools-server/server/start_webview.sh
ln -sf /usr/lib/migration-tools-server/server/start_webview.sh /usr/bin/migration-tools

%preun -n migration-tools-server
if [ $1 = 0 ];then
    systemctl stop migration-tools-server.service
fi

%postun -n migration-tools-server
rm -rf /usr/bin/migration-tools

%files -n migration-tools-server
/etc/migration-tools
/usr/lib/migration-tools-server
%{_unitdir}/migration-tools-server.service

%if 0%{?rhel} >= 7
%files -n migration-tools-agent
/etc/migration-tools
/usr/lib/migration-tools-agent
%{_unitdir}/migration-tools-agent.service
%endif

%changelog
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-14
- 0014-compare-with-request-agent-ip.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-13
- 0013-set-agent-migration-task.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-12
- 0012-get-agent-kernel-version.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-11
- 0011-initializate-the-migration-status.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-10
- 0010-update-abi-result-to-database.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-9
- 0009-get-abi-detection-process.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-8
- 0008-add-system-migration-task.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-7
- 0007-start-task-to-check-migration.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-6
- 0006-add-message-query-to-update-abi-process.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-5
- 0005-abi-detection-through-multi-threads.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-4
- 0004-complete-information-report-after-abi-detection.patch

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-3
- 0003-export-migration-check-report.patch

* 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

* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-0
- update to 1.0.3

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-84
- 0084-divide-detection-report-into-mutiple-sheet-pages.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-83
- 0083-add-basic-summary-information-to-the-report.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-82
- 0082-write-the-data-of-each-row-and-column-into-report.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-81
- 0081-add-interface-to-export-migration-check-report.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-80
- 0080-write-the-data-of-each-row-into-report.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-79
- 0079-get-agent-storage-information.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-78
- 0078-fill-in-the-data-in-the-checked-templace.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-77
- 0077-copy-from-unzip-rpm-diractory-and-system-file-to-compatility-diractory.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-76
- 0076-detection-storage-interface.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-75
- 0075-detection-basic-information-and-format-abi-compatibility-information-to-report.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-74
- 0074-detection-basic-system-information.patch

* 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

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-71
- 0071-get-package-list-from-repository.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-70
- 0070-interface-for-obtaining-repo-interface.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-69
- 0069-get-package-list-downloaded-locally-from-the-software-repository.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-68
- 0068-get-file-list-and-provide-file-path-to-compare.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-67
- 0067-add-an-abi-comparation-function.patch 

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-66
- 0066-check-if-file-is-binary.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-65
- 0065-get-checking-envirnmnet-process.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-64
- 0064-get-system-package-information-in-rpm-database.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-63
- 0063-add-compare-with-package-result-in-abi-report.patch

* 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

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-60
- 0060-add-four-detection-item-to-abi-report.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-59
- 0059-add-kernel-detection-result-to-abi-report.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-58
- 0058-get-detection-envirnment-process-interface.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-57
- 0057-abi-basic-data-for-report.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-56
- 0056-modify-detection-envirnment-interface.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-55
- 0055-add-envirnment-detection-interface-before-migration.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-54
- 0054-removed-detection-abi-script.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-53
- 0053-get-repository-detection-result.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-52
- 0052-increase-the-weight-of-abi-detection-result.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-51
- 0051-add-basic-system-detection-information-and-upload-the-database.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-50
- 0050-check-free-space-in-system-disk.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-49
- 0049-add-interface-to-check-repository-result.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-48
- 0048-server-send-kernel-detection-task.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-47
- 0047-check-kernel-version-in-repository.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-46
- 0046-agent-sends-task-update-requrst-to-the-server.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-45
- 0045-modify-repository-file.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-44
- 0044-migrate-in-myutiple-steps.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-43
- 0043-process-os-version-and-os-name.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-42
- 0042-get-initial-os-version-from-agent_info-interface.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-41
- 0041-get-migration-status-from-database.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-40
- 0040-intial-logfile-and-tmpfile.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-39
- 0039-repository-file-choose-kernel-version-to-migration.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-38
- 0038-obtain-kernel-data.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-37
- 0037-add-subprocess-function-and-loggin.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-36
- 0036-add-an-interface-to-obtain-kernel-information.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-35
- 0035-the-migration-process-can-choose-not-to-migrate-the-kernel.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-34
- 0034-add-centos7-and-centos8-migration-interface.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-33
- 0033-check-system-kernrel.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-32
- 0032-add-migration.py-to-migration-function.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-31
- 0031-migration-check-and-extract-macros.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-30
- 0030-system-information-import-info-the-database-after-migration.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-29
- 0029-json-and-list-format-interchange.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-28
- 0028-send-agent-task.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-27
- 0027-fix-grub-file-for-system-option.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-26
- 0026-create-repository-and-disable-local-repofile.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-25
- 0025-update-migration-status-to-database.patch

* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-24
- 0024-add-url-processing-function.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-23
- 0023-update-the-status-of-the-migration-phase.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-22
- 0022-udpate-agent-host-status-online.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-21
- 0021-get-agent-ip-interface.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-20
- 0020-get-task-process-and-migration-stage-information.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-19
- 0019-update-abi-result-to-database.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-18
- 0018-detection-of-imported-host-information-interface.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-17
- 0017-add-process-data-in-database.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-16
- 0016-get-local-ip-on-the-agent.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-15
- 0015-delete-host-information-interface.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-14
- 0014-modify-task-stream-interface.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-13
- 0013-display-agent-host-information.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-12
- 0012-add-agent_task-in-database.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-11
- 0011-replace-agent-with-func-diractory.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-10
- 0010-create-task-stream-interface.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-9
- 0009-add-task_stream-table-in-database.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-8
- 0008-add-agent_info-table-in-database.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-7
- 0007-add-function-to-import-machine.patch

* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-6
- 0006-add-loger-interface-function.patch

* Fri Nov 1 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-5
- add 0005-execution-sql-function.patch

* Fri Nov 1 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-4
- add 0004-connect-sql-function.patch

* Fri Nov 1 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-3
- add 0003-delete-redundant-code.patch

* Fri Nov 1 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-2
- add 0002-modify-excel-report-content.patch

* Thu Oct 31 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-1
- add 0001-stander-code.patch

* Tue Aug 27 2024 lihaipeng <lihaipeng@uniontech.com> - 1.0.1-7
- fix cancel button function in tool

* Tue Jul 09 2024 Wenhua Huang <huangwenhua@kylinos.cn> - 1.0.1-6
- add BuildRequires systemd

* Tue Apr 02 2024 lixin <lixinb@uniontech.com> - 1.0.1-5
- adjust the display sequence

* Mon Apr 01 2024 lixin <lixinb@uniontech.com> - 1.0.1-4
- modify description

* Mon Mar 18 2024 lixin <lixinb@uniontech.com> - 1.0.1-3
- fix stop service display failed
- update spec

* Mon Mar 11 2024 lixin <lixinb@uniontech.com> - 1.0.1-2
- fix : CVE-2024-24892
- use paramiko instead of sshpass to export migration log
- and data

* Tue Mar 05 2024 lixin <lixinb@uniontech.com> - 1.0.1-1
- Supports migrations to OpenEuler system using the web-based interface.

* Wed Sep 06 2023 lixin <lixinb@uniontech.com> - 1.0.0-4
- fix: fix uefi boot failed
- fix: modify grub rules to match NIC name after migration

* Tue Aug 22 2023 lixin <lixinb@uniontech.com> - 1.0.0-3
- feat: add aarch64 agent package

* Mon Aug 21 2023 lixin <lixinb@uniontech.com> - 1.0.0-2
- fix export log and migration report error
- fix no migration detail error

* Wed Aug 16 2023 lixin <lixinb@uniontech.com> - 1.0.0-1
 init
