| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 """Remove the build metadata embedded in the artifacts of a build.""" | 5 """Remove the build metadata embedded in the artifacts of a build.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import subprocess | 10 import subprocess |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 | 13 |
| 14 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 14 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 15 | 15 |
| 16 | 16 |
| 17 def RunZapTimestamp(src_dir, filename): | 17 def RunZapTimestamp(src_dir, filename): |
| 18 syzygy_dir = os.path.join( | 18 syzygy_dir = os.path.join( |
| 19 src_dir, 'third_party', 'syzygy', 'binaries', 'exe') | 19 src_dir, 'third_party', 'syzygy', 'binaries', 'exe') |
| 20 zap_timestamp_exe = os.path.join(syzygy_dir, 'zap_timestamp.exe') | 20 zap_timestamp_exe = os.path.join(syzygy_dir, 'zap_timestamp.exe') |
| 21 return subprocess.call([zap_timestamp_exe, filename]) | 21 return subprocess.call([zap_timestamp_exe, |
| 22 '--input-image=%s' % filename, |
| 23 '--overwrite']) |
| 22 | 24 |
| 23 | 25 |
| 24 def RemovePEMetadata(build_dir, src_dir): | 26 def RemovePEMetadata(build_dir, src_dir): |
| 25 """Remove the build metadata from a PE file.""" | 27 """Remove the build metadata from a PE file.""" |
| 26 files = (i for i in os.listdir(build_dir) if i.endswith(('.dll', '.exe'))) | 28 files = (i for i in os.listdir(build_dir) if i.endswith(('.dll', '.exe'))) |
| 27 | 29 |
| 28 with open(os.path.join(BASE_DIR, 'deterministic_build_blacklist.json')) as f: | 30 with open(os.path.join(BASE_DIR, 'deterministic_build_blacklist.json')) as f: |
| 29 blacklist = frozenset(json.load(f)) | 31 blacklist = frozenset(json.load(f)) |
| 30 | 32 |
| 31 failed = [] | 33 failed = [] |
| (...skipping 29 matching lines...) Expand all Loading... |
| 61 if not options.src_dir: | 63 if not options.src_dir: |
| 62 parser.error('--src-dir is required') | 64 parser.error('--src-dir is required') |
| 63 | 65 |
| 64 # There's nothing to do for the non-Windows platform yet. | 66 # There's nothing to do for the non-Windows platform yet. |
| 65 if sys.platform == 'win32': | 67 if sys.platform == 'win32': |
| 66 return RemovePEMetadata(options.build_dir, options.src_dir) | 68 return RemovePEMetadata(options.build_dir, options.src_dir) |
| 67 | 69 |
| 68 | 70 |
| 69 if __name__ == '__main__': | 71 if __name__ == '__main__': |
| 70 sys.exit(main()) | 72 sys.exit(main()) |
| OLD | NEW |