summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorthakis <thakis@chromium.org>2016-03-11 09:27:16 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-11 17:28:24 +0000
commit78833b819ffbf199141d45d4ed19681a7c6f6651 (patch)
treec9e3d6f73a85e68e8121aca102ce55161fd0069a /tools
parentc2259434b670a21088d0096a783b508ec30eccdd (diff)
downloadchromium_src-78833b819ffbf199141d45d4ed19681a7c6f6651.zip
chromium_src-78833b819ffbf199141d45d4ed19681a7c6f6651.tar.gz
chromium_src-78833b819ffbf199141d45d4ed19681a7c6f6651.tar.bz2
Automatically download gnu win tools from update.py
I put a small zip (1.6MB) on GCS containing just the gnu tools (from GNUWin32) that are required by LLVM's check-all target. If more are needed in the future, we'll need to push a new zip file to GCS with the new tools. This seems better than downloading the full 182MB gnuwin tools from the script. BUG=578306 Review URL: https://codereview.chromium.org/1781113002 Cr-Commit-Position: refs/heads/master@{#380661}
Diffstat (limited to 'tools')
-rwxr-xr-xtools/clang/scripts/package.py7
-rwxr-xr-xtools/clang/scripts/update.py29
2 files changed, 24 insertions, 12 deletions
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py
index 944acee..63ab1a9 100755
--- a/tools/clang/scripts/package.py
+++ b/tools/clang/scripts/package.py
@@ -110,13 +110,6 @@ def MaybeUpload(args, archive_name, platform):
def main():
- if sys.platform == 'win32':
- try:
- subprocess.check_output(['grep', '--help'], shell=True)
- except subprocess.CalledProcessError:
- print 'Add gnuwin32 to your PATH, then try again.'
- return 1
-
parser = argparse.ArgumentParser(description='build and package clang')
parser.add_argument('--upload', action='store_true',
help='Upload the target archive to Google Cloud Storage.')
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
index e3fa1b1..b005520 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -136,19 +136,19 @@ def DownloadAndUnpack(url, output_dir):
tarfile.open(mode='r:gz', fileobj=f).extractall(path=output_dir)
-def ReadStampFile():
+def ReadStampFile(path=STAMP_FILE):
"""Return the contents of the stamp file, or '' if it doesn't exist."""
try:
- with open(STAMP_FILE, 'r') as f:
+ with open(path, 'r') as f:
return f.read().rstrip()
except IOError:
return ''
-def WriteStampFile(s):
+def WriteStampFile(s, path=STAMP_FILE):
"""Write s to the stamp file."""
- EnsureDirExists(os.path.dirname(STAMP_FILE))
- with open(STAMP_FILE, 'w') as f:
+ EnsureDirExists(os.path.dirname(path))
+ with open(path, 'w') as f:
f.write(s)
f.write('\n')
@@ -305,6 +305,24 @@ def AddCMakeToPath():
os.environ['PATH'] = cmake_dir + os.pathsep + os.environ.get('PATH', '')
+def AddGnuWinToPath():
+ """Download some GNU win tools and add them to PATH."""
+ if sys.platform != 'win32':
+ return
+
+ gnuwin_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gnuwin')
+ GNUWIN_VERSION = '1'
+ GNUWIN_STAMP = os.path.join(gnuwin_dir, 'stamp')
+ if ReadStampFile(GNUWIN_STAMP) == GNUWIN_VERSION:
+ print 'GNU Win tools already up to date.'
+ else:
+ zip_name = 'gnuwin-%s.zip' % GNUWIN_VERSION
+ DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR)
+ WriteStampFile(GNUWIN_VERSION, GNUWIN_STAMP)
+
+ os.environ['PATH'] = gnuwin_dir + os.pathsep + os.environ.get('PATH', '')
+
+
vs_version = None
def GetVSVersion():
global vs_version
@@ -381,6 +399,7 @@ def UpdateClang(args):
DownloadHostGcc(args)
AddCMakeToPath()
+ AddGnuWinToPath()
DeleteChromeToolsShim()