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

Side by Side Diff: native_client_sdk/src/build_tools/update_nacl_manifest.py

Issue 11421138: [NaCl SDK] update_nacl_manifest: Allow manual updating of a version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 | Annotate | Revision Log
« no previous file with comments | « native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py ('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 """Script that reads omahaproxy and gsutil to determine version of SDK to put 6 """Script that reads omahaproxy and gsutil to determine version of SDK to put
7 in manifest. 7 in manifest.
8 """ 8 """
9 9
10 # pylint is convinced the email module is missing attributes 10 # pylint is convinced the email module is missing attributes
11 # pylint: disable=E1101 11 # pylint: disable=E1101
12 12
13 import buildbot_common 13 import buildbot_common
14 import csv 14 import csv
15 import cStringIO 15 import cStringIO
16 import difflib
16 import email 17 import email
17 import json 18 import json
18 import manifest_util 19 import manifest_util
19 import optparse 20 import optparse
20 import os 21 import os
21 import posixpath 22 import posixpath
22 import re 23 import re
23 import smtplib 24 import smtplib
24 import subprocess 25 import subprocess
25 import sys 26 import sys
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 "19.0.1084.41". The channel is always 'canary'. |archives| is a list of 302 "19.0.1084.41". The channel is always 'canary'. |archives| is a list of
302 archive URLs.""" 303 archive URLs."""
303 # We don't ship canary on Linux, so it won't appear in self.history. 304 # We don't ship canary on Linux, so it won't appear in self.history.
304 # Instead, we can use the matching Linux trunk build for that version. 305 # Instead, we can use the matching Linux trunk build for that version.
305 shared_version_generator = self._FindNextSharedVersion( 306 shared_version_generator = self._FindNextSharedVersion(
306 set(platforms) - set(('linux',)), 307 set(platforms) - set(('linux',)),
307 self._GetPlatformCanaryHistory) 308 self._GetPlatformCanaryHistory)
308 return self._DoGetMostRecentSharedVersion(platforms, 309 return self._DoGetMostRecentSharedVersion(platforms,
309 shared_version_generator, allow_trunk_revisions=True) 310 shared_version_generator, allow_trunk_revisions=True)
310 311
312 def GetAvailablePlatformArchivesFor(self, version, platforms,
313 allow_trunk_revisions):
314 """Returns a sequence of archives that exist for a given version, on the
315 given platforms.
316
317 The second element of the returned tuple is a list of all platforms that do
318 not have an archive for the given version.
319
320 Args:
321 version: The version to find archives for. (e.g. "18.0.1025.164")
322 platforms: A sequence of platforms to consider, e.g.
323 ('mac', 'linux', 'win')
324 allow_trunk_revisions: If True, will search for archives using the
325 trunk revision that matches the branch version.
326 Returns:
327 A tuple (archives, missing_platforms). |archives| is a list of archive
328 URLs, |missing_platforms| is a list of platform names.
329 """
330 archives = self._GetAvailableArchivesFor(version)
331 missing_platforms = set(platforms) - set(GetPlatformsFromArchives(archives))
332 if allow_trunk_revisions and missing_platforms:
333 # Try to find trunk archives for platforms that are missing archives.
334 trunk_version = self.delegate.GetTrunkRevision(version)
335 trunk_archives = self._GetAvailableArchivesFor(trunk_version)
336 for trunk_archive in trunk_archives:
337 trunk_archive_platform = GetPlatformFromArchiveUrl(trunk_archive)
338 if trunk_archive_platform in missing_platforms:
339 archives.append(trunk_archive)
340 missing_platforms.discard(trunk_archive_platform)
341
342 return archives, missing_platforms
343
311 def _DoGetMostRecentSharedVersion(self, platforms, shared_version_generator, 344 def _DoGetMostRecentSharedVersion(self, platforms, shared_version_generator,
312 allow_trunk_revisions): 345 allow_trunk_revisions):
313 """Returns the most recent version of a pepper bundle that exists on all 346 """Returns the most recent version of a pepper bundle that exists on all
314 given platforms. 347 given platforms.
315 348
316 This function does the real work for the public GetMostRecentShared* above. 349 This function does the real work for the public GetMostRecentShared* above.
317 350
318 Args: 351 Args:
319 platforms: A sequence of platforms to consider, e.g. 352 platforms: A sequence of platforms to consider, e.g.
320 ('mac', 'linux', 'win') 353 ('mac', 'linux', 'win')
321 shared_version_generator: A generator that will yield (version, channel) 354 shared_version_generator: A generator that will yield (version, channel)
322 tuples in order of most recent to least recent. 355 tuples in order of most recent to least recent.
323 allow_trunk_revisions: If True, will search for archives using the 356 allow_trunk_revisions: If True, will search for archives using the
324 trunk revision that matches the branch version. 357 trunk revision that matches the branch version.
325 Returns: 358 Returns:
326 A tuple (version, channel, archives). The version is a string such as 359 A tuple (version, channel, archives). The version is a string such as
327 "19.0.1084.41". The channel is one of ('stable', 'beta', 'dev', 360 "19.0.1084.41". The channel is one of ('stable', 'beta', 'dev',
328 'canary'). |archives| is a list of archive URLs.""" 361 'canary'). |archives| is a list of archive URLs."""
329 version = None 362 version = None
330 skipped_versions = [] 363 skipped_versions = []
331 channel = '' 364 channel = ''
332 while True: 365 while True:
333 try: 366 try:
334 version, channel = shared_version_generator.next() 367 version, channel = shared_version_generator.next()
335 except StopIteration: 368 except StopIteration:
336 msg = 'No shared version for platforms: %s\n' % (', '.join(platforms)) 369 msg = 'No shared version for platforms: %s\n' % (', '.join(platforms))
337 msg += 'Last version checked = %s.\n' % (version,) 370 msg += 'Last version checked = %s.\n' % (version,)
338 if skipped_versions: 371 if skipped_versions:
339 msg += 'Versions skipped due to missing archives:\n' 372 msg += 'Versions skipped due to missing archives:\n'
340 for version, channel, archives in skipped_versions: 373 for version, channel, archives in skipped_versions:
341 if archives: 374 if archives:
342 archive_msg = '(%s available)' % (', '.join(archives)) 375 archive_msg = '(%s available)' % (', '.join(archives))
343 else: 376 else:
344 archive_msg = '(none available)' 377 archive_msg = '(none available)'
345 msg += ' %s (%s) %s\n' % (version, channel, archive_msg) 378 msg += ' %s (%s) %s\n' % (version, channel, archive_msg)
346 raise Exception(msg) 379 raise Exception(msg)
347 380
348 archives = self._GetAvailableNaClSDKArchivesFor(version) 381 archives, missing_platforms = self.GetAvailablePlatformArchivesFor(
349 missing_platforms = set(platforms) - \ 382 version, platforms, allow_trunk_revisions)
350 set(GetPlatformsFromArchives(archives))
351 if allow_trunk_revisions and missing_platforms:
352 # Try to find trunk archives for platforms that are missing archives.
353 trunk_version = self.delegate.GetTrunkRevision(version)
354 trunk_archives = self._GetAvailableNaClSDKArchivesFor(trunk_version)
355 for trunk_archive in trunk_archives:
356 trunk_archive_platform = GetPlatformFromArchiveUrl(trunk_archive)
357 if trunk_archive_platform in missing_platforms:
358 archives.append(trunk_archive)
359 missing_platforms.discard(trunk_archive_platform)
360 383
361 if not missing_platforms: 384 if not missing_platforms:
362 return version, channel, archives 385 return version, channel, archives
363 386
364 skipped_versions.append((version, channel, archives)) 387 skipped_versions.append((version, channel, archives))
365 388
366 def _GetPlatformMajorVersionHistory(self, with_major_version, with_platform): 389 def _GetPlatformMajorVersionHistory(self, with_major_version, with_platform):
367 """Yields Chrome history for a given platform and major version. 390 """Yields Chrome history for a given platform and major version.
368 391
369 Args: 392 Args:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 454
432 if all(v == shared_version for c, v in platform_versions): 455 if all(v == shared_version for c, v in platform_versions):
433 # grab the channel from an arbitrary platform 456 # grab the channel from an arbitrary platform
434 first_platform = platform_versions[0] 457 first_platform = platform_versions[0]
435 channel = first_platform[0] 458 channel = first_platform[0]
436 yield JoinVersion(shared_version), channel 459 yield JoinVersion(shared_version), channel
437 460
438 # force increment to next version for all platforms 461 # force increment to next version for all platforms
439 shared_version = None 462 shared_version = None
440 463
441 def _GetAvailableNaClSDKArchivesFor(self, version_string): 464 def _GetAvailableArchivesFor(self, version_string):
442 """Downloads a list of all available archives for a given version. 465 """Downloads a list of all available archives for a given version.
443 466
444 Args: 467 Args:
445 version_string: The version to find archives for. (e.g. "18.0.1025.164") 468 version_string: The version to find archives for. (e.g. "18.0.1025.164")
446 Returns: 469 Returns:
447 A list of strings, each of which is a platform-specific archive URL. (e.g. 470 A list of strings, each of which is a platform-specific archive URL. (e.g.
448 "gs://nativeclient_mirror/nacl/nacl_sdk/18.0.1025.164/" 471 "gs://nativeclient_mirror/nacl/nacl_sdk/18.0.1025.164/"
449 "naclsdk_linux.tar.bz2"). 472 "naclsdk_linux.tar.bz2").
450 473
451 All returned URLs will use the gs:// schema.""" 474 All returned URLs will use the gs:// schema."""
452 files = self.delegate.GsUtil_ls(GS_BUCKET_PATH + version_string) 475 files = self.delegate.GsUtil_ls(GS_BUCKET_PATH + version_string)
453 476
454 assert all(file.startswith('gs://') for file in files) 477 assert all(file.startswith('gs://') for file in files)
455 478
456 archives = [f for f in files if not f.endswith('.json')] 479 archives = [f for f in files if not f.endswith('.json')]
457 manifests = [f for f in files if f.endswith('.json')] 480 manifests = [f for f in files if f.endswith('.json')]
458 481
459 # don't include any archives that don't have an associated manifest. 482 # don't include any archives that don't have an associated manifest.
460 return filter(lambda a: a + '.json' in manifests, archives) 483 return filter(lambda a: a + '.json' in manifests, archives)
461 484
462 485
463 class Updater(object): 486 class Updater(object):
464 def __init__(self, delegate): 487 def __init__(self, delegate):
465 self.delegate = delegate 488 self.delegate = delegate
466 self.versions_to_update = [] 489 self.versions_to_update = []
490 self.online_manifest = manifest_util.SDKManifest()
491 self._FetchOnlineManifest()
467 492
468 def AddVersionToUpdate(self, bundle_name, version, channel, archives): 493 def AddVersionToUpdate(self, bundle_name, version, channel, archives):
469 """Add a pepper version to update in the uploaded manifest. 494 """Add a pepper version to update in the uploaded manifest.
470 495
471 Args: 496 Args:
472 bundle_name: The name of the pepper bundle, e.g. 'pepper_18' 497 bundle_name: The name of the pepper bundle, e.g. 'pepper_18'
473 version: The version of the pepper bundle, e.g. '18.0.1025.64' 498 version: The version of the pepper bundle, e.g. '18.0.1025.64'
474 channel: The stability of the pepper bundle, e.g. 'beta' 499 channel: The stability of the pepper bundle, e.g. 'beta'
475 archives: A sequence of archive URLs for this bundle.""" 500 archives: A sequence of archive URLs for this bundle."""
476 self.versions_to_update.append((bundle_name, version, channel, archives)) 501 self.versions_to_update.append((bundle_name, version, channel, archives))
477 502
478 def Update(self, manifest): 503 def Update(self, manifest):
479 """Update a manifest and upload it. 504 """Update a manifest and upload it.
480 505
506 Note that bundles will not be updated if the current version is newer.
507 That is, the updater will never automatically update to an older version of
508 a bundle.
509
481 Args: 510 Args:
482 manifest: The manifest used as a template for updating. Only pepper 511 manifest: The manifest used as a template for updating. Only pepper
483 bundles that contain no archives will be considered for auto-updating.""" 512 bundles that contain no archives will be considered for auto-updating."""
484 # Make sure there is only one stable branch: the one with the max version. 513 # Make sure there is only one stable branch: the one with the max version.
485 # All others are post-stable. 514 # All others are post-stable.
486 stable_major_versions = [SplitVersion(version)[0] for _, version, channel, _ 515 stable_major_versions = [SplitVersion(version)[0] for _, version, channel, _
487 in self.versions_to_update if channel == 'stable'] 516 in self.versions_to_update if channel == 'stable']
488 # Add 0 in case there are no stable versions. 517 # Add 0 in case there are no stable versions.
489 max_stable_version = max([0] + stable_major_versions) 518 max_stable_version = max([0] + stable_major_versions)
490 519
491 for bundle_name, version, channel, archives in self.versions_to_update: 520 for bundle_name, version, channel, archives in self.versions_to_update:
492 self.delegate.Print('Updating %s to %s...' % (bundle_name, version)) 521 self.delegate.Print('Updating %s to %s...' % (bundle_name, version))
493 bundle = manifest.GetBundle(bundle_name) 522 bundle = manifest.GetBundle(bundle_name)
494 for archive in archives: 523 for archive in archives:
495 platform_bundle = self._GetPlatformArchiveBundle(archive) 524 platform_bundle = self._GetPlatformArchiveBundle(archive)
496 # Normally the manifest snippet's bundle name matches our bundle name. 525 # Normally the manifest snippet's bundle name matches our bundle name.
497 # pepper_canary, however is called "pepper_###" in the manifest 526 # pepper_canary, however is called "pepper_###" in the manifest
498 # snippet. 527 # snippet.
499 platform_bundle.name = bundle_name 528 platform_bundle.name = bundle_name
500 bundle.MergeWithBundle(platform_bundle) 529 bundle.MergeWithBundle(platform_bundle)
501 530
531 # Check to ensure this bundle is newer than the online bundle.
532 online_bundle = self.online_manifest.GetBundle(bundle_name)
533 if online_bundle and online_bundle.revision >= bundle.revision:
534 self.delegate.Print(
535 ' Revision %s is not newer than than online revision %s. '
536 'Skipping.' % (bundle.revision, online_bundle.revision))
537
538 manifest.MergeBundle(online_bundle)
539 continue
540
502 major_version = SplitVersion(version)[0] 541 major_version = SplitVersion(version)[0]
503 if major_version < max_stable_version and channel == 'stable': 542 if major_version < max_stable_version and channel == 'stable':
504 bundle.stability = 'post_stable' 543 bundle.stability = 'post_stable'
505 else: 544 else:
506 bundle.stability = channel 545 bundle.stability = channel
507 # We always recommend the stable version. 546 # We always recommend the stable version.
508 if channel == 'stable': 547 if channel == 'stable':
509 bundle.recommended = 'yes' 548 bundle.recommended = 'yes'
510 else: 549 else:
511 bundle.recommended = 'no' 550 bundle.recommended = 'no'
(...skipping 22 matching lines...) Expand all
534 573
535 def _UploadManifest(self, manifest): 574 def _UploadManifest(self, manifest):
536 """Upload a serialized manifest_util.SDKManifest object. 575 """Upload a serialized manifest_util.SDKManifest object.
537 576
538 Upload one copy to gs://<BUCKET_PATH>/naclsdk_manifest2.json, and a copy to 577 Upload one copy to gs://<BUCKET_PATH>/naclsdk_manifest2.json, and a copy to
539 gs://<BUCKET_PATH>/manifest_backups/naclsdk_manifest2.<TIMESTAMP>.json. 578 gs://<BUCKET_PATH>/manifest_backups/naclsdk_manifest2.<TIMESTAMP>.json.
540 579
541 Args: 580 Args:
542 manifest: The new manifest to upload. 581 manifest: The new manifest to upload.
543 """ 582 """
583 new_manifest_string = manifest.GetDataAsString()
584 online_manifest_string = self.online_manifest.GetDataAsString()
585
544 if self.delegate.dryrun: 586 if self.delegate.dryrun:
545 name = MANIFEST_BASENAME + ".new" 587 self.delegate.Print(''.join(list(difflib.unified_diff(
546 self.delegate.Print("Writing new manifest: %s" % name) 588 online_manifest_string.splitlines(1),
547 with open(name, 'w') as f: 589 new_manifest_string.splitlines(1)))))
548 f.write(manifest.GetDataAsString()) 590 else:
549 stdout = self.delegate.GsUtil_cat(GS_SDK_MANIFEST) 591 online_manifest = manifest_util.SDKManifest()
592 online_manifest.LoadDataFromString(online_manifest_string)
550 593
551 online = MANIFEST_BASENAME + ".online" 594 if online_manifest == manifest:
552 self.delegate.Print("Writing online manifest: %s" % online) 595 self.delegate.Print('New manifest doesn\'t differ from online manifest.'
553 with open(online, 'w') as f: 596 'Skipping upload.')
554 f.write(stdout) 597 return
555 os.system('diff -u %s %s' % (online, name))
556 598
557 timestamp_manifest_path = GS_MANIFEST_BACKUP_DIR + \ 599 timestamp_manifest_path = GS_MANIFEST_BACKUP_DIR + \
558 GetTimestampManifestName() 600 GetTimestampManifestName()
559 self.delegate.GsUtil_cp('-', timestamp_manifest_path, 601 self.delegate.GsUtil_cp('-', timestamp_manifest_path,
560 stdin=manifest.GetDataAsString()) 602 stdin=manifest.GetDataAsString())
561 603
562 # copy from timestampped copy over the official manifest. 604 # copy from timestampped copy over the official manifest.
563 self.delegate.GsUtil_cp(timestamp_manifest_path, GS_SDK_MANIFEST) 605 self.delegate.GsUtil_cp(timestamp_manifest_path, GS_SDK_MANIFEST)
564 606
607 def _FetchOnlineManifest(self):
608 try:
609 online_manifest_string = self.delegate.GsUtil_cat(GS_SDK_MANIFEST)
610 except subprocess.CalledProcessError:
611 # It is not a failure if the online manifest doesn't exist.
612 online_manifest_string = ''
565 613
566 def Run(delegate, platforms): 614 if online_manifest_string:
567 """Entry point for the auto-updater.""" 615 self.online_manifest.LoadDataFromString(online_manifest_string)
616
617
618 def Run(delegate, platforms, fixed_bundle_versions=None):
619 """Entry point for the auto-updater.
620
621 Args:
622 delegate: The Delegate object to use for reading Urls, files, etc.
623 platforms: A sequence of platforms to consider, e.g.
624 ('mac', 'linux', 'win')
625 fixed_bundle_versions: A sequence of tuples (bundle_name, version_string).
626 e.g. ('pepper_21', '21.0.1145.0')
627 """
628 if fixed_bundle_versions:
629 fixed_bundle_versions = dict(fixed_bundle_versions)
630 else:
631 fixed_bundle_versions = {}
632
568 manifest = delegate.GetRepoManifest() 633 manifest = delegate.GetRepoManifest()
569 auto_update_bundles = [] 634 auto_update_bundles = []
570 for bundle in manifest.GetBundles(): 635 for bundle in manifest.GetBundles():
571 if not bundle.name.startswith('pepper_'): 636 if not bundle.name.startswith('pepper_'):
572 continue 637 continue
573 archives = bundle.GetArchives() 638 archives = bundle.GetArchives()
574 if not archives: 639 if not archives:
575 auto_update_bundles.append(bundle) 640 auto_update_bundles.append(bundle)
576 641
577 if not auto_update_bundles: 642 if not auto_update_bundles:
578 delegate.Print('No versions need auto-updating.') 643 delegate.Print('No versions need auto-updating.')
579 return 644 return
580 645
581 version_finder = VersionFinder(delegate) 646 version_finder = VersionFinder(delegate)
582 updater = Updater(delegate) 647 updater = Updater(delegate)
583 648
584 for bundle in auto_update_bundles: 649 for bundle in auto_update_bundles:
585 if bundle.name == CANARY_BUNDLE_NAME: 650 if bundle.name == CANARY_BUNDLE_NAME:
586 version, channel, archives = version_finder.GetMostRecentSharedCanary( 651 version, channel, archives = version_finder.GetMostRecentSharedCanary(
587 platforms) 652 platforms)
588 else: 653 else:
589 version, channel, archives = version_finder.GetMostRecentSharedVersion( 654 version, channel, archives = version_finder.GetMostRecentSharedVersion(
590 bundle.version, platforms) 655 bundle.version, platforms)
591 656
657 if bundle.name in fixed_bundle_versions:
658 # Ensure this version is valid for all platforms.
659 # If it is, use the channel found above (because the channel for this
660 # version may not be in the history.)
661 version = fixed_bundle_versions[bundle.name]
662 delegate.Print('Fixed bundle version: %s, %s' % (bundle.name, version))
663 allow_trunk_revisions = bundle.name == CANARY_BUNDLE_NAME
664 archives, missing = version_finder.GetAvailablePlatformArchivesFor(
665 version, platforms, allow_trunk_revisions)
666 if missing:
667 delegate.Print(
668 'An archive for version %s of bundle %s doesn\'t exist '
669 'for platform(s): %s' % (version, bundle.name, ', '.join(missing)))
670 return
671
592 updater.AddVersionToUpdate(bundle.name, version, channel, archives) 672 updater.AddVersionToUpdate(bundle.name, version, channel, archives)
593 673
594 updater.Update(manifest) 674 updater.Update(manifest)
595 675
596 676
597 def SendMail(send_from, send_to, subject, text, smtp='localhost'): 677 def SendMail(send_from, send_to, subject, text, smtp='localhost'):
598 """Send an email. 678 """Send an email.
599 679
600 Args: 680 Args:
601 send_from: The sender's email address. 681 send_from: The sender's email address.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 parser = optparse.OptionParser() 715 parser = optparse.OptionParser()
636 parser.add_option('--gsutil', help='path to gsutil.') 716 parser.add_option('--gsutil', help='path to gsutil.')
637 parser.add_option('-d', '--debug', help='run in debug mode.', 717 parser.add_option('-d', '--debug', help='run in debug mode.',
638 action='store_true') 718 action='store_true')
639 parser.add_option('--mailfrom', help='email address of sender.') 719 parser.add_option('--mailfrom', help='email address of sender.')
640 parser.add_option('--mailto', help='send error mails to...', action='append') 720 parser.add_option('--mailto', help='send error mails to...', action='append')
641 parser.add_option('-n', '--dryrun', help="don't upload the manifest.", 721 parser.add_option('-n', '--dryrun', help="don't upload the manifest.",
642 action='store_true') 722 action='store_true')
643 parser.add_option('-v', '--verbose', help='print more diagnotic messages.', 723 parser.add_option('-v', '--verbose', help='print more diagnotic messages.',
644 action='store_true') 724 action='store_true')
725 parser.add_option('--bundle-version',
726 help='Manually set a bundle version. This can be passed more than once. '
727 'format: --bundle-version pepper_24=24.0.1312.25', action='append')
645 options, args = parser.parse_args(args[1:]) 728 options, args = parser.parse_args(args[1:])
646 729
647 if (options.mailfrom is None) != (not options.mailto): 730 if (options.mailfrom is None) != (not options.mailto):
648 options.mailfrom = None 731 options.mailfrom = None
649 options.mailto = None 732 options.mailto = None
650 sys.stderr.write('warning: Disabling email, one of --mailto or --mailfrom ' 733 sys.stderr.write('warning: Disabling email, one of --mailto or --mailfrom '
651 'was missing.\n') 734 'was missing.\n')
652 735
736 # Parse bundle versions.
737 fixed_bundle_versions = {}
738 if options.bundle_version:
739 for bundle_version_string in options.bundle_version:
740 bundle_name, version = bundle_version_string.split('=')
741 fixed_bundle_versions[bundle_name] = version
742
653 if options.mailfrom and options.mailto: 743 if options.mailfrom and options.mailto:
654 # Capture stderr so it can be emailed, if necessary. 744 # Capture stderr so it can be emailed, if necessary.
655 sys.stderr = CapturedFile(sys.stderr) 745 sys.stderr = CapturedFile(sys.stderr)
656 746
657 try: 747 try:
658 try: 748 try:
659 delegate = RealDelegate(options.dryrun, options.gsutil, options.verbose) 749 delegate = RealDelegate(options.dryrun, options.gsutil, options.verbose)
660 Run(delegate, ('mac', 'win', 'linux')) 750 Run(delegate, ('mac', 'win', 'linux'), fixed_bundle_versions)
661 except Exception: 751 except Exception:
662 if options.mailfrom and options.mailto: 752 if options.mailfrom and options.mailto:
663 traceback.print_exc() 753 traceback.print_exc()
664 scriptname = os.path.basename(sys.argv[0]) 754 scriptname = os.path.basename(sys.argv[0])
665 subject = '[%s] Failed to update manifest' % (scriptname,) 755 subject = '[%s] Failed to update manifest' % (scriptname,)
666 text = '%s failed.\n\nSTDERR:\n%s\n' % (scriptname, 756 text = '%s failed.\n\nSTDERR:\n%s\n' % (scriptname,
667 sys.stderr.getvalue()) 757 sys.stderr.getvalue())
668 SendMail(options.mailfrom, options.mailto, subject, text) 758 SendMail(options.mailfrom, options.mailto, subject, text)
669 sys.exit(1) 759 sys.exit(1)
670 else: 760 else:
671 raise 761 raise
672 except manifest_util.Error as e: 762 except manifest_util.Error as e:
673 if options.debug: 763 if options.debug:
674 raise 764 raise
675 print e 765 print e
676 sys.exit(1) 766 sys.exit(1)
677 767
678 768
679 if __name__ == '__main__': 769 if __name__ == '__main__':
680 sys.exit(main(sys.argv)) 770 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698