|
65 | 65 | STAGE0_JSON_PATH = os.path.join(RUST_SRC_DIR, 'src', 'stage0.json')
|
66 | 66 | # Download crates.io dependencies to rust-src subdir (rather than $HOME/.cargo)
|
67 | 67 | CARGO_HOME_DIR = os.path.join(RUST_SRC_DIR, 'cargo-home')
|
68 |
| -RUST_SRC_VERSION_FILE_PATH = os.path.join(RUST_SRC_DIR, 'src', 'version') |
| 68 | +RUST_SRC_VERSION_FILE_PATH = os.path.join(RUST_SRC_DIR, 'version') |
| 69 | +RUST_SRC_GIT_COMMIT_INFO_FILE_PATH = os.path.join(RUST_SRC_DIR, |
| 70 | + 'git-commit-info') |
69 | 71 | RUST_TOOLCHAIN_LIB_DIR = os.path.join(RUST_TOOLCHAIN_OUT_DIR, 'lib')
|
70 | 72 | RUST_TOOLCHAIN_SRC_DIST_DIR = os.path.join(RUST_TOOLCHAIN_LIB_DIR, 'rustlib',
|
71 | 73 | 'src', 'rust')
|
@@ -187,6 +189,18 @@ def GetTestArgs():
|
187 | 189 | return args
|
188 | 190 |
|
189 | 191 |
|
| 192 | +def GetVersionStamp(): |
| 193 | + # We must generate a version stamp that contains the expected `rustc |
| 194 | + # --version` output. This contains the Rust release version, git commit data |
| 195 | + # that the nightly tarball was generated from, and chromium-specific package |
| 196 | + # information. |
| 197 | + with open(RUST_SRC_VERSION_FILE_PATH) as version_file: |
| 198 | + rust_version = version_file.readline().rstrip() |
| 199 | + |
| 200 | + return ('rustc %s (%s chromium)\n' % |
| 201 | + (rust_version, GetPackageVersionForBuild())) |
| 202 | + |
| 203 | + |
190 | 204 | def main():
|
191 | 205 | parser = argparse.ArgumentParser(
|
192 | 206 | description='Build and package Rust toolchain')
|
@@ -294,12 +308,8 @@ def main():
|
294 | 308 |
|
295 | 309 | RunXPy('install', DISTRIBUTION_ARTIFACTS, args.gcc_toolchain, args.verbose)
|
296 | 310 |
|
297 |
| - # Write expected `rustc --version` string to our toolchain directory. |
298 |
| - with open(RUST_SRC_VERSION_FILE_PATH) as version_file: |
299 |
| - rust_version = version_file.readline().rstrip() |
300 | 311 | with open(VERSION_STAMP_PATH, 'w') as stamp:
|
301 |
| - stamp.write('rustc %s-dev (%s chromium)\n' % |
302 |
| - (rust_version, GetPackageVersionForBuild())) |
| 312 | + stamp.write(GetVersionStamp()) |
303 | 313 |
|
304 | 314 | return 0
|
305 | 315 |
|
|
0 commit comments