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

Side by Side Diff: native_client_sdk/src/build_tools/sdk_tools/command/update.py

Issue 12470004: [NaCl SDK] Fix bug in "naclsdk update", updating recommended bundles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 years, 9 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 | « no previous file | native_client_sdk/src/build_tools/tests/sdktools_commands_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import logging 6 import logging
7 import os 7 import os
8 import sys 8 import sys
9 import urlparse 9 import urlparse
10 import urllib2 10 import urllib2
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 def _GetRequestedBundleNamesFromArgs(remote_manifest, requested_bundles): 205 def _GetRequestedBundleNamesFromArgs(remote_manifest, requested_bundles):
206 requested_bundles = set(requested_bundles) 206 requested_bundles = set(requested_bundles)
207 if RECOMMENDED in requested_bundles: 207 if RECOMMENDED in requested_bundles:
208 requested_bundles.discard(RECOMMENDED) 208 requested_bundles.discard(RECOMMENDED)
209 requested_bundles |= set(_GetRecommendedBundleNames(remote_manifest)) 209 requested_bundles |= set(_GetRecommendedBundleNames(remote_manifest))
210 210
211 return requested_bundles 211 return requested_bundles
212 212
213 213
214 def _GetRecommendedBundleNames(remote_manifest): 214 def _GetRecommendedBundleNames(remote_manifest):
215 return [bundle.name for bundle in remote_manifest.GetBundles() if 215 result = []
216 bundle.recommended] 216 for bundle in remote_manifest.GetBundles():
217 if bundle.recommended == 'yes' and bundle.name != SDK_TOOLS:
218 result.append(bundle.name)
219 return result
217 220
218 221
219 def _BundleNeedsUpdate(delegate, local_manifest, bundle): 222 def _BundleNeedsUpdate(delegate, local_manifest, bundle):
220 # Always update the bundle if the directory doesn't exist; 223 # Always update the bundle if the directory doesn't exist;
221 # the user may have deleted it. 224 # the user may have deleted it.
222 if not delegate.BundleDirectoryExists(bundle.name): 225 if not delegate.BundleDirectoryExists(bundle.name):
223 return True 226 return True
224 227
225 return local_manifest.BundleNeedsUpdate(bundle) 228 return local_manifest.BundleNeedsUpdate(bundle)
226 229
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return path.split('/')[-1] 278 return path.split('/')[-1]
276 279
277 280
278 def _ValidateArchive(archive, actual_sha1, actual_size): 281 def _ValidateArchive(archive, actual_sha1, actual_size):
279 if actual_sha1 != archive.GetChecksum(): 282 if actual_sha1 != archive.GetChecksum():
280 raise Error('SHA1 checksum mismatch on "%s". Expected %s but got %s' % ( 283 raise Error('SHA1 checksum mismatch on "%s". Expected %s but got %s' % (
281 archive.name, archive.GetChecksum(), actual_sha1)) 284 archive.name, archive.GetChecksum(), actual_sha1))
282 if actual_size != archive.size: 285 if actual_size != archive.size:
283 raise Error('Size mismatch on "%s". Expected %s but got %s bytes' % ( 286 raise Error('Size mismatch on "%s". Expected %s but got %s bytes' % (
284 archive.name, archive.size, actual_size)) 287 archive.name, archive.size, actual_size))
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/build_tools/tests/sdktools_commands_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698