summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 19:00:00 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 19:00:00 +0000
commitf014a1a0d3b6384fd9e3e4558c707b33fa06cdf9 (patch)
treedc0ffcad95c3a752089d76cc388d5bbc5101c5bd /native_client_sdk
parentda06cc52a14dcb95726184f16a71d979ecee1a7f (diff)
downloadchromium_src-f014a1a0d3b6384fd9e3e4558c707b33fa06cdf9.zip
chromium_src-f014a1a0d3b6384fd9e3e4558c707b33fa06cdf9.tar.gz
chromium_src-f014a1a0d3b6384fd9e3e4558c707b33fa06cdf9.tar.bz2
[NaCl SDK] Fix update issues in sdk_tools.
* "naclsdk update" (i.e. update recommended) was broken * "naclsdk update pepper_canary" would make a directory called "pepper_26" not "pepper_canary". BUG=none R=sbc@chromium.org,noelallen@chromium.org NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11946002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/build_tools/sdk_tools/command/update.py18
-rwxr-xr-xnative_client_sdk/src/build_tools/tests/sdktools_commands_test.py24
2 files changed, 32 insertions, 10 deletions
diff --git a/native_client_sdk/src/build_tools/sdk_tools/command/update.py b/native_client_sdk/src/build_tools/sdk_tools/command/update.py
index 674c6e9..c8fb943 100644
--- a/native_client_sdk/src/build_tools/sdk_tools/command/update.py
+++ b/native_client_sdk/src/build_tools/sdk_tools/command/update.py
@@ -131,8 +131,8 @@ class RealUpdateDelegate(UpdateDelegate):
def Update(delegate, remote_manifest, local_manifest, bundle_names, force):
valid_bundles = set([bundle.name for bundle in remote_manifest.GetBundles()])
- requested_bundles = _GetRequestedBundlesFromArgs(remote_manifest,
- bundle_names)
+ requested_bundles = _GetRequestedBundleNamesFromArgs(remote_manifest,
+ bundle_names)
invalid_bundles = requested_bundles - valid_bundles
if invalid_bundles:
logging.warn('Ignoring unknown bundle(s): %s' % (
@@ -175,17 +175,17 @@ def UpdateBundleIfNeeded(delegate, remote_manifest, local_manifest,
logging.error('Bundle %s does not exist.' % (bundle_name,))
-def _GetRequestedBundlesFromArgs(remote_manifest, requested_bundles):
+def _GetRequestedBundleNamesFromArgs(remote_manifest, requested_bundles):
requested_bundles = set(requested_bundles)
if RECOMMENDED in requested_bundles:
requested_bundles.discard(RECOMMENDED)
- requested_bundles |= set(_GetRecommendedBundles(remote_manifest))
+ requested_bundles |= set(_GetRecommendedBundleNames(remote_manifest))
return requested_bundles
-def _GetRecommendedBundles(remote_manifest):
- return [bundle for bundle in remote_manifest.GetBundles() if
+def _GetRecommendedBundleNames(remote_manifest):
+ return [bundle.name for bundle in remote_manifest.GetBundles() if
bundle.recommended]
@@ -217,15 +217,15 @@ def _UpdateBundle(delegate, bundle, local_manifest):
if repath_dir:
# If repath is specified:
# The files are extracted to nacl_sdk/<bundle.name>_update/<repath>/...
- # The destination directory is nacl_sdk/<repath>/...
+ # The destination directory is nacl_sdk/<bundle.name>/...
rename_from_dir = os.path.join(extract_dir, repath_dir)
- rename_to_dir = repath_dir
else:
# If no repath is specified:
# The files are extracted to nacl_sdk/<bundle.name>_update/...
# The destination directory is nacl_sdk/<bundle.name>/...
rename_from_dir = extract_dir
- rename_to_dir = bundle.name
+
+ rename_to_dir = bundle.name
delegate.ExtractArchive(dest_filename, extract_dir, rename_from_dir,
rename_to_dir)
diff --git a/native_client_sdk/src/build_tools/tests/sdktools_commands_test.py b/native_client_sdk/src/build_tools/tests/sdktools_commands_test.py
index 113ec9d..25c10a0 100755
--- a/native_client_sdk/src/build_tools/tests/sdktools_commands_test.py
+++ b/native_client_sdk/src/build_tools/tests/sdktools_commands_test.py
@@ -222,6 +222,28 @@ class TestCommands(SdkToolsTestCase):
output = self._Run(['update', 'foobar'])
self.assertTrue('unknown bundle' in output)
+ def testUpdateRecommended(self):
+ """The update command should update only recommended bundles when run
+ without args.
+ """
+ bundle = self._AddDummyBundle(self.manifest, 'pepper_26')
+ bundle.recommended = 'yes'
+ self._WriteManifest()
+ output = self._Run(['update'])
+ self.assertTrue(os.path.exists(
+ os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy.txt')))
+
+ def testUpdateCanary(self):
+ """The update command should create the correct directory name for repath'd
+ bundles.
+ """
+ bundle = self._AddDummyBundle(self.manifest, 'pepper_26')
+ bundle.name = 'pepper_canary'
+ self._WriteManifest()
+ output = self._Run(['update'])
+ self.assertTrue(os.path.exists(
+ os.path.join(self.basedir, 'nacl_sdk', 'pepper_canary', 'dummy.txt')))
+
if __name__ == '__main__':
- sys.exit(unittest.main())
+ unittest.main()