!117 get system package information in rpm database
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
31a1e762a3
114
0064-get-system-package-information-in-rpm-database.patch
Normal file
114
0064-get-system-package-information-in-rpm-database.patch
Normal file
@ -0,0 +1,114 @@
|
||||
From c741aa97826c80c5a26387f3c2fe7c78942be679 Mon Sep 17 00:00:00 2001
|
||||
From: xuezhixin <xuezhixin@uniontech.com>
|
||||
Date: Mon, 13 Nov 2023 10:32:52 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?=E5=9C=A8rpm=E6=95=B0=E6=8D=AE=E5=BA=93?=
|
||||
=?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=B3=BB=E7=BB=9F=E8=BD=AF=E4=BB=B6=E5=8C=85?=
|
||||
=?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BF=A1=E6=81=AF?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
sysmig_agent/Abisystmcompchk.py | 89 +++++++++++++++++++++++++++++++++
|
||||
1 file changed, 89 insertions(+)
|
||||
|
||||
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
|
||||
index 7a810f9..3ebee71 100644
|
||||
--- a/sysmig_agent/Abisystmcompchk.py
|
||||
+++ b/sysmig_agent/Abisystmcompchk.py
|
||||
@@ -231,3 +231,92 @@ def get_migrate_behind_rpm_pkg():
|
||||
return rpm_pkg_list
|
||||
|
||||
|
||||
+# Get the current system package
|
||||
+def get_system_pkg_name(flag, mig_logger):
|
||||
+ dist = '.uelc20'
|
||||
+ rpm_pkg_list = ''
|
||||
+ rpm_pkg_oth = []
|
||||
+
|
||||
+ if not os.path.exists(exp_rst_dir):
|
||||
+ os.makedirs(exp_rst_dir)
|
||||
+
|
||||
+ migration_before_uelc20_rpm = exp_rst_dir + 'migration-before-uelc20-rpm.csv'
|
||||
+ migration_before_eln_rpm = exp_rst_dir + 'migration-before-eln-rpm.csv'
|
||||
+
|
||||
+ ts = rpm.TransactionSet()
|
||||
+ mi = ts.dbMatch()
|
||||
+
|
||||
+ # migration before filter dist of '.uelc20'
|
||||
+ if flag == '0':
|
||||
+ if os.path.exists(migration_before_uelc20_rpm):
|
||||
+ os.remove(migration_before_uelc20_rpm)
|
||||
+ if os.path.exists(migration_before_eln_rpm):
|
||||
+ os.remove(migration_before_eln_rpm)
|
||||
+
|
||||
+ fbfu = open(migration_before_uelc20_rpm, 'w')
|
||||
+ fbfe = open(migration_before_eln_rpm, 'w')
|
||||
+ if system_version_id() == '7':
|
||||
+ for rpm_pkg in mi:
|
||||
+ if dist in rpm_pkg['release'].decode():
|
||||
+ fbfu.write(rpm_pkg['name'].decode() + '\n')
|
||||
+ else:
|
||||
+ fbfe.write(rpm_pkg['name'].decode() + '\n')
|
||||
+ rpm_pkg_list = rpm_pkg_list + ' ' + rpm_pkg['name'].decode()
|
||||
+ else:
|
||||
+ for rpm_pkg in mi:
|
||||
+ if dist in rpm_pkg['release']:
|
||||
+ fbfu.write(rpm_pkg['name'] + '\n')
|
||||
+ else:
|
||||
+ fbfe.write(rpm_pkg['name'] + '\n')
|
||||
+ rpm_pkg_list = rpm_pkg_list + ' ' + rpm_pkg['name']
|
||||
+ fbfu.close()
|
||||
+ fbfe.close()
|
||||
+ return rpm_pkg_list
|
||||
+
|
||||
+ # migration behind filter dist of '.uelc20'
|
||||
+ elif flag == '1':
|
||||
+ if os.path.exists(migration_before_uelc20_rpm):
|
||||
+ with open(migration_before_uelc20_rpm, 'r') as fbfu:
|
||||
+ fbfu_list = fbfu.readlines()
|
||||
+
|
||||
+ if os.path.exists(migration_system_install):
|
||||
+ os.remove(migration_system_install)
|
||||
+
|
||||
+ fbhe = open(migration_system_install, 'w')
|
||||
+ rst = str(abi_check_sys())
|
||||
+ if rst == '7':
|
||||
+ for rpm_pkg in mi:
|
||||
+ if dist in rpm_pkg['release'].decode():
|
||||
+ if rpm_pkg['name'].decode() not in fbfu_list:
|
||||
+ fbhe.write(rpm_pkg['name'].decode() + '\n')
|
||||
+ elif rst == '8':
|
||||
+ for rpm_pkg in mi:
|
||||
+ if dist in rpm_pkg['release']:
|
||||
+ if rpm_pkg['name'] not in fbfu_list:
|
||||
+ fbhe.write(rpm_pkg['name'] + '\n')
|
||||
+ else:
|
||||
+ mig_logger.info('migrate behind not exit verison id !!!')
|
||||
+ fbhe.close()
|
||||
+ else:
|
||||
+ mig_logger.info('file not exit:' + migration_before_uelc20_rpm)
|
||||
+ mig_logger.info('Please do migration before system compation check !!!')
|
||||
+ return False
|
||||
+ return True
|
||||
+
|
||||
+ elif flag == '2':
|
||||
+ if system_version_id() == '7':
|
||||
+ for rpm_name in mi:
|
||||
+ if dist not in rpm_name['release'].decode():
|
||||
+ rpm_pkg_oth.append(rpm_name['name'].decode())
|
||||
+ dist_flag = '1'
|
||||
+ else:
|
||||
+ for rpm_name in mi:
|
||||
+ if dist not in rpm_name['release']:
|
||||
+ rpm_pkg_oth.append(rpm_name['name'])
|
||||
+ dist_flag = '1'
|
||||
+
|
||||
+ if dist_flag == '1':
|
||||
+ return rpm_pkg_oth
|
||||
+ else:
|
||||
+ mig_logger.info('The current system is UOS, not support migration, please check !!!')
|
||||
+ return False
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.2
|
||||
Release: 63
|
||||
Release: 64
|
||||
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
|
||||
@ -70,6 +70,7 @@ 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
|
||||
Patch63: 0063-add-compare-with-package-result-in-abi-report.patch
|
||||
Patch64: 0064-get-system-package-information-in-rpm-database.patch
|
||||
|
||||
|
||||
BuildArch: noarch
|
||||
@ -169,6 +170,9 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user