mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-26 08:56:24 +01:00
contrib: assume binary existence in sec/sym checks
If the binaries don't exist, the Guix build has failed for some other reason. There's no need to check for unknown architectures, or executable formats, as the only ones that could be built are those that we've configured toolchains for in Guix. We've also been doing this inconsistently across the two scripts.
This commit is contained in:
parent
51d8f435c9
commit
1bc9f64bee
2 changed files with 18 additions and 41 deletions
|
@ -248,31 +248,16 @@ CHECKS = {
|
|||
if __name__ == '__main__':
|
||||
retval: int = 0
|
||||
for filename in sys.argv[1:]:
|
||||
try:
|
||||
binary = lief.parse(filename)
|
||||
etype = binary.format
|
||||
arch = binary.abstract.header.architecture
|
||||
binary.concrete
|
||||
binary = lief.parse(filename)
|
||||
etype = binary.format
|
||||
arch = binary.abstract.header.architecture
|
||||
binary.concrete
|
||||
|
||||
if etype == lief.EXE_FORMATS.UNKNOWN:
|
||||
print(f'{filename}: unknown executable format')
|
||||
retval = 1
|
||||
continue
|
||||
|
||||
if arch == lief.ARCHITECTURES.NONE:
|
||||
print(f'{filename}: unknown architecture')
|
||||
retval = 1
|
||||
continue
|
||||
|
||||
failed: list[str] = []
|
||||
for (name, func) in CHECKS[etype][arch]:
|
||||
if not func(binary):
|
||||
failed.append(name)
|
||||
if failed:
|
||||
print(f'{filename}: failed {" ".join(failed)}')
|
||||
retval = 1
|
||||
except IOError:
|
||||
print(f'{filename}: cannot open')
|
||||
failed: list[str] = []
|
||||
for (name, func) in CHECKS[etype][arch]:
|
||||
if not func(binary):
|
||||
failed.append(name)
|
||||
if failed:
|
||||
print(f'{filename}: failed {" ".join(failed)}')
|
||||
retval = 1
|
||||
sys.exit(retval)
|
||||
|
||||
|
|
|
@ -299,22 +299,14 @@ lief.EXE_FORMATS.PE: [
|
|||
if __name__ == '__main__':
|
||||
retval: int = 0
|
||||
for filename in sys.argv[1:]:
|
||||
try:
|
||||
binary = lief.parse(filename)
|
||||
etype = binary.format
|
||||
if etype == lief.EXE_FORMATS.UNKNOWN:
|
||||
print(f'{filename}: unknown executable format')
|
||||
retval = 1
|
||||
continue
|
||||
binary = lief.parse(filename)
|
||||
etype = binary.format
|
||||
|
||||
failed: list[str] = []
|
||||
for (name, func) in CHECKS[etype]:
|
||||
if not func(binary):
|
||||
failed.append(name)
|
||||
if failed:
|
||||
print(f'{filename}: failed {" ".join(failed)}')
|
||||
retval = 1
|
||||
except IOError:
|
||||
print(f'{filename}: cannot open')
|
||||
failed: list[str] = []
|
||||
for (name, func) in CHECKS[etype]:
|
||||
if not func(binary):
|
||||
failed.append(name)
|
||||
if failed:
|
||||
print(f'{filename}: failed {" ".join(failed)}')
|
||||
retval = 1
|
||||
sys.exit(retval)
|
||||
|
|
Loading…
Add table
Reference in a new issue