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

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

Issue 1493443002: Revert of [NaCl SDK] Remove support for bionic toolchain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 """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 20 matching lines...) Expand all
31 31
32 MANIFEST_BASENAME = 'naclsdk_manifest2.json' 32 MANIFEST_BASENAME = 'naclsdk_manifest2.json'
33 SCRIPT_DIR = os.path.dirname(__file__) 33 SCRIPT_DIR = os.path.dirname(__file__)
34 REPO_MANIFEST = os.path.join(SCRIPT_DIR, 'json', MANIFEST_BASENAME) 34 REPO_MANIFEST = os.path.join(SCRIPT_DIR, 'json', MANIFEST_BASENAME)
35 GS_BUCKET_PATH = 'gs://nativeclient-mirror/nacl/nacl_sdk/' 35 GS_BUCKET_PATH = 'gs://nativeclient-mirror/nacl/nacl_sdk/'
36 GS_SDK_MANIFEST = GS_BUCKET_PATH + MANIFEST_BASENAME 36 GS_SDK_MANIFEST = GS_BUCKET_PATH + MANIFEST_BASENAME
37 GS_SDK_MANIFEST_LOG = GS_BUCKET_PATH + MANIFEST_BASENAME + '.log' 37 GS_SDK_MANIFEST_LOG = GS_BUCKET_PATH + MANIFEST_BASENAME + '.log'
38 GS_MANIFEST_BACKUP_DIR = GS_BUCKET_PATH + 'manifest_backups/' 38 GS_MANIFEST_BACKUP_DIR = GS_BUCKET_PATH + 'manifest_backups/'
39 39
40 CANARY_BUNDLE_NAME = 'pepper_canary' 40 CANARY_BUNDLE_NAME = 'pepper_canary'
41 BIONIC_CANARY_BUNDLE_NAME = 'bionic_canary'
41 CANARY = 'canary' 42 CANARY = 'canary'
42 NACLPORTS_ARCHIVE_NAME = 'naclports.tar.bz2' 43 NACLPORTS_ARCHIVE_NAME = 'naclports.tar.bz2'
43 44
44 45
45 logger = logging.getLogger(__name__) 46 logger = logging.getLogger(__name__)
46 47
47 48
48 def SplitVersion(version_string): 49 def SplitVersion(version_string):
49 """Split a version string (e.g. "18.0.1025.163") into its components. 50 """Split a version string (e.g. "18.0.1025.163") into its components.
50 51
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 118
118 Args: 119 Args:
119 platform: One of ('win', 'mac', 'linux'). 120 platform: One of ('win', 'mac', 'linux').
120 121
121 Returns: 122 Returns:
122 The basename of the sdk archive for that platform. 123 The basename of the sdk archive for that platform.
123 """ 124 """
124 return 'naclsdk_%s.tar.bz2' % platform 125 return 'naclsdk_%s.tar.bz2' % platform
125 126
126 127
128 def GetBionicArchiveName():
129 """Get the basename of an archive. Currently this is linux-only"""
130 return 'naclsdk_bionic.tar.bz2'
131
132
127 def GetCanonicalArchiveName(url): 133 def GetCanonicalArchiveName(url):
128 """Get the canonical name of an archive given its URL. 134 """Get the canonical name of an archive given its URL.
129 135
130 This will convert "naclsdk_linux.bz2" -> "naclsdk_linux.tar.bz2", and also 136 This will convert "naclsdk_linux.bz2" -> "naclsdk_linux.tar.bz2", and also
131 remove everything but the filename of the URL. 137 remove everything but the filename of the URL.
132 138
133 This is used below to determine if an expected bundle is found in an version 139 This is used below to determine if an expected bundle is found in an version
134 directory; the archives all have the same name, but may not exist for a given 140 directory; the archives all have the same name, but may not exist for a given
135 version. 141 version.
136 142
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 """Finds a version of a pepper bundle that all desired platforms share. 354 """Finds a version of a pepper bundle that all desired platforms share.
349 355
350 Args: 356 Args:
351 delegate: See Delegate class above. 357 delegate: See Delegate class above.
352 platforms: A sequence of platforms to consider, e.g. 358 platforms: A sequence of platforms to consider, e.g.
353 ('mac', 'linux', 'win') 359 ('mac', 'linux', 'win')
354 extra_archives: A sequence of tuples: (archive_basename, minimum_version), 360 extra_archives: A sequence of tuples: (archive_basename, minimum_version),
355 e.g. [('foo.tar.bz2', '18.0.1000.0'), ('bar.tar.bz2', '19.0.1100.20')] 361 e.g. [('foo.tar.bz2', '18.0.1000.0'), ('bar.tar.bz2', '19.0.1100.20')]
356 These archives must exist to consider a version for inclusion, as 362 These archives must exist to consider a version for inclusion, as
357 long as that version is greater than the archive's minimum version. 363 long as that version is greater than the archive's minimum version.
364 is_bionic: True if we are searching for bionic archives.
358 """ 365 """
359 def __init__(self, delegate, platforms, extra_archives=None): 366 def __init__(self, delegate, platforms, extra_archives=None, is_bionic=False):
360 self.delegate = delegate 367 self.delegate = delegate
361 self.history = delegate.GetHistory() 368 self.history = delegate.GetHistory()
362 self.platforms = platforms 369 self.platforms = platforms
363 self.extra_archives = extra_archives 370 self.extra_archives = extra_archives
371 self.is_bionic = is_bionic
364 372
365 def GetMostRecentSharedVersion(self, major_version): 373 def GetMostRecentSharedVersion(self, major_version):
366 """Returns the most recent version of a pepper bundle that exists on all 374 """Returns the most recent version of a pepper bundle that exists on all
367 given platforms. 375 given platforms.
368 376
369 Specifically, the resulting version should be the most recently released 377 Specifically, the resulting version should be the most recently released
370 (meaning closest to the top of the listing on 378 (meaning closest to the top of the listing on
371 omahaproxy.appspot.com/history) version that has a Chrome release on all 379 omahaproxy.appspot.com/history) version that has a Chrome release on all
372 given platforms, and has a pepper bundle archive for each platform as well. 380 given platforms, and has a pepper bundle archive for each platform as well.
373 381
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 not have an archive for the given version. 414 not have an archive for the given version.
407 415
408 Args: 416 Args:
409 version: The version to find archives for. (e.g. "18.0.1025.164") 417 version: The version to find archives for. (e.g. "18.0.1025.164")
410 Returns: 418 Returns:
411 A tuple (archives, missing_archives). |archives| is a list of archive 419 A tuple (archives, missing_archives). |archives| is a list of archive
412 URLs, |missing_archives| is a list of archive names. 420 URLs, |missing_archives| is a list of archive names.
413 """ 421 """
414 archive_urls = self._GetAvailableArchivesFor(version) 422 archive_urls = self._GetAvailableArchivesFor(version)
415 423
416 expected_archives = set(GetPlatformArchiveName(p) for p in self.platforms) 424 if self.is_bionic:
425 # Bionic currently is Linux-only.
426 expected_archives = set([GetBionicArchiveName()])
427 else:
428 expected_archives = set(GetPlatformArchiveName(p) for p in self.platforms)
417 429
418 if self.extra_archives: 430 if self.extra_archives:
419 for extra_archive, min_version, max_version in self.extra_archives: 431 for extra_archive, min_version, max_version in self.extra_archives:
420 if (CompareVersions(version, min_version) >= 0 and 432 if (CompareVersions(version, min_version) >= 0 and
421 CompareVersions(version, max_version) < 0): 433 CompareVersions(version, max_version) < 0):
422 expected_archives.add(extra_archive) 434 expected_archives.add(extra_archive)
423 found_archives = set(GetCanonicalArchiveName(a) for a in archive_urls) 435 found_archives = set(GetCanonicalArchiveName(a) for a in archive_urls)
424 missing_archives = expected_archives - found_archives 436 missing_archives = expected_archives - found_archives
425 437
426 # Only return archives that are "expected". 438 # Only return archives that are "expected".
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 e.g. ('pepper_21', '21.0.1145.0') 801 e.g. ('pepper_21', '21.0.1145.0')
790 """ 802 """
791 if fixed_bundle_versions: 803 if fixed_bundle_versions:
792 fixed_bundle_versions = dict(fixed_bundle_versions) 804 fixed_bundle_versions = dict(fixed_bundle_versions)
793 else: 805 else:
794 fixed_bundle_versions = {} 806 fixed_bundle_versions = {}
795 807
796 manifest = delegate.GetRepoManifest() 808 manifest = delegate.GetRepoManifest()
797 auto_update_bundles = [] 809 auto_update_bundles = []
798 for bundle in manifest.GetBundles(): 810 for bundle in manifest.GetBundles():
799 if not bundle.name.startswith('pepper_'): 811 if not bundle.name.startswith(('pepper_', 'bionic_')):
800 continue 812 continue
801 archives = bundle.GetArchives() 813 archives = bundle.GetArchives()
802 if not archives: 814 if not archives:
803 auto_update_bundles.append(bundle) 815 auto_update_bundles.append(bundle)
804 816
805 if not auto_update_bundles: 817 if not auto_update_bundles:
806 logger.info('No versions need auto-updating.') 818 logger.info('No versions need auto-updating.')
807 return 819 return
808 820
809 updater = Updater(delegate) 821 updater = Updater(delegate)
810 822
811 for bundle in auto_update_bundles: 823 for bundle in auto_update_bundles:
812 try: 824 try:
813 if bundle.name == CANARY_BUNDLE_NAME: 825 if bundle.name == BIONIC_CANARY_BUNDLE_NAME:
826 logger.info('>>> Looking for most recent bionic_canary...')
827 # Ignore extra_archives on bionic; There is no naclports bundle yet.
828 version_finder = VersionFinder(delegate, platforms, None,
829 is_bionic=True)
830 version, channel, archives = version_finder.GetMostRecentSharedCanary()
831 elif bundle.name == CANARY_BUNDLE_NAME:
814 logger.info('>>> Looking for most recent pepper_canary...') 832 logger.info('>>> Looking for most recent pepper_canary...')
815 version_finder = VersionFinder(delegate, platforms, extra_archives) 833 version_finder = VersionFinder(delegate, platforms, extra_archives)
816 version, channel, archives = version_finder.GetMostRecentSharedCanary() 834 version, channel, archives = version_finder.GetMostRecentSharedCanary()
817 else: 835 else:
818 logger.info('>>> Looking for most recent pepper_%s...' % 836 logger.info('>>> Looking for most recent pepper_%s...' %
819 bundle.version) 837 bundle.version)
820 version_finder = VersionFinder(delegate, platforms, extra_archives) 838 version_finder = VersionFinder(delegate, platforms, extra_archives)
821 version, channel, archives = version_finder.GetMostRecentSharedVersion( 839 version, channel, archives = version_finder.GetMostRecentSharedVersion(
822 bundle.version) 840 bundle.version)
823 except NoSharedVersionException: 841 except NoSharedVersionException:
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 except manifest_util.Error as e: 956 except manifest_util.Error as e:
939 if options.debug: 957 if options.debug:
940 raise 958 raise
941 sys.stderr.write(str(e) + '\n') 959 sys.stderr.write(str(e) + '\n')
942 return 1 960 return 1
943 961
944 return 0 962 return 0
945 963
946 if __name__ == '__main__': 964 if __name__ == '__main__':
947 sys.exit(main(sys.argv[1:])) 965 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.py ('k') | native_client_sdk/src/doc/sdk/download.rst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698