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

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

Issue 2279953002: lightweight builds archiving for mac and win64 (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: fixed bug with previous land on changing perf buildbot for manual bisect Created 4 years, 3 months 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 | « scripts/slave/recipes/chromium.expected/full_chromium_perf_Win_x64_Builder.json ('k') | 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 (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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 chromium_utils.FULL_BUILD_REVISION_FILENAME) 164 chromium_utils.FULL_BUILD_REVISION_FILENAME)
165 shutil.move(tmp_revision_file.name, dest_path) 165 shutil.move(tmp_revision_file.name, dest_path)
166 return dest_path 166 return dest_path
167 except IOError: 167 except IOError:
168 print 'Writing to revision file in %s failed.' % dirname 168 print 'Writing to revision file in %s failed.' % dirname
169 169
170 def MakeUnversionedArchive(build_dir, staging_dir, zip_file_list, 170 def MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
171 zip_file_name, strip_files=None): 171 zip_file_name, strip_files=None):
172 """Creates an unversioned full build archive. 172 """Creates an unversioned full build archive.
173 Returns the path of the created archive.""" 173 Returns the path of the created archive."""
174 # Prevents having zip_file_list to contain duplicates
175 zip_file_list = list(set(zip_file_list))
174 (zip_dir, zip_file) = chromium_utils.MakeZip(staging_dir, 176 (zip_dir, zip_file) = chromium_utils.MakeZip(staging_dir,
175 zip_file_name, 177 zip_file_name,
176 zip_file_list, 178 zip_file_list,
177 build_dir, 179 build_dir,
178 raise_error=True, 180 raise_error=True,
179 strip_files=strip_files) 181 strip_files=strip_files)
180 182
181 chromium_utils.RemoveDirectory(zip_dir) 183 chromium_utils.RemoveDirectory(zip_dir)
182 if not os.path.exists(zip_file): 184 if not os.path.exists(zip_file):
183 raise StagingError('Failed to make zip package %s' % zip_file) 185 raise StagingError('Failed to make zip package %s' % zip_file)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 266
265 class PathMatcher(object): 267 class PathMatcher(object):
266 """Generates a matcher which can be used to filter file paths.""" 268 """Generates a matcher which can be used to filter file paths."""
267 269
268 def __init__(self, options): 270 def __init__(self, options):
269 def CommaStrParser(val): 271 def CommaStrParser(val):
270 return [f.strip() for f in csv.reader([val]).next()] 272 return [f.strip() for f in csv.reader([val]).next()]
271 self.inclusions = CommaStrParser(options.include_files) 273 self.inclusions = CommaStrParser(options.include_files)
272 self.exclusions = (CommaStrParser(options.exclude_files) 274 self.exclusions = (CommaStrParser(options.exclude_files)
273 + chromium_utils.FileExclusions()) 275 + chromium_utils.FileExclusions())
274
275 self.regex_whitelist = FileRegexWhitelist(options) 276 self.regex_whitelist = FileRegexWhitelist(options)
276 self.regex_blacklist = FileRegexBlacklist(options) 277 self.regex_blacklist = FileRegexBlacklist(options)
277 self.exclude_unmatched = options.exclude_unmatched 278 self.exclude_unmatched = options.exclude_unmatched
278 self.ignore_regex = options.ignore_regex 279 self.exclude_extra = options.exclude_extra
280 self.custom_whitelist = options.whitelist
279 281
280 def __str__(self): 282 def __str__(self):
281 return '\n '.join([ 283 return '\n '.join([
282 'Zip rules', 284 'Zip rules',
283 'Inclusions: %s' % self.inclusions, 285 'Inclusions: %s' % self.inclusions,
284 'Exclusions: %s' % self.exclusions, 286 'Exclusions: %s' % self.exclusions,
285 "Whitelist regex: '%s'" % self.regex_whitelist, 287 "Whitelist regex: '%s'" % self.regex_whitelist,
286 "Blacklist regex: '%s'" % self.regex_blacklist, 288 "Blacklist regex: '%s'" % self.regex_blacklist,
287 'Zip unmatched files: %s' % (not self.exclude_unmatched), 289 'Zip unmatched files: %s' % (not self.exclude_unmatched),
288 'Ignore regex matches: %s' % self.ignore_regex]) 290 'Exclude extra: %s' % self.exclude_extra,
291 "Custom Whitelist regex: '%s'" % self.custom_whitelist])
289 292
290 293
291 def Match(self, filename): 294 def Match(self, filename):
292 if filename in self.inclusions: 295 if filename in self.inclusions:
293 return True 296 return True
294 if filename in self.exclusions: 297 if filename in self.exclusions:
295 return False 298 return False
296 if self.ignore_regex: 299 if (self.custom_whitelist and
300 re.match(self.custom_whitelist, filename)):
301 return True
302 if self.exclude_extra:
297 return False 303 return False
298 if re.match(self.regex_whitelist, filename): 304 if re.match(self.regex_whitelist, filename):
299 return True 305 return True
300 if re.match(self.regex_blacklist, filename): 306 if re.match(self.regex_blacklist, filename):
301 return False 307 return False
302 return not self.exclude_unmatched 308 return not self.exclude_unmatched
303 309
304 310
305 def Archive(options): 311 def Archive(options):
306 build_dir = build_directory.GetBuildOutputDirectory( 312 build_dir = build_directory.GetBuildOutputDirectory(
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 help='build target to archive (Debug or Release)') 422 help='build target to archive (Debug or Release)')
417 option_parser.add_option('--src-dir', default='src', 423 option_parser.add_option('--src-dir', default='src',
418 help='path to the top-level sources directory') 424 help='path to the top-level sources directory')
419 option_parser.add_option('--build-dir', help='ignored') 425 option_parser.add_option('--build-dir', help='ignored')
420 option_parser.add_option('--exclude-files', default='', 426 option_parser.add_option('--exclude-files', default='',
421 help='Comma separated list of files that should ' 427 help='Comma separated list of files that should '
422 'always be excluded from the zip.') 428 'always be excluded from the zip.')
423 option_parser.add_option('--include-files', default='', 429 option_parser.add_option('--include-files', default='',
424 help='Comma separated list of files that should ' 430 help='Comma separated list of files that should '
425 'always be included in the zip.') 431 'always be included in the zip.')
426 option_parser.add_option('--ignore-regex', action='store_true', 432 option_parser.add_option('--whitelist', default='',
427 default=False, help='Ignores regex matches') 433 help='Custom regex whitelist to include files')
434 option_parser.add_option('--exclude-extra', action='store_true',
435 default=False, help='Only includes include file list'
436 'and regex whitelist match provided')
428 option_parser.add_option('--master-name', help='Name of the buildbot master.') 437 option_parser.add_option('--master-name', help='Name of the buildbot master.')
429 option_parser.add_option('--slave-name', help='Name of the buildbot slave.') 438 option_parser.add_option('--slave-name', help='Name of the buildbot slave.')
430 option_parser.add_option('--build-number', type=int, 439 option_parser.add_option('--build-number', type=int,
431 help='Buildbot build number.') 440 help='Buildbot build number.')
432 option_parser.add_option('--parent-build-number', type=int, 441 option_parser.add_option('--parent-build-number', type=int,
433 help='Buildbot parent build number.') 442 help='Buildbot parent build number.')
434 option_parser.add_option('--webkit-dir', 443 option_parser.add_option('--webkit-dir',
435 help='webkit directory path, relative to --src-dir') 444 help='webkit directory path, relative to --src-dir')
436 option_parser.add_option('--revision-dir', 445 option_parser.add_option('--revision-dir',
437 help='Directory path that shall be used to decide ' 446 help='Directory path that shall be used to decide '
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 json.dump(urls, json_file) 518 json.dump(urls, json_file)
510 else: # we need to print buildbot annotations 519 else: # we need to print buildbot annotations
511 if 'storage_url' in urls: 520 if 'storage_url' in urls:
512 print '@@@STEP_LINK@download@%s@@@' % urls['storage_url'] 521 print '@@@STEP_LINK@download@%s@@@' % urls['storage_url']
513 if 'zip_url' in urls: 522 if 'zip_url' in urls:
514 print '@@@SET_BUILD_PROPERTY@build_archive_url@"%s"@@@' % urls['zip_url'] 523 print '@@@SET_BUILD_PROPERTY@build_archive_url@"%s"@@@' % urls['zip_url']
515 return 0 524 return 0
516 525
517 if '__main__' == __name__: 526 if '__main__' == __name__:
518 sys.exit(main(sys.argv)) 527 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « scripts/slave/recipes/chromium.expected/full_chromium_perf_Win_x64_Builder.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698