| OLD | NEW |
| 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 |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 channel: The stability of the pepper bundle, e.g. 'beta' | 472 channel: The stability of the pepper bundle, e.g. 'beta' |
| 473 archives: A sequence of archive URLs for this bundle.""" | 473 archives: A sequence of archive URLs for this bundle.""" |
| 474 self.versions_to_update.append((bundle_name, version, channel, archives)) | 474 self.versions_to_update.append((bundle_name, version, channel, archives)) |
| 475 | 475 |
| 476 def Update(self, manifest): | 476 def Update(self, manifest): |
| 477 """Update a manifest and upload it. | 477 """Update a manifest and upload it. |
| 478 | 478 |
| 479 Args: | 479 Args: |
| 480 manifest: The manifest used as a template for updating. Only pepper | 480 manifest: The manifest used as a template for updating. Only pepper |
| 481 bundles that contain no archives will be considered for auto-updating.""" | 481 bundles that contain no archives will be considered for auto-updating.""" |
| 482 # Make sure there is only one stable branch: the one with the max version. |
| 483 # All others are post-stable. |
| 484 stable_major_versions = [SplitVersion(version)[0] for _, version, channel, _ |
| 485 in self.versions_to_update if channel == 'stable'] |
| 486 # Add 0 in case there are no stable versions. |
| 487 max_stable_version = max([0] + stable_major_versions) |
| 488 |
| 482 for bundle_name, version, channel, archives in self.versions_to_update: | 489 for bundle_name, version, channel, archives in self.versions_to_update: |
| 483 self.delegate.Print('Updating %s to %s...' % (bundle_name, version)) | 490 self.delegate.Print('Updating %s to %s...' % (bundle_name, version)) |
| 484 bundle = manifest.GetBundle(bundle_name) | 491 bundle = manifest.GetBundle(bundle_name) |
| 485 for archive in archives: | 492 for archive in archives: |
| 486 platform_bundle = self._GetPlatformArchiveBundle(archive) | 493 platform_bundle = self._GetPlatformArchiveBundle(archive) |
| 487 # Normally the manifest snippet's bundle name matches our bundle name. | 494 # Normally the manifest snippet's bundle name matches our bundle name. |
| 488 # pepper_canary, however is called "pepper_###" in the manifest | 495 # pepper_canary, however is called "pepper_###" in the manifest |
| 489 # snippet. | 496 # snippet. |
| 490 platform_bundle.name = bundle_name | 497 platform_bundle.name = bundle_name |
| 491 bundle.MergeWithBundle(platform_bundle) | 498 bundle.MergeWithBundle(platform_bundle) |
| 492 bundle.stability = channel | 499 |
| 500 major_version = SplitVersion(version)[0] |
| 501 if major_version < max_stable_version and channel == 'stable': |
| 502 bundle.stability = 'post_stable' |
| 503 else: |
| 504 bundle.stability = channel |
| 493 # We always recommend the stable version. | 505 # We always recommend the stable version. |
| 494 if channel == 'stable': | 506 if channel == 'stable': |
| 495 bundle.recommended = 'yes' | 507 bundle.recommended = 'yes' |
| 496 else: | 508 else: |
| 497 bundle.recommended = 'no' | 509 bundle.recommended = 'no' |
| 498 manifest.MergeBundle(bundle) | 510 manifest.MergeBundle(bundle) |
| 499 self._UploadManifest(manifest) | 511 self._UploadManifest(manifest) |
| 500 self.delegate.Print('Done.') | 512 self.delegate.Print('Done.') |
| 501 | 513 |
| 502 def _GetPlatformArchiveBundle(self, archive): | 514 def _GetPlatformArchiveBundle(self, archive): |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 raise | 669 raise |
| 658 except manifest_util.Error as e: | 670 except manifest_util.Error as e: |
| 659 if options.debug: | 671 if options.debug: |
| 660 raise | 672 raise |
| 661 print e | 673 print e |
| 662 sys.exit(1) | 674 sys.exit(1) |
| 663 | 675 |
| 664 | 676 |
| 665 if __name__ == '__main__': | 677 if __name__ == '__main__': |
| 666 sys.exit(main(sys.argv)) | 678 sys.exit(main(sys.argv)) |
| OLD | NEW |