diff options
author | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-19 21:15:49 +0000 |
---|---|---|
committer | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-19 21:15:49 +0000 |
commit | 33f0f4b735211c321e8e93a9a38fc5a3425cfcff (patch) | |
tree | b9fb7eef0039cb9c04dc449149742e1537be7534 /native_client_sdk | |
parent | c9a3e7c46dde2e7775b017814753cfbab8a3bb54 (diff) | |
download | chromium_src-33f0f4b735211c321e8e93a9a38fc5a3425cfcff.zip chromium_src-33f0f4b735211c321e8e93a9a38fc5a3425cfcff.tar.gz chromium_src-33f0f4b735211c321e8e93a9a38fc5a3425cfcff.tar.bz2 |
[NaCl SDK] update_nacl_manifest supports naclports bundle.
BUG=170773
R=sbc@chromium.org
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11953070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-x | native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.py | 139 | ||||
-rwxr-xr-x | native_client_sdk/src/build_tools/update_nacl_manifest.py | 190 |
2 files changed, 214 insertions, 115 deletions
diff --git a/native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.py b/native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.py index 53f0e7b..73965fe 100755 --- a/native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.py +++ b/native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.py @@ -31,6 +31,7 @@ OS_M = ('mac',) OS_ML = ('mac', 'linux') OS_MW = ('mac', 'win') OS_MLW = ('mac', 'linux', 'win') +OS_ALL = ('all',) POST_STABLE = 'post_stable' STABLE = 'stable' BETA = 'beta' @@ -38,11 +39,15 @@ DEV = 'dev' CANARY = 'canary' -def GetArchiveUrl(host_os, version): - basename = 'naclsdk_%s.tar.bz2' % (host_os,) +def GetArchiveURL(basename, version): return urlparse.urljoin(HTTPS_BASE_URL, posixpath.join(version, basename)) +def GetPlatformArchiveUrl(host_os, version): + basename = 'naclsdk_%s.tar.bz2' % (host_os,) + return GetArchiveURL(basename, version) + + def MakeGsUrl(rel_path): return update_nacl_manifest.GS_BUCKET_PATH + rel_path @@ -57,9 +62,9 @@ def GetPathFromHttpsUrl(url): return url[len(HTTPS_BASE_URL):] -def MakeArchive(host_os, version): +def MakeArchive(url, host_os): archive = manifest_util.Archive(host_os) - archive.url = GetArchiveUrl(host_os, version) + archive.url = url # dummy values that won't succeed if we ever use them, but will pass # validation. :) archive.checksum = {'sha1': 'foobar'} @@ -67,6 +72,14 @@ def MakeArchive(host_os, version): return archive +def MakePlatformArchive(host_os, version): + return MakeArchive(GetPlatformArchiveUrl(host_os, version), host_os) + + +def MakeNonPlatformArchive(basename, version): + return MakeArchive(GetArchiveURL(basename, version), 'all') + + def MakeNonPepperBundle(name, with_archives=False): bundle = manifest_util.Bundle(name) bundle.version = 1 @@ -85,8 +98,7 @@ def MakeNonPepperBundle(name, with_archives=False): return bundle -def MakeBundle(major_version, revision=0, version=None, host_oses=None, - stability='dev'): +def MakePepperBundle(major_version, revision=0, version=None, stability='dev'): assert (version is None or version.split('.')[0] == 'trunk' or version.split('.')[0] == str(major_version)) @@ -104,9 +116,17 @@ def MakeBundle(major_version, revision=0, version=None, host_oses=None, bundle.recommended = 'no' bundle.stability = stability + return bundle + + +def MakePlatformBundle(major_version, revision=0, version=None, host_oses=None, + stability='dev'): + bundle = MakePepperBundle(major_version, revision, version, stability) + if host_oses: for host_os in host_oses: - bundle.AddArchive(MakeArchive(host_os, version)) + bundle.AddArchive(MakePlatformArchive(host_os, version)) + return bundle @@ -144,18 +164,20 @@ class MakeFiles(dict): if not archive.host_os in add_archive_for_os: continue - # add a dummy file for each archive - path = GetPathFromHttpsUrl(archive.url) - self[path] = 'My Dummy Archive' + self.AddArchive(bundle, archive, archive.host_os in add_json_for_os) + + def AddArchive(self, bundle, archive, add_json=True): + path = GetPathFromHttpsUrl(archive.url) + self[path] = 'My Dummy archive' - if archive.host_os in add_json_for_os: - # add .json manifest snippet, it should look like a normal Bundle, but - # only has one archive. - new_bundle = manifest_util.Bundle('') - new_bundle.CopyFrom(bundle) - del new_bundle.archives[:] - new_bundle.AddArchive(archive) - self[path + '.json'] = new_bundle.GetDataAsString() + if add_json: + # add .json manifest snippet, it should look like a normal Bundle, but + # only has one archive. + new_bundle = manifest_util.Bundle('') + new_bundle.CopyFrom(bundle) + del new_bundle.archives[:] + new_bundle.AddArchive(archive) + self[path + '.json'] = new_bundle.GetDataAsString() class TestDelegate(update_nacl_manifest.Delegate): @@ -214,17 +236,20 @@ V19_0_1084_41 = '19.0.1084.41' V19_0_1084_67 = '19.0.1084.67' V21_0_1145_0 = '21.0.1145.0' V21_0_1166_0 = '21.0.1166.0' +V26_0_1386_0 = '26.0.1386.0' VTRUNK_138079 = 'trunk.138079' -B18_0_1025_163_R1_MLW = MakeBundle(18, 1, V18_0_1025_163, OS_MLW) -B18_0_1025_184_R1_MLW = MakeBundle(18, 1, V18_0_1025_184, OS_MLW) -B18_R1_NONE = MakeBundle(18) -B19_0_1084_41_R1_MLW = MakeBundle(19, 1, V19_0_1084_41, OS_MLW) -B19_0_1084_67_R1_MLW = MakeBundle(19, 1, V19_0_1084_67, OS_MLW) -B19_R1_NONE = MakeBundle(19) -BCANARY_R1_NONE = MakeBundle(0, stability=CANARY) -B21_0_1145_0_R1_MLW = MakeBundle(21, 1, V21_0_1145_0, OS_MLW) -B21_0_1166_0_R1_MW = MakeBundle(21, 1, V21_0_1166_0, OS_MW) -BTRUNK_138079_R1_MLW = MakeBundle(21, 1, VTRUNK_138079, OS_MLW) +B18_0_1025_163_R1_MLW = MakePlatformBundle(18, 1, V18_0_1025_163, OS_MLW) +B18_0_1025_184_R1_MLW = MakePlatformBundle(18, 1, V18_0_1025_184, OS_MLW) +B18_R1_NONE = MakePlatformBundle(18) +B19_0_1084_41_R1_MLW = MakePlatformBundle(19, 1, V19_0_1084_41, OS_MLW) +B19_0_1084_67_R1_MLW = MakePlatformBundle(19, 1, V19_0_1084_67, OS_MLW) +B19_R1_NONE = MakePlatformBundle(19) +BCANARY_R1_NONE = MakePlatformBundle(0, stability=CANARY) +B21_0_1145_0_R1_MLW = MakePlatformBundle(21, 1, V21_0_1145_0, OS_MLW) +B21_0_1166_0_R1_MW = MakePlatformBundle(21, 1, V21_0_1166_0, OS_MW) +B26_R1_NONE = MakePlatformBundle(26) +B26_0_1386_0_R1_MLW = MakePlatformBundle(26, 1, V26_0_1386_0, OS_MLW) +BTRUNK_138079_R1_MLW = MakePlatformBundle(21, 1, VTRUNK_138079, OS_MLW) NON_PEPPER_BUNDLE_NOARCHIVES = MakeNonPepperBundle('foo') NON_PEPPER_BUNDLE_ARCHIVES = MakeNonPepperBundle('bar', with_archives=True) @@ -242,8 +267,9 @@ class TestUpdateManifest(unittest.TestCase): self.delegate = TestDelegate(self.manifest, self.history.history, self.files, self.version_mapping) - def _Run(self, host_oses, fixed_bundle_versions=None): - update_nacl_manifest.Run(self.delegate, host_oses, fixed_bundle_versions) + def _Run(self, host_oses, extra_archives=None, fixed_bundle_versions=None): + update_nacl_manifest.Run(self.delegate, host_oses, extra_archives, + fixed_bundle_versions) def _HasUploadedManifest(self): return 'naclsdk_manifest2.json' in self.files @@ -411,7 +437,8 @@ class TestUpdateManifest(unittest.TestCase): # resulting manifest is still consistent with the old format. self.manifest = MakeManifest(B18_R1_NONE) self.history.Add(OS_MLW, BETA, V18_0_1025_163) - bundle_string_revision = MakeBundle('18', '1234', V18_0_1025_163, OS_MLW) + bundle_string_revision = MakePlatformBundle('18', '1234', V18_0_1025_163, + OS_MLW) self.files.Add(bundle_string_revision) self._MakeDelegate() self._Run(OS_MLW) @@ -455,7 +482,7 @@ class TestUpdateManifest(unittest.TestCase): mac,canary,21.0.1163.0,2012-06-04 11:54:09.433166""" self._AddCsvHistory(history) self.version_mapping['21.0.1163.0'] = 'trunk.140240' - my_bundle = MakeBundle(21, 140240, '21.0.1163.0', OS_MLW) + my_bundle = MakePlatformBundle(21, 140240, '21.0.1163.0', OS_MLW) self.files.Add(my_bundle) self._MakeDelegate() self._Run(OS_MLW) @@ -498,9 +525,9 @@ mac,canary,21.0.1156.0,2012-05-30 12:14:21.305090""" '21.0.1157.0': 'unknown', '21.0.1156.1': 'trunk.139576', '21.0.1156.0': 'trunk.139984'} - self.files.Add(MakeBundle(21, 139890, '21.0.1159.2', OS_MLW)) - self.files.Add(MakeBundle(21, 0, '21.0.1157.1', ('linux', 'win'))) - my_bundle = MakeBundle(21, 139576, '21.0.1156.1', OS_MLW) + self.files.Add(MakePlatformBundle(21, 139890, '21.0.1159.2', OS_MLW)) + self.files.Add(MakePlatformBundle(21, 0, '21.0.1157.1', ('linux', 'win'))) + my_bundle = MakePlatformBundle(21, 139576, '21.0.1156.1', OS_MLW) self.files.Add(my_bundle) self._MakeDelegate() self._Run(OS_MLW) @@ -568,7 +595,7 @@ mac,canary,21.0.1156.0,2012-05-30 12:14:21.305090""" self.files.Add(B18_0_1025_184_R1_MLW) self._MakeDelegate() - self._Run(OS_MLW, [('pepper_18', '18.0.1025.184')]) + self._Run(OS_MLW, None, [('pepper_18', '18.0.1025.184')]) self._ReadUploadedManifest() self._AssertUploadedManifestHasBundle(B18_0_1025_184_R1_MLW, BETA) self.assertEqual(len(self.uploaded_manifest.GetBundles()), 1) @@ -579,10 +606,46 @@ mac,canary,21.0.1156.0,2012-05-30 12:14:21.305090""" self.files.Add(B18_0_1025_163_R1_MLW) self._MakeDelegate() - self._Run(OS_MLW, [('pepper_18', '18.0.1025.184')]) + self._Run(OS_MLW, None, [('pepper_18', '18.0.1025.184')]) # Nothing should be uploaded if the user gives a missing fixed version. self.assertFalse(self.delegate.called_gsutil_cp) + def testDontIncludeRandomBundles(self): + self.manifest = MakeManifest(B26_R1_NONE) + self.history.Add(OS_MLW, BETA, V26_0_1386_0) + self.files.Add(B26_0_1386_0_R1_MLW) + + some_other_bundle = MakePepperBundle(26, 1, V26_0_1386_0, BETA) + some_other_archive = MakeNonPlatformArchive('some_other.tar.bz2', + V26_0_1386_0) + some_other_bundle.AddArchive(some_other_archive) + self.files.AddArchive(some_other_bundle, some_other_archive) + + self._MakeDelegate() + self._Run(OS_MLW) + self._ReadUploadedManifest() + uploaded_bundle = self.uploaded_manifest.GetBundle('pepper_26') + self.assertEqual(1, len(uploaded_bundle.GetHostOSArchives())) + + def testNaclportsBundle(self): + self.manifest = MakeManifest(B26_R1_NONE) + self.history.Add(OS_MLW, BETA, V26_0_1386_0) + self.files.Add(B26_0_1386_0_R1_MLW) + + # NaclPorts "bundle". + naclports_bundle = MakePepperBundle(26, 1, V26_0_1386_0, BETA) + naclports_archive = MakeNonPlatformArchive('naclports.tar.bz2', + V26_0_1386_0) + naclports_bundle.AddArchive(naclports_archive) + self.files.AddArchive(naclports_bundle, naclports_archive) + + self._MakeDelegate() + self._Run(OS_MLW, [('naclports.tar.bz2', '26.0.1386.0')]) + self._ReadUploadedManifest() + + uploaded_bundle = self.uploaded_manifest.GetBundle('pepper_26') + self.assertEqual(2, len(uploaded_bundle.GetHostOSArchives())) + class TestUpdateVitals(unittest.TestCase): def setUp(self): @@ -607,7 +670,7 @@ class TestUpdateVitals(unittest.TestCase): path = '/' + path archive.url = 'file://' + path - bundle = MakeBundle(18) + bundle = MakePlatformBundle(18) bundle.AddArchive(archive) manifest = MakeManifest(bundle) archive = manifest.GetBundles()[0]['archives'][0] diff --git a/native_client_sdk/src/build_tools/update_nacl_manifest.py b/native_client_sdk/src/build_tools/update_nacl_manifest.py index b8d308e..18a4244 100755 --- a/native_client_sdk/src/build_tools/update_nacl_manifest.py +++ b/native_client_sdk/src/build_tools/update_nacl_manifest.py @@ -38,6 +38,7 @@ GS_MANIFEST_BACKUP_DIR = GS_BUCKET_PATH + 'manifest_backups/' CANARY_BUNDLE_NAME = 'pepper_canary' CANARY = 'canary' +NACLPORTS_ARCHIVE_NAME = 'naclports.tar.bz2' def SplitVersion(version_string): @@ -67,32 +68,40 @@ def GetTimestampManifestName(): time.gmtime()) -def GetPlatformFromArchiveUrl(url): - """Get the platform name given an archive url. +def GetPlatformArchiveName(platform): + """Get the basename of an archive given a platform string. Args: - url: An archive url. + platform: One of ('win', 'mac', 'linux'). + Returns: - A platform name (e.g. 'linux').""" - match = re.match(r'naclsdk_(.*?)(?:\.tar)?\.bz2', posixpath.basename(url)) - if not match: - return None - return match.group(1) + The basename of the sdk archive for that platform. + """ + return 'naclsdk_%s.tar.bz2' % platform + + +def GetCanonicalArchiveName(url): + """Get the canonical name of an archive given its URL. + This will convert "naclsdk_linux.bz2" -> "naclsdk_linux.tar.bz2", and also + remove everything but the filename of the URL. -def GetPlatformsFromArchives(archive_urls): - """Get the platform names for a sequence of archive urls. + This is used below to determine if an expected bundle is found in an version + directory; the archives all have the same name, but may not exist for a given + version. Args: - archives: A sequence of archive urls. + url: The url to parse. + Returns: - A list of platforms, one for each url in |archive_urls|.""" - platforms = [] - for url in archive_urls: - platform = GetPlatformFromArchiveUrl(url) - if platform: - platforms.append(platform) - return platforms + The canonical name as described above. + """ + name = posixpath.basename(url) + match = re.match(r'naclsdk_(.*?)(?:\.tar)?\.bz2', name) + if match: + return 'naclsdk_%s.tar.bz2' % match.group(1) + + return name class Delegate(object): @@ -258,12 +267,24 @@ class RealDelegate(Delegate): class VersionFinder(object): - """Finds a version of a pepper bundle that all desired platforms share.""" - def __init__(self, delegate): + """Finds a version of a pepper bundle that all desired platforms share. + + Args: + delegate: See Delegate class above. + platforms: A sequence of platforms to consider, e.g. + ('mac', 'linux', 'win') + extra_archives: A sequence of tuples: (archive_basename, minimum_version), + e.g. [('foo.tar.bz2', '18.0.1000.0'), ('bar.tar.bz2', '19.0.1100.20')] + These archives must exist to consider a version for inclusion, as + long as that version is greater than the archive's minimum version. + """ + def __init__(self, delegate, platforms, extra_archives=None): self.delegate = delegate self.history = delegate.GetHistory() + self.platforms = platforms + self.extra_archives = extra_archives - def GetMostRecentSharedVersion(self, major_version, platforms): + def GetMostRecentSharedVersion(self, major_version): """Returns the most recent version of a pepper bundle that exists on all given platforms. @@ -274,29 +295,25 @@ class VersionFinder(object): Args: major_version: The major version of the pepper bundle, e.g. 19. - platforms: A sequence of platforms to consider, e.g. - ('mac', 'linux', 'win') Returns: A tuple (version, channel, archives). The version is a string such as "19.0.1084.41". The channel is one of ('stable', 'beta', or 'dev'). |archives| is a list of archive URLs.""" - shared_version_generator = self._FindNextSharedVersion( - platforms, - lambda platform: self._GetPlatformMajorVersionHistory(major_version, - platform)) - return self._DoGetMostRecentSharedVersion(platforms, - shared_version_generator, allow_trunk_revisions=False) + def GetPlatformHistory(platform): + return self._GetPlatformMajorVersionHistory(major_version, platform) + + shared_version_generator = self._FindNextSharedVersion(self.platforms, + GetPlatformHistory) + return self._DoGetMostRecentSharedVersion(shared_version_generator, + allow_trunk_revisions=False) - def GetMostRecentSharedCanary(self, platforms): + def GetMostRecentSharedCanary(self): """Returns the most recent version of a canary pepper bundle that exists on all given platforms. Canary is special-cased because we don't care about its major version; we always use the most recent canary, regardless of major version. - Args: - platforms: A sequence of platforms to consider, e.g. - ('mac', 'linux', 'win') Returns: A tuple (version, channel, archives). The version is a string such as "19.0.1084.41". The channel is always 'canary'. |archives| is a list of @@ -304,13 +321,12 @@ class VersionFinder(object): # We don't ship canary on Linux, so it won't appear in self.history. # Instead, we can use the matching Linux trunk build for that version. shared_version_generator = self._FindNextSharedVersion( - set(platforms) - set(('linux',)), + set(self.platforms) - set(('linux',)), self._GetPlatformCanaryHistory) - return self._DoGetMostRecentSharedVersion(platforms, - shared_version_generator, allow_trunk_revisions=True) + return self._DoGetMostRecentSharedVersion(shared_version_generator, + allow_trunk_revisions=True) - def GetAvailablePlatformArchivesFor(self, version, platforms, - allow_trunk_revisions): + def GetAvailablePlatformArchivesFor(self, version, allow_trunk_revisions): """Returns a sequence of archives that exist for a given version, on the given platforms. @@ -319,38 +335,46 @@ class VersionFinder(object): Args: version: The version to find archives for. (e.g. "18.0.1025.164") - platforms: A sequence of platforms to consider, e.g. - ('mac', 'linux', 'win') allow_trunk_revisions: If True, will search for archives using the trunk revision that matches the branch version. Returns: - A tuple (archives, missing_platforms). |archives| is a list of archive - URLs, |missing_platforms| is a list of platform names. + A tuple (archives, missing_archives). |archives| is a list of archive + URLs, |missing_archives| is a list of archive names. """ - archives = self._GetAvailableArchivesFor(version) - missing_platforms = set(platforms) - set(GetPlatformsFromArchives(archives)) - if allow_trunk_revisions and missing_platforms: - # Try to find trunk archives for platforms that are missing archives. + archive_urls = self._GetAvailableArchivesFor(version) + platform_archives = set(GetPlatformArchiveName(p) for p in self.platforms) + expected_archives = platform_archives + if self.extra_archives: + for extra_archive, extra_archive_min_version in self.extra_archives: + if SplitVersion(version) >= SplitVersion(extra_archive_min_version): + expected_archives.add(extra_archive) + found_archives = set(GetCanonicalArchiveName(a) for a in archive_urls) + missing_archives = expected_archives - found_archives + if allow_trunk_revisions and missing_archives: + # Try to find trunk versions of any missing archives. trunk_version = self.delegate.GetTrunkRevision(version) trunk_archives = self._GetAvailableArchivesFor(trunk_version) - for trunk_archive in trunk_archives: - trunk_archive_platform = GetPlatformFromArchiveUrl(trunk_archive) - if trunk_archive_platform in missing_platforms: - archives.append(trunk_archive) - missing_platforms.discard(trunk_archive_platform) + for trunk_archive_url in trunk_archives: + trunk_archive = GetCanonicalArchiveName(trunk_archive_url) + if trunk_archive in missing_archives: + archive_urls.append(trunk_archive_url) + missing_archives.discard(trunk_archive) - return archives, missing_platforms + # Only return archives that are "expected". + def IsExpected(url): + return GetCanonicalArchiveName(url) in expected_archives - def _DoGetMostRecentSharedVersion(self, platforms, shared_version_generator, - allow_trunk_revisions): + expected_archive_urls = [u for u in archive_urls if IsExpected(u)] + return expected_archive_urls, missing_archives + + def _DoGetMostRecentSharedVersion(self, shared_version_generator, + allow_trunk_revisions): """Returns the most recent version of a pepper bundle that exists on all given platforms. This function does the real work for the public GetMostRecentShared* above. Args: - platforms: A sequence of platforms to consider, e.g. - ('mac', 'linux', 'win') shared_version_generator: A generator that will yield (version, channel) tuples in order of most recent to least recent. allow_trunk_revisions: If True, will search for archives using the @@ -366,25 +390,23 @@ class VersionFinder(object): try: version, channel = shared_version_generator.next() except StopIteration: - msg = 'No shared version for platforms: %s\n' % (', '.join(platforms)) + msg = 'No shared version for platforms: %s\n' % ( + ', '.join(self.platforms)) msg += 'Last version checked = %s.\n' % (version,) if skipped_versions: msg += 'Versions skipped due to missing archives:\n' - for version, channel, archives in skipped_versions: - if archives: - archive_msg = '(%s available)' % (', '.join(archives)) - else: - archive_msg = '(none available)' + for version, channel, missing_archives in skipped_versions: + archive_msg = '(missing %s)' % (', '.join(missing_archives)) msg += ' %s (%s) %s\n' % (version, channel, archive_msg) raise Exception(msg) - archives, missing_platforms = self.GetAvailablePlatformArchivesFor( - version, platforms, allow_trunk_revisions) + archives, missing_archives = self.GetAvailablePlatformArchivesFor( + version, allow_trunk_revisions) - if not missing_platforms: + if not missing_archives: return version, channel, archives - skipped_versions.append((version, channel, archives)) + skipped_versions.append((version, channel, missing_archives)) def _GetPlatformMajorVersionHistory(self, with_major_version, with_platform): """Yields Chrome history for a given platform and major version. @@ -429,8 +451,10 @@ class VersionFinder(object): recently updated version will be tested first. Args: - platforms: A sequence of platforms to filter for. Any other platforms will - be ignored. + platforms: A sequence of platforms to consider, e.g. + ('mac', 'linux', 'win') + generator_func: A function which takes a platform and returns a + generator that yields (channel, version) tuples. Returns: A generator that yields a tuple (version, channel) for each version that matches all platforms and the major version. The version returned is a @@ -568,6 +592,11 @@ class Updater(object): # those here. bundle.revision = int(bundle.revision) bundle.version = int(bundle.version) + + # HACK. The naclports archive specifies host_os as linux. Change it to all. + for archive in bundle.GetArchives(): + if NACLPORTS_ARCHIVE_NAME in archive.url: + archive.host_os = 'all' return bundle def _UploadManifest(self, manifest): @@ -586,6 +615,7 @@ class Updater(object): self.delegate.Print(''.join(list(difflib.unified_diff( online_manifest_string.splitlines(1), new_manifest_string.splitlines(1))))) + return else: online_manifest = manifest_util.SDKManifest() online_manifest.LoadDataFromString(online_manifest_string) @@ -614,13 +644,17 @@ class Updater(object): self.online_manifest.LoadDataFromString(online_manifest_string) -def Run(delegate, platforms, fixed_bundle_versions=None): +def Run(delegate, platforms, extra_archives, fixed_bundle_versions=None): """Entry point for the auto-updater. Args: delegate: The Delegate object to use for reading Urls, files, etc. platforms: A sequence of platforms to consider, e.g. ('mac', 'linux', 'win') + extra_archives: A sequence of tuples: (archive_basename, minimum_version), + e.g. [('foo.tar.bz2', '18.0.1000.0'), ('bar.tar.bz2', '19.0.1100.20')] + These archives must exist to consider a version for inclusion, as + long as that version is greater than the archive's minimum version. fixed_bundle_versions: A sequence of tuples (bundle_name, version_string). e.g. ('pepper_21', '21.0.1145.0') """ @@ -642,16 +676,15 @@ def Run(delegate, platforms, fixed_bundle_versions=None): delegate.Print('No versions need auto-updating.') return - version_finder = VersionFinder(delegate) + version_finder = VersionFinder(delegate, platforms, extra_archives) updater = Updater(delegate) for bundle in auto_update_bundles: if bundle.name == CANARY_BUNDLE_NAME: - version, channel, archives = version_finder.GetMostRecentSharedCanary( - platforms) + version, channel, archives = version_finder.GetMostRecentSharedCanary() else: version, channel, archives = version_finder.GetMostRecentSharedVersion( - bundle.version, platforms) + bundle.version) if bundle.name in fixed_bundle_versions: # Ensure this version is valid for all platforms. @@ -661,11 +694,11 @@ def Run(delegate, platforms, fixed_bundle_versions=None): delegate.Print('Fixed bundle version: %s, %s' % (bundle.name, version)) allow_trunk_revisions = bundle.name == CANARY_BUNDLE_NAME archives, missing = version_finder.GetAvailablePlatformArchivesFor( - version, platforms, allow_trunk_revisions) + version, allow_trunk_revisions) if missing: delegate.Print( - 'An archive for version %s of bundle %s doesn\'t exist ' - 'for platform(s): %s' % (version, bundle.name, ', '.join(missing))) + 'Some archives for version %s of bundle %s don\'t exist: ' + 'Missing %s' % (version, bundle.name, ', '.join(missing))) return updater.AddVersionToUpdate(bundle.name, version, channel, archives) @@ -746,7 +779,10 @@ def main(args): try: try: delegate = RealDelegate(options.dryrun, options.gsutil, options.verbose) - Run(delegate, ('mac', 'win', 'linux'), fixed_bundle_versions) + # Only look for naclports archives > 26.0.1391.0 = r178222 + extra_archives = [('naclports.tar.bz2', '26.0.1391.0')] + Run(delegate, ('mac', 'win', 'linux'), extra_archives, + fixed_bundle_versions) except Exception: if options.mailfrom and options.mailto: traceback.print_exc() |