summaryrefslogtreecommitdiffstats
path: root/build/download_nacl_irt.py
diff options
context:
space:
mode:
authormseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 21:42:58 +0000
committermseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 21:42:58 +0000
commit0ee0d69061488f055a5214dc4548bdcaabb7d271 (patch)
tree8a076281506983e76b47fc17e33fd7f24e9529dc /build/download_nacl_irt.py
parenta07b6c05aae3e1d7dc7d35863eb4ea3c896490e5 (diff)
downloadchromium_src-0ee0d69061488f055a5214dc4548bdcaabb7d271.zip
chromium_src-0ee0d69061488f055a5214dc4548bdcaabb7d271.tar.gz
chromium_src-0ee0d69061488f055a5214dc4548bdcaabb7d271.tar.bz2
NaCl: Allow download_nacl_irt.py to be usefully invoked with no arguments
Extend the script to read the NaCl revisions/hashes directly from DEPS in this case. This makes the script usable in cases where you don't want to run "gclient runhooks", such as when creating a tarball of the checkout, in which case it is not desirable to run Gyp and have it generate makefiles. Admittedly this is redundant, because it adds a second way of getting information from DEPS to the download_nacl_irt.py script. The implementation of EvalDepsFile() is borrowed from: http://src.chromium.org/viewvc/native_client/trunk/src/native_client/build/chromebinaries.py?revision=4577&view=markup BUG=http://bugs.gentoo.org/show_bug.cgi?id=366413 TEST=run "python src/build/download_nacl_irt.py" Review URL: http://codereview.chromium.org/6966010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/download_nacl_irt.py')
-rw-r--r--build/download_nacl_irt.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/build/download_nacl_irt.py b/build/download_nacl_irt.py
index 7149d31..f36d5b2 100644
--- a/build/download_nacl_irt.py
+++ b/build/download_nacl_irt.py
@@ -119,6 +119,12 @@ def DownloadFileWithRetry(dest_path, url):
time.sleep(1)
+def EvalDepsFile(path):
+ scope = {'Var': lambda name: scope['vars'][name]}
+ execfile(path, {}, scope)
+ return scope
+
+
def Main():
parser = optparse.OptionParser()
parser.add_option(
@@ -143,6 +149,18 @@ def Main():
if len(args) != 0:
parser.error('Unexpected arguments: %r' % args)
+ if options.nacl_revision is None and len(options.file_hashes) == 0:
+ # The script must have been invoked directly with no arguments,
+ # rather than being invoked by gclient. In this case, read the
+ # DEPS file ourselves rather than having gclient pass us values
+ # from DEPS.
+ deps_data = EvalDepsFile(os.path.join('src', 'DEPS'))
+ options.nacl_revision = deps_data['vars']['nacl_revision']
+ options.file_hashes = [
+ ('x86_32', deps_data['vars']['nacl_irt_hash_x86_32']),
+ ('x86_64', deps_data['vars']['nacl_irt_hash_x86_64']),
+ ]
+
nacl_dir = os.path.join('src', 'native_client')
if not os.path.exists(nacl_dir):
# If "native_client" is not present, this might be because the