Move toolchain update control into src, but keep download logic in depot_tools

Moves the update functionality out of update_depot_tools into src/ in https://codereview.chromium.org/175573004 .

get_toolchain_if_required.py now expects a list of hashes on the
command line, and makes sure that it gets one of those.

toolchain2013.py saves a .json which contains information relevant to the
interests of the caller, so that it can set up the parent environment. This
is returned via the --output-json command line argument to get_...py

R=iannucci@chromium.org
BUG=323300

Review URL: https://codereview.chromium.org/168603004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@252725 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
scottmg@chromium.org 12 years ago
parent 998deaf360
commit 5d17b921db

@ -30,13 +30,6 @@ if errorlevel 1 goto :EOF
:: Now clear errorlevel so it can be set by other programs later. :: Now clear errorlevel so it can be set by other programs later.
set errorlevel= set errorlevel=
:: Opt-in for now.
IF "%DEPOT_TOOLS_WIN_TOOLCHAIN%" == "" GOTO :NOTOOLCHAIN
call python %~dp0win_toolchain\get_toolchain_if_necessary.py
if errorlevel 1 goto :EOF
set errorlevel=
:NOTOOLCHAIN
:: Shall skip automatic update? :: Shall skip automatic update?
IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO :EOF

@ -29,7 +29,9 @@ maintained, and a new 2015 script would be added.
import ctypes.wintypes import ctypes.wintypes
import hashlib import hashlib
import json import json
import optparse
import os import os
import shutil
import subprocess import subprocess
import sys import sys
import time import time
@ -145,9 +147,12 @@ def main():
if not sys.platform.startswith(('cygwin', 'win32')): if not sys.platform.startswith(('cygwin', 'win32')):
return 0 return 0
if len(sys.argv) != 1: parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
print >> sys.stderr, 'Unexpected arguments.' parser.add_option('--output-json', metavar='FILE',
return 1 help='write information about toolchain to FILE')
options, args = parser.parse_args()
desired_hashes = set(args)
# Move to depot_tools\win_toolchain where we'll store our files, and where # Move to depot_tools\win_toolchain where we'll store our files, and where
# the downloader script is. # the downloader script is.
@ -155,12 +160,6 @@ def main():
toolchain_dir = '.' toolchain_dir = '.'
target_dir = os.path.normpath(os.path.join(toolchain_dir, 'vs2013_files')) target_dir = os.path.normpath(os.path.join(toolchain_dir, 'vs2013_files'))
sha1path = os.path.join(toolchain_dir, 'toolchain_vs2013.hash')
desired_hashes = set()
if os.path.isfile(sha1path):
with open(sha1path, 'rb') as f:
desired_hashes = set(f.read().strip().splitlines())
# If the current hash doesn't match what we want in the file, nuke and pave. # If the current hash doesn't match what we want in the file, nuke and pave.
# Typically this script is only run when the .sha1 one file is updated, but # Typically this script is only run when the .sha1 one file is updated, but
# directly calling "gclient runhooks" will also run it, so we cache # directly calling "gclient runhooks" will also run it, so we cache
@ -195,6 +194,9 @@ def main():
return 1 return 1
SaveTimestampsAndHash(target_dir, current_hash) SaveTimestampsAndHash(target_dir, current_hash)
if options.output_json:
shutil.copyfile(os.path.join(target_dir, 'data.json'), options.output_json)
return 0 return 0

@ -7,6 +7,7 @@
import ctypes import ctypes
import json
import optparse import optparse
import os import os
import shutil import shutil
@ -456,8 +457,18 @@ def main():
CopyToFinalLocation(extracted, target_dir) CopyToFinalLocation(extracted, target_dir)
GenerateSetEnvCmd(target_dir, not options.express) GenerateSetEnvCmd(target_dir, not options.express)
with open(os.path.join(target_dir, '.version'), 'w') as f: data = {
f.write('express' if options.express else 'pro') 'path': target_dir,
'version': '2013e' if options.express else '2013',
'win8sdk': os.path.join(target_dir, 'win8sdk'),
'wdk': os.path.join(target_dir, 'wdk'),
'runtime_dirs': [
os.path.join(target_dir, 'sys64'),
os.path.join(target_dir, 'sys32'),
],
}
with open(os.path.join(target_dir, 'data.json'), 'w') as f:
json.dump(data, f)
finally: finally:
if options.clean: if options.clean:
DeleteAllTempDirs() DeleteAllTempDirs()

@ -1,2 +0,0 @@
0bbca7f56298c3075b183cd9d11b3529c88ce775
9d48ee27f0d29e02fd89dd5d1d6208bf42fd6e16
Loading…
Cancel
Save