]>
git.proxmox.com Git - pve-edk2-firmware.git/blob - debian/find-binaries.py
3 # Use heuristics to identify new files that maybe binaries.
4 # Flagged files need to be manually inspected and either added to the
5 # ignore list (because they are safe to redistribute), or to the reject list
6 # (so that they'll be removed prior to orig.tar.xz generation).
15 OKPatterns
= [r
'\.gitignore', r
'AUTHORS', r
'FILE.LST', r
'Change[lL]og',
16 r
'COPYING', r
'configure', r
'FAQ', r
'(GNU)?[Mm]akefile',
17 r
'INDEX', r
'LICENSE', r
'README', r
'TODO']
18 OKRegexs
= map(re
.compile, OKPatterns
)
26 def extensionOK(name
):
27 OKExtensions
= ['1', '3', 'ASL', 'asi', 'asl', 'aslc', 'Asm', 'asm',
28 'asm16', 'bat', 'bmp', 'c', 'CMM', 'cmm', 'cnf', 'cpp',
29 'css', 'dec', 'decTest', 'dlg', 'dsc', 'docx', 'dsp',
30 'dsw', 'el', 'env', 'fdf', 'g', 'gif', 'H', 'h', 'hpp',
31 'html', 'i', 'idf', 'in', 'inc', 'inf', 'info', 'ini',
32 'lds', 'log', 'lua', 'mak', 'makefile', 'md', 'nasm',
33 'nasmb', 'nsh', 'patch', 'pbxuser', 'pbxproj', 'pdf',
34 'pem', 'pl', 'png', 'pod', 'ps', 'py', 'r', 'rtf', 'S',
35 's', 'sct', 'sh', 'sln', 't', 'template', 'txt', 'uni',
36 'Vfr', 'vcproj', 'vfi', 'vfr', 'xml']
37 ext
= name
.split('.')[-1]
39 if ext
in OKExtensions
:
44 if __name__
== '__main__':
49 with
open('./debian/binary-check.ignore', 'r') as f
:
50 ignoreglobs
= list(map(lambda s
: s
.strip(), f
.readlines()))
51 for pattern
in ignoreglobs
:
52 matches
= glob
.glob(pattern
, recursive
=True, include_hidden
=True)
55 f
"WARNING: pattern {pattern} matched no files.",
60 for root
, dirs
, files
in os
.walk(top
):
62 relpath
= os
.path
.join(root
, name
)[len(top
):]
63 if relpath
in ignorelist
:
64 print(f
"Ignoring: {relpath}", file=sys
.stderr
)
72 "WARNING: Possible binary %s\n" %
73 (os
.path
.join(root
, name
))