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

Side by Side Diff: build/generate_version.py

Issue 856323002: Restrict tag-update for version generation to cached git repos. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 2014 the V8 project authors. All rights reserved. 2 # Copyright 2014 the V8 project 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 """ 6 """
7 Script to set v8's version file to the version given by the latest tag. 7 Script to set v8's version file to the version given by the latest tag.
8 8
9 The script is intended to be run as a gclient hook. The script will write a 9 The script is intended to be run as a gclient hook. The script will write a
10 generated version file into the checkout. 10 generated version file into the checkout.
(...skipping 10 matching lines...) Expand all
21 import subprocess 21 import subprocess
22 import sys 22 import sys
23 23
24 24
25 CWD = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) 25 CWD = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
26 VERSION_CC = os.path.join(CWD, "src", "version.cc") 26 VERSION_CC = os.path.join(CWD, "src", "version.cc")
27 VERSION_GEN_CC = os.path.join(CWD, "src", "version_gen.cc") 27 VERSION_GEN_CC = os.path.join(CWD, "src", "version_gen.cc")
28 28
29 29
30 def generate_version_file(): 30 def generate_version_file():
31 # Make sure the tags are fetched. 31 # Make sure the tags are fetched from cached git repos.
32 subprocess.check_output( 32 url = subprocess.check_output(
33 "git fetch origin +refs/tags/*:refs/tags/*", 33 "git config --get remote.origin.url",
34 shell=True, 34 shell=True,
35 cwd=CWD) 35 cwd=CWD).strip()
36 if not url.startswith("http"):
37 subprocess.check_output(
38 "git fetch origin +refs/tags/*:refs/tags/*",
39 shell=True,
40 cwd=CWD)
36 tag = subprocess.check_output( 41 tag = subprocess.check_output(
37 "git describe --tags", 42 "git describe --tags",
38 shell=True, 43 shell=True,
39 cwd=CWD, 44 cwd=CWD,
40 ).strip() 45 ).strip()
41 assert tag 46 assert tag
42 47
43 # Check for commits not exactly matching a tag. Those are candidate builds 48 # Check for commits not exactly matching a tag. Those are candidate builds
44 # for the next version. The output has the form 49 # for the next version. The output has the form
45 # <tag name>-<n commits>-<hash>. 50 # <tag name>-<n commits>-<hash>.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 with open(VERSION_GEN_CC, "w") as f: 119 with open(VERSION_GEN_CC, "w") as f:
115 f.write(version_file_content) 120 f.write(version_file_content)
116 # Log what was calculated. 121 # Log what was calculated.
117 print log_message 122 print log_message
118 123
119 return 0 124 return 0
120 125
121 126
122 if __name__ == "__main__": 127 if __name__ == "__main__":
123 sys.exit(main()) 128 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