Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: tools/clang/scripts/upload_revision.py

Issue 2324553003: Try to get clang upload script working on Windows. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This script takes a Clang revision as an argument, it then 6 """This script takes a Clang revision as an argument, it then
7 creates a feature branch, puts this revision into update.py, uploads 7 creates a feature branch, puts this revision into update.py, uploads
8 a CL, triggers Clang Upload try bots, and tells what to do next""" 8 a CL, triggers Clang Upload try bots, and tells what to do next"""
9 9
10 import argparse 10 import argparse
(...skipping 21 matching lines...) Expand all
32 content, count=1) 32 content, count=1)
33 content = re.sub("CLANG_SUB_REVISION=[0-9]+", 33 content = re.sub("CLANG_SUB_REVISION=[0-9]+",
34 "CLANG_SUB_REVISION={}".format(clang_sub_revision), 34 "CLANG_SUB_REVISION={}".format(clang_sub_revision),
35 content, count=1) 35 content, count=1)
36 with open(UPDATE_PY_PATH, 'w') as f: 36 with open(UPDATE_PY_PATH, 'w') as f:
37 f.write(content) 37 f.write(content)
38 return clang_old_revision 38 return clang_old_revision
39 39
40 40
41 def Git(args): 41 def Git(args):
42 subprocess.check_call(["git"] + args) 42 is_win = sys.platform.startswith('win32')
scottmg 2016/09/07 22:00:45 Maybe make is_win (or IS_WIN) a global.
Nico 2016/09/07 22:01:53 Done.
43 # Needs shell=True on Windows due to gn.bat in depot_tools.
scottmg 2016/09/07 22:00:45 ...due to git.bat...
Nico 2016/09/07 22:01:53 Done.
44 subprocess.check_call(["git"] + args, shell=is_win)
43 45
44 def main(): 46 def main():
45 parser = argparse.ArgumentParser(description='upload new clang revision') 47 parser = argparse.ArgumentParser(description='upload new clang revision')
46 parser.add_argument('clang_revision', metavar='CLANG_REVISION', 48 parser.add_argument('clang_revision', metavar='CLANG_REVISION',
47 type=int, nargs=1, 49 type=int, nargs=1,
48 help='Clang revision to build the toolchain for.') 50 help='Clang revision to build the toolchain for.')
49 parser.add_argument('clang_sub_revision', metavar='CLANG_SUB_REVISION', 51 parser.add_argument('clang_sub_revision', metavar='CLANG_SUB_REVISION',
50 type=int, nargs='?', default=1, 52 type=int, nargs='?', default=1,
51 help='Clang sub-revision to build the toolchain for.') 53 help='Clang sub-revision to build the toolchain for.')
52 54
53 args = parser.parse_args() 55 args = parser.parse_args()
54 56
55 clang_revision = args.clang_revision[0] 57 clang_revision = args.clang_revision[0]
56 clang_sub_revision = args.clang_sub_revision 58 clang_sub_revision = args.clang_sub_revision
59 is_win = sys.platform.startswith('win32')
60 # Needs shell=True on Windows due to gn.bat in depot_tools.
57 git_revision = subprocess.check_output( 61 git_revision = subprocess.check_output(
58 ["git", "rev-parse", "origin/master"]).strip() 62 ["git", "rev-parse", "origin/master"], shell=is_win).strip()
59 print "Making a patch for Clang revision r{}-{}".format( 63 print "Making a patch for Clang revision r{}-{}".format(
60 clang_revision, clang_sub_revision) 64 clang_revision, clang_sub_revision)
61 print "Chrome revision: {}".format(git_revision) 65 print "Chrome revision: {}".format(git_revision)
62 clang_old_revision = PatchRevision(clang_revision, clang_sub_revision) 66 clang_old_revision = PatchRevision(clang_revision, clang_sub_revision)
63 67
64 Git(["checkout", "-b", "clang-{}-{}".format( 68 Git(["checkout", "-b", "clang-{}-{}".format(
65 clang_revision, clang_sub_revision)]) 69 clang_revision, clang_sub_revision)])
66 Git(["add", UPDATE_PY_PATH]) 70 Git(["add", UPDATE_PY_PATH])
67 71
68 commit_message = 'Ran `{}`.'.format(' '.join(sys.argv)) 72 commit_message = 'Ran `{}`.'.format(' '.join(sys.argv))
69 Git(["commit", "-m", "Roll clang {}:{}.\n\n{}".format( 73 Git(["commit", "-m", "Roll clang {}:{}.\n\n{}".format(
70 clang_old_revision, clang_revision, commit_message)]) 74 clang_old_revision, clang_revision, commit_message)])
71 75
72 Git(["cl", "upload"]) 76 Git(["cl", "upload"])
73 Git(["cl", "try", "-b", "linux_upload_clang", "-r", git_revision]) 77 Git(["cl", "try", "-b", "linux_upload_clang", "-r", git_revision])
74 Git(["cl", "try", "-b", "mac_upload_clang", "-r", git_revision]) 78 Git(["cl", "try", "-b", "mac_upload_clang", "-r", git_revision])
75 Git(["cl", "try", "-b", "win_upload_clang", "-r", git_revision]) 79 Git(["cl", "try", "-b", "win_upload_clang", "-r", git_revision])
76 80
77 print ("Please, wait until the try bots succeeded " 81 print ("Please, wait until the try bots succeeded "
78 "and then push the binaries to goma.") 82 "and then push the binaries to goma.")
79 83
80 if __name__ == '__main__': 84 if __name__ == '__main__':
81 sys.exit(main()) 85 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698