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

Side by Side Diff: scripts/slave/zip_build.py

Issue 11379003: Add Windows ASAN bots. (Closed) Base URL: http://git.chromium.org/chromium/tools/build.git@neuter
Patch Set: Rebase, tweaks, lint Created 8 years 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """ Creates a zip file in the staging dir with the result of a compile. 6 """ Creates a zip file in the staging dir with the result of a compile.
7 It can be sent to other machines for testing. 7 It can be sent to other machines for testing.
8 """ 8 """
9 9
10 import csv 10 import csv
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 tmp_revision_file.close() 187 tmp_revision_file.close()
188 chromium_utils.MakeWorldReadable(tmp_revision_file.name) 188 chromium_utils.MakeWorldReadable(tmp_revision_file.name)
189 dest_path = os.path.join(dirname, 189 dest_path = os.path.join(dirname,
190 chromium_utils.FULL_BUILD_REVISION_FILENAME) 190 chromium_utils.FULL_BUILD_REVISION_FILENAME)
191 shutil.move(tmp_revision_file.name, dest_path) 191 shutil.move(tmp_revision_file.name, dest_path)
192 except IOError: 192 except IOError:
193 print 'Writing to revision file in %s failed.' % dirname 193 print 'Writing to revision file in %s failed.' % dirname
194 194
195 195
196 def MakeUnversionedArchive(build_dir, staging_dir, zip_file_list, 196 def MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
197 zip_file_name): 197 zip_file_name, filters):
198 """Creates an unversioned full build archive. 198 """Creates an unversioned full build archive.
199 Returns the path of the created archive.""" 199 Returns the path of the created archive."""
200 replacements = []
201 if 'asan' in filters:
202 def ASANFilter(path):
203 parts = path.split('.', 1)
204 if len(parts) == 1:
205 return path
206 if parts[-1].startswith('asan'): # skip 'foo.asan.exe' entirely
207 return None
208 parts.insert(1, 'asan')
209 asan_path = '.'.join(parts)
210 if os.path.exists(asan_path):
211 return asan_path
212 return path
213 replacements.append(ASANFilter)
214
200 (zip_dir, zip_file) = chromium_utils.MakeZip(staging_dir, 215 (zip_dir, zip_file) = chromium_utils.MakeZip(staging_dir,
201 zip_file_name, 216 zip_file_name,
202 zip_file_list, 217 zip_file_list,
203 build_dir, 218 build_dir,
204 raise_error=True) 219 raise_error=True,
220 replacements=replacements)
205 chromium_utils.RemoveDirectory(zip_dir) 221 chromium_utils.RemoveDirectory(zip_dir)
206 if not os.path.exists(zip_file): 222 if not os.path.exists(zip_file):
207 raise StagingError('Failed to make zip package %s' % zip_file) 223 raise StagingError('Failed to make zip package %s' % zip_file)
208 chromium_utils.MakeWorldReadable(zip_file) 224 chromium_utils.MakeWorldReadable(zip_file)
209 225
210 # Report the size of the zip file to help catch when it gets too big and 226 # Report the size of the zip file to help catch when it gets too big and
211 # can cause bot failures from timeouts during downloads to testers. 227 # can cause bot failures from timeouts during downloads to testers.
212 zip_size = os.stat(zip_file)[stat.ST_SIZE] 228 zip_size = os.stat(zip_file)[stat.ST_SIZE]
213 print 'Zip file is %ld bytes' % zip_size 229 print 'Zip file is %ld bytes' % zip_size
214 230
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 328
313 # Build the list of files to archive. 329 # Build the list of files to archive.
314 root_files = os.listdir(build_dir) 330 root_files = os.listdir(build_dir)
315 path_filter = PathMatcher(options) 331 path_filter = PathMatcher(options)
316 print path_filter 332 print path_filter
317 print ('\nActually excluded: %s' % 333 print ('\nActually excluded: %s' %
318 [f for f in root_files if not path_filter.Match(f)]) 334 [f for f in root_files if not path_filter.Match(f)])
319 335
320 zip_file_list = [f for f in root_files if path_filter.Match(f)] 336 zip_file_list = [f for f in root_files if path_filter.Match(f)]
321 zip_file = MakeUnversionedArchive(build_dir, staging_dir, zip_file_list, 337 zip_file = MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
322 unversioned_base_name) 338 unversioned_base_name, options.filters)
323 339
324 zip_base, zip_ext = MakeVersionedArchive(zip_file, version_suffix, options) 340 zip_base, zip_ext = MakeVersionedArchive(zip_file, version_suffix, options)
325 PruneOldArchives(staging_dir, zip_base, zip_ext) 341 PruneOldArchives(staging_dir, zip_base, zip_ext)
326 342
327 # Update the latest revision file in the staging directory 343 # Update the latest revision file in the staging directory
328 # to allow testers to figure out the latest packaged revision 344 # to allow testers to figure out the latest packaged revision
329 # without downloading tarballs. 345 # without downloading tarballs.
330 WriteRevisionFile(staging_dir, build_revision) 346 WriteRevisionFile(staging_dir, build_revision)
331 347
332 return 0 348 return 0
333 349
334 350
335 def main(argv): 351 def main(argv):
336 option_parser = optparse.OptionParser() 352 option_parser = optparse.OptionParser()
337 option_parser.add_option('--target', 353 option_parser.add_option('--target',
338 help='build target to archive (Debug or Release)') 354 help='build target to archive (Debug or Release)')
339 option_parser.add_option('--src-dir', default='src', 355 option_parser.add_option('--src-dir', default='src',
340 help='path to the top-level sources directory') 356 help='path to the top-level sources directory')
341 option_parser.add_option('--build-dir', default='chrome', 357 option_parser.add_option('--build-dir', default='chrome',
342 help=('path to main build directory (the parent of ' 358 help=('path to main build directory (the parent of '
343 'the Release or Debug directory)')) 359 'the Release or Debug directory)'))
344 option_parser.add_option('--exclude-files', default='', 360 option_parser.add_option('--exclude-files', default='',
345 help=('Comma separated list of files that should ' 361 help=('Comma separated list of files that should '
346 'always be excluded from the zip.')) 362 'always be excluded from the zip.'))
347 option_parser.add_option('--include-files', default='', 363 option_parser.add_option('--include-files', default='',
348 help=('Comma separated list of files that should ' 364 help=('Comma separated list of files that should '
349 'always be included in the zip.')) 365 'always be included in the zip.'))
350 option_parser.add_option('--webkit-dir', 366 option_parser.add_option('--webkit-dir',
351 help='webkit directory path, relative to --src-dir') 367 help='webkit directory path, relative to --src-dir')
368 option_parser.add_option('--filters', action='append', default=[],
369 help='Filters to apply to build zip '
370 '(avail: "asan").')
352 chromium_utils.AddPropertiesOptions(option_parser) 371 chromium_utils.AddPropertiesOptions(option_parser)
353 372
354 options, args = option_parser.parse_args(argv) 373 options, args = option_parser.parse_args(argv)
355 374
356 if not options.target: 375 if not options.target:
357 options.target = options.factory_properties.get('target', 'Release') 376 options.target = options.factory_properties.get('target', 'Release')
358 if not options.webkit_dir: 377 if not options.webkit_dir:
359 options.webkit_dir = options.factory_properties.get('webkit_dir') 378 options.webkit_dir = options.factory_properties.get('webkit_dir')
360 379
361 # When option_parser is passed argv as a list, it can return the caller as 380 # When option_parser is passed argv as a list, it can return the caller as
362 # first unknown arg. So throw a warning if we have two or more unknown 381 # first unknown arg. So throw a warning if we have two or more unknown
363 # arguments. 382 # arguments.
364 if args[1:]: 383 if args[1:]:
365 print 'Warning -- unknown arguments' % args[1:] 384 print 'Warning -- unknown arguments' % args[1:]
366 385
386 if options.factory_properties.get('asan'):
387 options.filters.append('asan')
388 options.filters = set(options.filters)
389
367 return Archive(options) 390 return Archive(options)
368 391
369 if '__main__' == __name__: 392 if '__main__' == __name__:
370 sys.exit(main(sys.argv)) 393 sys.exit(main(sys.argv))
OLDNEW
« scripts/slave/chromium/win_apply_asan.py ('K') | « scripts/slave/chromium/win_apply_asan.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698