Commit 1f583930 authored by binji@chromium.org's avatar binji@chromium.org

[NaCl SDK] Fix bug in "naclsdk update", updating recommended bundles.

Running "naclsdk update" should only update bundles that are marked
recommended == "yes". Also, the "sdk_tools" bundle is marked as recommended,
but should not be added to this list (it is automatically updated).

BUG=179648
R=sbc@chromium.org
NOTRY=true


Review URL: https://chromiumcodereview.appspot.com/12470004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186279 0039d316-1c4b-4281-b951-d872f2087c98
parent bb5c4bff
......@@ -212,8 +212,11 @@ def _GetRequestedBundleNamesFromArgs(remote_manifest, requested_bundles):
def _GetRecommendedBundleNames(remote_manifest):
return [bundle.name for bundle in remote_manifest.GetBundles() if
bundle.recommended]
result = []
for bundle in remote_manifest.GetBundles():
if bundle.recommended == 'yes' and bundle.name != SDK_TOOLS:
result.append(bundle.name)
return result
def _BundleNeedsUpdate(delegate, local_manifest, bundle):
......
......@@ -227,10 +227,18 @@ class TestCommands(SdkToolsTestCase):
"""The update command should update only recommended bundles when run
without args.
"""
bundle = self._AddDummyBundle(self.manifest, 'pepper_26')
bundle.recommended = 'yes'
bundle_25 = self._AddDummyBundle(self.manifest, 'pepper_25')
bundle_25.recommended = 'no'
bundle_26 = self._AddDummyBundle(self.manifest, 'pepper_26')
bundle_26.recommended = 'yes'
self._WriteManifest()
output = self._Run(['update'])
# Should not try to update sdk_tools (even though it is recommended)
self.assertTrue('Ignoring manual update request.' not in output)
self.assertFalse(os.path.exists(
os.path.join(self.basedir, 'nacl_sdk', 'pepper_25')))
self.assertTrue(os.path.exists(
os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy.txt')))
......@@ -241,7 +249,7 @@ class TestCommands(SdkToolsTestCase):
bundle = self._AddDummyBundle(self.manifest, 'pepper_26')
bundle.name = 'pepper_canary'
self._WriteManifest()
output = self._Run(['update'])
output = self._Run(['update', 'pepper_canary'])
self.assertTrue(os.path.exists(
os.path.join(self.basedir, 'nacl_sdk', 'pepper_canary', 'dummy.txt')))
......@@ -255,7 +263,7 @@ class TestCommands(SdkToolsTestCase):
archive2.host_os = 'all'
bundle.AddArchive(archive2)
self._WriteManifest()
output = self._Run(['update'])
output = self._Run(['update', 'pepper_26'])
self.assertTrue(os.path.exists(
os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy.txt')))
self.assertTrue(os.path.exists(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment