From 47a343bc632e59efb703e35434a44072271288ea Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 19 Jul 2022 10:15:42 +0200 Subject: [PATCH] debian: backport packaging improvements Signed-off-by: Thomas Lamprecht --- ...ary-check.whitelist => binary-check.allow} | 0 ...ry-check.blacklist => binary-check.remove} | 15 ++++--- debian/find-binaries.py | 43 +++++++++++-------- debian/remove-binaries.py | 6 +-- 4 files changed, 36 insertions(+), 28 deletions(-) rename debian/{binary-check.whitelist => binary-check.allow} (100%) rename debian/{binary-check.blacklist => binary-check.remove} (72%) diff --git a/debian/binary-check.whitelist b/debian/binary-check.allow similarity index 100% rename from debian/binary-check.whitelist rename to debian/binary-check.allow diff --git a/debian/binary-check.blacklist b/debian/binary-check.remove similarity index 72% rename from debian/binary-check.blacklist rename to debian/binary-check.remove index de1abec..0d6c47f 100644 --- a/debian/binary-check.blacklist +++ b/debian/binary-check.remove @@ -33,9 +33,12 @@ BaseTools/Bin/Darwin-i386/Arm/RELEASE_XCODE32/CompilerIntrinsicsLib.lib BaseTools/Source/Python/Eot/EfiCompressor.pyd BaseTools/Source/Python/Eot/LzmaCompressor.pyd IntelFsp2Pkg/FspSecCore/Vtf0/Bin/ResetVec.ia32.raw -UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw -UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw -UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw -UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.port80.raw -UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.raw -UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.serial.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.serial.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw +UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw diff --git a/debian/find-binaries.py b/debian/find-binaries.py index b506382..b3f3dde 100644 --- a/debian/find-binaries.py +++ b/debian/find-binaries.py @@ -2,17 +2,18 @@ # Use heuristics to identify new files that maybe binaries. # Flagged files need to be manually inspected and either added to the -# whitelist (because they are safe to redistribute), or to the blacklist +# allow list (because they are safe to redistribute), or to the reject list # (so that they'll be removed prior to orig.tar.xz generation). import os import re import sys + def nameOK(name): - OKPatterns = ['\.gitignore', 'AUTHORS', 'FILE.LST', 'Change[lL]og', - 'COPYING', 'configure', 'FAQ', '(GNU)?[Mm]akefile', - 'INDEX', 'LICENSE', 'README', 'TODO' ] + OKPatterns = [r'\.gitignore', r'AUTHORS', r'FILE.LST', r'Change[lL]og', + r'COPYING', r'configure', r'FAQ', r'(GNU)?[Mm]akefile', + r'INDEX', r'LICENSE', r'README', r'TODO'] OKRegexs = map(re.compile, OKPatterns) for r in OKRegexs: @@ -20,40 +21,44 @@ def nameOK(name): return True return False + def extensionOK(name): - OKExtensions = [ '1', '3', 'ASL', 'asi', 'asl', 'aslc', 'Asm', 'asm', - 'asm16', 'bat', 'bmp', 'c', 'CMM', 'cmm', 'cnf', 'cpp', - 'css', 'dec', 'decTest', 'dlg', 'dsc', 'docx', 'dsp', - 'dsw', 'el', 'env', 'fdf', 'g', 'gif', 'H', 'h', 'hpp', - 'html', 'i', 'idf', 'in', 'inc', 'inf', 'info', 'ini', - 'lds', 'log', 'lua', 'mak', 'makefile', 'md', 'nasm', - 'nasmb', 'nsh', 'patch', 'pbxuser', 'pbxproj', 'pdf', - 'pem', 'pl', 'png', 'pod', 'ps', 'py', 'r', 'rtf', 'S', - 's', 'sct', 'sh', 'sln', 't', 'template', 'txt', 'uni', - 'Vfr', 'vcproj', 'vfi', 'vfr', 'xml' ] + OKExtensions = ['1', '3', 'ASL', 'asi', 'asl', 'aslc', 'Asm', 'asm', + 'asm16', 'bat', 'bmp', 'c', 'CMM', 'cmm', 'cnf', 'cpp', + 'css', 'dec', 'decTest', 'dlg', 'dsc', 'docx', 'dsp', + 'dsw', 'el', 'env', 'fdf', 'g', 'gif', 'H', 'h', 'hpp', + 'html', 'i', 'idf', 'in', 'inc', 'inf', 'info', 'ini', + 'lds', 'log', 'lua', 'mak', 'makefile', 'md', 'nasm', + 'nasmb', 'nsh', 'patch', 'pbxuser', 'pbxproj', 'pdf', + 'pem', 'pl', 'png', 'pod', 'ps', 'py', 'r', 'rtf', 'S', + 's', 'sct', 'sh', 'sln', 't', 'template', 'txt', 'uni', + 'Vfr', 'vcproj', 'vfi', 'vfr', 'xml'] ext = name.split('.')[-1] if ext in OKExtensions: return True return False + if __name__ == '__main__': top = './' for root, dirs, files in os.walk(top): - with open('./debian/binary-check.whitelist', 'r') as f: - whitelist = list(map(lambda s: s.strip(), f.readlines())) + with open('./debian/binary-check.allow', 'r') as f: + allowlist = list(map(lambda s: s.strip(), f.readlines())) ret = 0 for name in files: relpath = os.path.join(root, name)[len(top):] - if relpath in whitelist: + if relpath in allowlist: continue if nameOK(name): continue if extensionOK(name): continue else: - sys.stdout.write("WARNING: Possible binary %s\n" % (os.path.join(root, name))) + sys.stdout.write( + "WARNING: Possible binary %s\n" % + (os.path.join(root, name)) + ) ret = -1 sys.exit(ret) - diff --git a/debian/remove-binaries.py b/debian/remove-binaries.py index 6a5c966..d3298f1 100644 --- a/debian/remove-binaries.py +++ b/debian/remove-binaries.py @@ -4,9 +4,9 @@ import os import sys if __name__ == '__main__': - with open('./debian/binary-check.blacklist', 'r') as f: - blacklist = list(map(lambda s: s.strip(), f.readlines())) + with open('./debian/binary-check.remove', 'r') as f: + removelist = list(map(lambda s: s.strip(), f.readlines())) - for path in blacklist: + for path in removelist: sys.stdout.write("Removing %s\n" % (path)) os.unlink(path) -- 2.39.2