| OLD | NEW |
| 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 Loading... |
| 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. |
| 32 subprocess.check_output( |
| 33 "git fetch origin +refs/tags/*:refs/tags/*", |
| 34 shell=True, |
| 35 cwd=CWD) |
| 31 tag = subprocess.check_output( | 36 tag = subprocess.check_output( |
| 32 "git describe --tags", | 37 "git describe --tags", |
| 33 shell=True, | 38 shell=True, |
| 34 cwd=CWD, | 39 cwd=CWD, |
| 35 ).strip() | 40 ).strip() |
| 36 assert tag | 41 assert tag |
| 37 | 42 |
| 38 # Check for commits not exactly matching a tag. Those are candidate builds | 43 # Check for commits not exactly matching a tag. Those are candidate builds |
| 39 # for the next version. The output has the form | 44 # for the next version. The output has the form |
| 40 # <tag name>-<n commits>-<hash>. | 45 # <tag name>-<n commits>-<hash>. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 with open(VERSION_GEN_CC, "w") as f: | 114 with open(VERSION_GEN_CC, "w") as f: |
| 110 f.write(version_file_content) | 115 f.write(version_file_content) |
| 111 # Log what was calculated. | 116 # Log what was calculated. |
| 112 print log_message | 117 print log_message |
| 113 | 118 |
| 114 return 0 | 119 return 0 |
| 115 | 120 |
| 116 | 121 |
| 117 if __name__ == "__main__": | 122 if __name__ == "__main__": |
| 118 sys.exit(main()) | 123 sys.exit(main()) |
| OLD | NEW |