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

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

Issue 343703004: [NaCl SDK] Add bionic SDK bundle auto-updating to update_nacl_manifest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.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
(...skipping 21 matching lines...) Expand all
32 32
33 MANIFEST_BASENAME = 'naclsdk_manifest2.json' 33 MANIFEST_BASENAME = 'naclsdk_manifest2.json'
34 SCRIPT_DIR = os.path.dirname(__file__) 34 SCRIPT_DIR = os.path.dirname(__file__)
35 REPO_MANIFEST = os.path.join(SCRIPT_DIR, 'json', MANIFEST_BASENAME) 35 REPO_MANIFEST = os.path.join(SCRIPT_DIR, 'json', MANIFEST_BASENAME)
36 GS_BUCKET_PATH = 'gs://nativeclient-mirror/nacl/nacl_sdk/' 36 GS_BUCKET_PATH = 'gs://nativeclient-mirror/nacl/nacl_sdk/'
37 GS_SDK_MANIFEST = GS_BUCKET_PATH + MANIFEST_BASENAME 37 GS_SDK_MANIFEST = GS_BUCKET_PATH + MANIFEST_BASENAME
38 GS_SDK_MANIFEST_LOG = GS_BUCKET_PATH + MANIFEST_BASENAME + '.log' 38 GS_SDK_MANIFEST_LOG = GS_BUCKET_PATH + MANIFEST_BASENAME + '.log'
39 GS_MANIFEST_BACKUP_DIR = GS_BUCKET_PATH + 'manifest_backups/' 39 GS_MANIFEST_BACKUP_DIR = GS_BUCKET_PATH + 'manifest_backups/'
40 40
41 CANARY_BUNDLE_NAME = 'pepper_canary' 41 CANARY_BUNDLE_NAME = 'pepper_canary'
42 BIONIC_CANARY_BUNDLE_NAME = 'bionic_canary'
42 CANARY = 'canary' 43 CANARY = 'canary'
43 NACLPORTS_ARCHIVE_NAME = 'naclports.tar.bz2' 44 NACLPORTS_ARCHIVE_NAME = 'naclports.tar.bz2'
44 45
45 46
46 logger = logging.getLogger(__name__) 47 logger = logging.getLogger(__name__)
47 48
48 49
49 def SplitVersion(version_string): 50 def SplitVersion(version_string):
50 """Split a version string (e.g. "18.0.1025.163") into its components. 51 """Split a version string (e.g. "18.0.1025.163") into its components.
51 52
(...skipping 26 matching lines...) Expand all
78 79
79 Args: 80 Args:
80 platform: One of ('win', 'mac', 'linux'). 81 platform: One of ('win', 'mac', 'linux').
81 82
82 Returns: 83 Returns:
83 The basename of the sdk archive for that platform. 84 The basename of the sdk archive for that platform.
84 """ 85 """
85 return 'naclsdk_%s.tar.bz2' % platform 86 return 'naclsdk_%s.tar.bz2' % platform
86 87
87 88
89 def GetBionicArchiveName():
90 """Get the basename of an archive. Currently this is linux-only"""
91 return 'naclsdk_bionic.tar.bz2'
92
93
88 def GetCanonicalArchiveName(url): 94 def GetCanonicalArchiveName(url):
89 """Get the canonical name of an archive given its URL. 95 """Get the canonical name of an archive given its URL.
90 96
91 This will convert "naclsdk_linux.bz2" -> "naclsdk_linux.tar.bz2", and also 97 This will convert "naclsdk_linux.bz2" -> "naclsdk_linux.tar.bz2", and also
92 remove everything but the filename of the URL. 98 remove everything but the filename of the URL.
93 99
94 This is used below to determine if an expected bundle is found in an version 100 This is used below to determine if an expected bundle is found in an version
95 directory; the archives all have the same name, but may not exist for a given 101 directory; the archives all have the same name, but may not exist for a given
96 version. 102 version.
97 103
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 """Finds a version of a pepper bundle that all desired platforms share. 330 """Finds a version of a pepper bundle that all desired platforms share.
325 331
326 Args: 332 Args:
327 delegate: See Delegate class above. 333 delegate: See Delegate class above.
328 platforms: A sequence of platforms to consider, e.g. 334 platforms: A sequence of platforms to consider, e.g.
329 ('mac', 'linux', 'win') 335 ('mac', 'linux', 'win')
330 extra_archives: A sequence of tuples: (archive_basename, minimum_version), 336 extra_archives: A sequence of tuples: (archive_basename, minimum_version),
331 e.g. [('foo.tar.bz2', '18.0.1000.0'), ('bar.tar.bz2', '19.0.1100.20')] 337 e.g. [('foo.tar.bz2', '18.0.1000.0'), ('bar.tar.bz2', '19.0.1100.20')]
332 These archives must exist to consider a version for inclusion, as 338 These archives must exist to consider a version for inclusion, as
333 long as that version is greater than the archive's minimum version. 339 long as that version is greater than the archive's minimum version.
340 is_bionic: True if we are searching for bionic archives.
334 """ 341 """
335 def __init__(self, delegate, platforms, extra_archives=None): 342 def __init__(self, delegate, platforms, extra_archives=None, is_bionic=False):
336 self.delegate = delegate 343 self.delegate = delegate
337 self.history = delegate.GetHistory() 344 self.history = delegate.GetHistory()
338 self.platforms = platforms 345 self.platforms = platforms
339 self.extra_archives = extra_archives 346 self.extra_archives = extra_archives
347 self.is_bionic = is_bionic
340 348
341 def GetMostRecentSharedVersion(self, major_version): 349 def GetMostRecentSharedVersion(self, major_version):
342 """Returns the most recent version of a pepper bundle that exists on all 350 """Returns the most recent version of a pepper bundle that exists on all
343 given platforms. 351 given platforms.
344 352
345 Specifically, the resulting version should be the most recently released 353 Specifically, the resulting version should be the most recently released
346 (meaning closest to the top of the listing on 354 (meaning closest to the top of the listing on
347 omahaproxy.appspot.com/history) version that has a Chrome release on all 355 omahaproxy.appspot.com/history) version that has a Chrome release on all
348 given platforms, and has a pepper bundle archive for each platform as well. 356 given platforms, and has a pepper bundle archive for each platform as well.
349 357
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 403
396 Args: 404 Args:
397 version: The version to find archives for. (e.g. "18.0.1025.164") 405 version: The version to find archives for. (e.g. "18.0.1025.164")
398 allow_trunk_revisions: If True, will search for archives using the 406 allow_trunk_revisions: If True, will search for archives using the
399 trunk revision that matches the branch version. 407 trunk revision that matches the branch version.
400 Returns: 408 Returns:
401 A tuple (archives, missing_archives). |archives| is a list of archive 409 A tuple (archives, missing_archives). |archives| is a list of archive
402 URLs, |missing_archives| is a list of archive names. 410 URLs, |missing_archives| is a list of archive names.
403 """ 411 """
404 archive_urls = self._GetAvailableArchivesFor(version) 412 archive_urls = self._GetAvailableArchivesFor(version)
405 platform_archives = set(GetPlatformArchiveName(p) for p in self.platforms) 413
406 expected_archives = platform_archives 414 if self.is_bionic:
415 # Bionic currently is Linux-only.
416 expected_archives = set([GetBionicArchiveName()])
417 else:
418 expected_archives = set(GetPlatformArchiveName(p) for p in self.platforms)
419
407 if self.extra_archives: 420 if self.extra_archives:
408 for extra_archive, extra_archive_min_version in self.extra_archives: 421 for extra_archive, extra_archive_min_version in self.extra_archives:
409 if SplitVersion(version) >= SplitVersion(extra_archive_min_version): 422 if SplitVersion(version) >= SplitVersion(extra_archive_min_version):
410 expected_archives.add(extra_archive) 423 expected_archives.add(extra_archive)
411 found_archives = set(GetCanonicalArchiveName(a) for a in archive_urls) 424 found_archives = set(GetCanonicalArchiveName(a) for a in archive_urls)
412 missing_archives = expected_archives - found_archives 425 missing_archives = expected_archives - found_archives
426
413 if allow_trunk_revisions and missing_archives: 427 if allow_trunk_revisions and missing_archives:
414 # Try to find trunk versions of any missing archives. 428 # Try to find trunk versions of any missing archives.
415 trunk_version = self.delegate.GetTrunkRevision(version) 429 trunk_version = self.delegate.GetTrunkRevision(version)
416 trunk_archives = self._GetAvailableArchivesFor(trunk_version) 430 trunk_archives = self._GetAvailableArchivesFor(trunk_version)
417 for trunk_archive_url in trunk_archives: 431 for trunk_archive_url in trunk_archives:
418 trunk_archive = GetCanonicalArchiveName(trunk_archive_url) 432 trunk_archive = GetCanonicalArchiveName(trunk_archive_url)
419 if trunk_archive in missing_archives: 433 if trunk_archive in missing_archives:
420 archive_urls.append(trunk_archive_url) 434 archive_urls.append(trunk_archive_url)
421 missing_archives.discard(trunk_archive) 435 missing_archives.discard(trunk_archive)
422 436
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 e.g. ('pepper_21', '21.0.1145.0') 809 e.g. ('pepper_21', '21.0.1145.0')
796 """ 810 """
797 if fixed_bundle_versions: 811 if fixed_bundle_versions:
798 fixed_bundle_versions = dict(fixed_bundle_versions) 812 fixed_bundle_versions = dict(fixed_bundle_versions)
799 else: 813 else:
800 fixed_bundle_versions = {} 814 fixed_bundle_versions = {}
801 815
802 manifest = delegate.GetRepoManifest() 816 manifest = delegate.GetRepoManifest()
803 auto_update_bundles = [] 817 auto_update_bundles = []
804 for bundle in manifest.GetBundles(): 818 for bundle in manifest.GetBundles():
805 if not bundle.name.startswith('pepper_'): 819 if not bundle.name.startswith(('pepper_', 'bionic_')):
806 continue 820 continue
807 archives = bundle.GetArchives() 821 archives = bundle.GetArchives()
808 if not archives: 822 if not archives:
809 auto_update_bundles.append(bundle) 823 auto_update_bundles.append(bundle)
810 824
811 if not auto_update_bundles: 825 if not auto_update_bundles:
812 logger.info('No versions need auto-updating.') 826 logger.info('No versions need auto-updating.')
813 return 827 return
814 828
815 version_finder = VersionFinder(delegate, platforms, extra_archives)
816 updater = Updater(delegate) 829 updater = Updater(delegate)
817 830
818 for bundle in auto_update_bundles: 831 for bundle in auto_update_bundles:
819 try: 832 try:
820 if bundle.name == CANARY_BUNDLE_NAME: 833 if bundle.name == BIONIC_CANARY_BUNDLE_NAME:
834 logger.info('>>> Looking for most recent bionic_canary...')
835 version_finder = VersionFinder(delegate, platforms, extra_archives,
836 is_bionic=True)
837 version, channel, archives = version_finder.GetMostRecentSharedCanary()
838 elif bundle.name == CANARY_BUNDLE_NAME:
821 logger.info('>>> Looking for most recent pepper_canary...') 839 logger.info('>>> Looking for most recent pepper_canary...')
840 version_finder = VersionFinder(delegate, platforms, extra_archives)
822 version, channel, archives = version_finder.GetMostRecentSharedCanary() 841 version, channel, archives = version_finder.GetMostRecentSharedCanary()
823 else: 842 else:
824 logger.info('>>> Looking for most recent pepper_%s...' % 843 logger.info('>>> Looking for most recent pepper_%s...' %
825 bundle.version) 844 bundle.version)
845 version_finder = VersionFinder(delegate, platforms, extra_archives)
826 version, channel, archives = version_finder.GetMostRecentSharedVersion( 846 version, channel, archives = version_finder.GetMostRecentSharedVersion(
827 bundle.version) 847 bundle.version)
828 except NoSharedVersionException: 848 except NoSharedVersionException:
829 # If we can't find a shared version, make sure that there is an uploaded 849 # If we can't find a shared version, make sure that there is an uploaded
830 # bundle with that name already. 850 # bundle with that name already.
831 updater.AddLockedBundle(bundle.name) 851 updater.AddLockedBundle(bundle.name)
832 continue 852 continue
833 853
834 if bundle.name in fixed_bundle_versions: 854 if bundle.name in fixed_bundle_versions:
835 # Ensure this version is valid for all platforms. 855 # Ensure this version is valid for all platforms.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 gsutil_logging_handler.upload() 962 gsutil_logging_handler.upload()
943 except manifest_util.Error as e: 963 except manifest_util.Error as e:
944 if options.debug: 964 if options.debug:
945 raise 965 raise
946 sys.stderr.write(str(e) + '\n') 966 sys.stderr.write(str(e) + '\n')
947 return 1 967 return 1
948 968
949 969
950 if __name__ == '__main__': 970 if __name__ == '__main__':
951 sys.exit(main(sys.argv)) 971 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698