OLD | NEW |
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 hashlib | 5 import hashlib |
6 import copy | 6 import copy |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if not force and delegate.BundleDirectoryExists(bundle_name): | 285 if not force and delegate.BundleDirectoryExists(bundle_name): |
286 print ('%s already exists, but has an update available.\n' | 286 print ('%s already exists, but has an update available.\n' |
287 'Run update with the --force option to overwrite the ' | 287 'Run update with the --force option to overwrite the ' |
288 'existing directory.\nWarning: This will overwrite any ' | 288 'existing directory.\nWarning: This will overwrite any ' |
289 'modifications you have made within this directory.' | 289 'modifications you have made within this directory.' |
290 % (bundle_name,)) | 290 % (bundle_name,)) |
291 return | 291 return |
292 | 292 |
293 _UpdateBundle(delegate, bundle, local_manifest) | 293 _UpdateBundle(delegate, bundle, local_manifest) |
294 else: | 294 else: |
295 print '%s is already up-to-date.' % (bundle.name,) | 295 print '%s is already up to date.' % (bundle.name,) |
296 else: | 296 else: |
297 logging.error('Bundle %s does not exist.' % (bundle_name,)) | 297 logging.error('Bundle %s does not exist.' % (bundle_name,)) |
298 | 298 |
299 | 299 |
300 def _GetRequestedBundleNamesFromArgs(remote_manifest, requested_bundles): | 300 def _GetRequestedBundleNamesFromArgs(remote_manifest, requested_bundles): |
301 requested_bundles = set(requested_bundles) | 301 requested_bundles = set(requested_bundles) |
302 if RECOMMENDED in requested_bundles: | 302 if RECOMMENDED in requested_bundles: |
303 requested_bundles.discard(RECOMMENDED) | 303 requested_bundles.discard(RECOMMENDED) |
304 requested_bundles |= set(_GetRecommendedBundleNames(remote_manifest)) | 304 requested_bundles |= set(_GetRecommendedBundleNames(remote_manifest)) |
305 | 305 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 return os.path.basename(path) | 380 return os.path.basename(path) |
381 | 381 |
382 | 382 |
383 def _ValidateArchive(archive, actual_sha1, actual_size): | 383 def _ValidateArchive(archive, actual_sha1, actual_size): |
384 if actual_size != archive.size: | 384 if actual_size != archive.size: |
385 raise Error('Size mismatch on "%s". Expected %s but got %s bytes' % ( | 385 raise Error('Size mismatch on "%s". Expected %s but got %s bytes' % ( |
386 archive.url, archive.size, actual_size)) | 386 archive.url, archive.size, actual_size)) |
387 if actual_sha1 != archive.GetChecksum(): | 387 if actual_sha1 != archive.GetChecksum(): |
388 raise Error('SHA1 checksum mismatch on "%s". Expected %s but got %s' % ( | 388 raise Error('SHA1 checksum mismatch on "%s". Expected %s but got %s' % ( |
389 archive.url, archive.GetChecksum(), actual_sha1)) | 389 archive.url, archive.GetChecksum(), actual_sha1)) |
OLD | NEW |