Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: scripts/slave/recipe_modules/isolate/resources/compare_build_artifacts.py

Issue 683733013: Add support for the apks (non os.X_OK) to compare_build_artifacts.py (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 """Compare the artifacts from two builds.""" 6 """Compare the artifacts from two builds."""
7 7
8 import difflib 8 import difflib
9 import json 9 import json
10 import optparse 10 import optparse
11 import os 11 import os
12 import struct 12 import struct
13 import sys 13 import sys
14 import time 14 import time
15 15
16 16
17 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 17 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
18 18
19 19
20 def get_files_to_compare(build_dir, recursive=False): 20 def get_files_to_compare(build_dir, recursive=False):
21 """Get the list of files to compare.""" 21 """Get the list of files to compare."""
22 allowed = frozenset( 22 allowed = frozenset(
23 ('', '.apk', '.app', '.dll', '.dylib', '.exe', '.nexe', '.so')) 23 ('', '.apk', '.app', '.dll', '.dylib', '.exe', '.nexe', '.so'))
24 non_x_ok_exts = frozenset(('.apk', '.isolated'))
24 def check(f): 25 def check(f):
25 if not os.path.isfile(f): 26 if not os.path.isfile(f):
26 return False 27 return False
27 if os.path.basename(f).startswith('.'): 28 if os.path.basename(f).startswith('.'):
28 return False 29 return False
29 ext = os.path.splitext(f)[1] 30 ext = os.path.splitext(f)[1]
30 if ext == '.isolated': 31 if ext in non_x_ok_exts:
31 return True 32 return True
32 return ext in allowed and os.access(f, os.X_OK) 33 return ext in allowed and os.access(f, os.X_OK)
33 34
34 ret_files = set() 35 ret_files = set()
35 for root, dirs, files in os.walk(build_dir): 36 for root, dirs, files in os.walk(build_dir):
36 if not recursive: 37 if not recursive:
37 dirs[:] = [d for d in dirs if d.endswith('_apk')] 38 dirs[:] = [d for d in dirs if d.endswith('_apk')]
38 for f in (f for f in files if check(os.path.join(root, f))): 39 for f in (f for f in files if check(os.path.join(root, f))):
39 ret_files.add(os.path.relpath(os.path.join(root, f), build_dir)) 40 ret_files.add(os.path.relpath(os.path.join(root, f), build_dir))
40 return ret_files 41 return ret_files
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if not options.second_build_dir: 182 if not options.second_build_dir:
182 parser.error('--second-build-dir is required') 183 parser.error('--second-build-dir is required')
183 184
184 return compare_build_artifacts(os.path.abspath(options.first_build_dir), 185 return compare_build_artifacts(os.path.abspath(options.first_build_dir),
185 os.path.abspath(options.second_build_dir), 186 os.path.abspath(options.second_build_dir),
186 options.recursive) 187 options.recursive)
187 188
188 189
189 if __name__ == '__main__': 190 if __name__ == '__main__':
190 sys.exit(main()) 191 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698