check if file is binary
This commit is contained in:
parent
9137fe5cf0
commit
fbc6c600fe
56
0066-check-if-file-is-binary.patch
Normal file
56
0066-check-if-file-is-binary.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From f5106e3a71de94278d5ea337014038a3c607285e Mon Sep 17 00:00:00 2001
|
||||
From: xuezhixin <xuezhixin@uniontech.com>
|
||||
Date: Mon, 13 Nov 2023 10:39:36 +0800
|
||||
Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=96=87=E4=BB=B6=E6=98=AF?=
|
||||
=?UTF-8?q?=E5=90=A6=E4=B8=BA=E4=BA=8C=E8=BF=9B=E5=88=B6?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
sysmig_agent/Abisystmcompchk.py | 32 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
|
||||
index 3ebee71..14cad1d 100644
|
||||
--- a/sysmig_agent/Abisystmcompchk.py
|
||||
+++ b/sysmig_agent/Abisystmcompchk.py
|
||||
@@ -320,3 +320,35 @@ def get_system_pkg_name(flag, mig_logger):
|
||||
else:
|
||||
mig_logger.info('The current system is UOS, not support migration, please check !!!')
|
||||
return False
|
||||
+
|
||||
+
|
||||
+class myThread (threading.Thread):
|
||||
+ def __init__(self, threadID, name, q, lock, fpw, fpr, q_query, log):
|
||||
+ threading.Thread.__init__(self)
|
||||
+ self.threadID = threadID
|
||||
+ self.name = name
|
||||
+ self.q = q
|
||||
+ self.lock = lock
|
||||
+ self.fpw = fpw
|
||||
+ self.fpr = fpr
|
||||
+ self.q_query = q_query
|
||||
+ self.log = log
|
||||
+ def run(self):
|
||||
+ self.log.info ("Open the thread" + self.name)
|
||||
+ process_data(self.name, self.q, self.lock, self.fpw, self.fpr, self.q_query, self.log)
|
||||
+ self.log.info ("Exit the thread" + self.name)
|
||||
+
|
||||
+
|
||||
+def is_binwary_file(filename):
|
||||
+ TEXT_BOMS = {
|
||||
+ codecs.BOM_UTF16_BE,
|
||||
+ codecs.BOM_UTF16_LE,
|
||||
+ codecs.BOM_UTF32_BE,
|
||||
+ codecs.BOM_UTF32_LE,
|
||||
+ codecs.BOM_UTF8,
|
||||
+ }
|
||||
+ with open(filename, 'rb') as file:
|
||||
+ CHUNKSIZE = 8192
|
||||
+ initial_bytes = file.read(CHUNKSIZE)
|
||||
+ file.close
|
||||
+ return not any(initial_bytes.startswith(bom) for bom in TEXT_BOMS) and b'\0' in initial_bytes
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: migration-tools
|
||||
Version: 1.0.2
|
||||
Release: 65
|
||||
Release: 66
|
||||
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
|
||||
@ -72,7 +72,7 @@ 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
|
||||
Patch65: 0065-get-checking-envirnmnet-process.patch
|
||||
|
||||
Patch66: 0066-check-if-file-is-binary.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: systemd
|
||||
@ -171,6 +171,9 @@ rm -rf /usr/bin/migration-tools
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user