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: http://src.chromium.org/svn/trunk/src/build@84863 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
8a73e6529c
Коммит
f5ce2338af
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче