Skip to content

Commit e9428e8

Browse files
chbaker0Aravind Vasudevan
authored andcommitted
Update Rust revision
Additionally fixes version string handling and changes the build configuration to the nightly channel. Bug: 1379429 Change-Id: Ia1dfcb168eff460bbf27d02c2607b97eeb7795d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3961451 Commit-Queue: Collin Baker <collinbaker@chromium.org> Reviewed-by: Adrian Taylor <adetaylor@chromium.org> Cr-Commit-Position: refs/heads/main@{#1067653} NOKEYCHECK=True GitOrigin-RevId: 7b0c4f5b28278bb824b3aa7c213e2126b79a66a5
1 parent 1d23e98 commit e9428e8

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

build_rust.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@
6565
STAGE0_JSON_PATH = os.path.join(RUST_SRC_DIR, 'src', 'stage0.json')
6666
# Download crates.io dependencies to rust-src subdir (rather than $HOME/.cargo)
6767
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')
6971
RUST_TOOLCHAIN_LIB_DIR = os.path.join(RUST_TOOLCHAIN_OUT_DIR, 'lib')
7072
RUST_TOOLCHAIN_SRC_DIST_DIR = os.path.join(RUST_TOOLCHAIN_LIB_DIR, 'rustlib',
7173
'src', 'rust')
@@ -187,6 +189,18 @@ def GetTestArgs():
187189
return args
188190

189191

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+
190204
def main():
191205
parser = argparse.ArgumentParser(
192206
description='Build and package Rust toolchain')
@@ -294,12 +308,8 @@ def main():
294308

295309
RunXPy('install', DISTRIBUTION_ARTIFACTS, args.gcc_toolchain, args.verbose)
296310

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()
300311
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())
303313

304314
return 0
305315

config.toml.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static-libstdcpp = true
1414

1515
[rust]
1616
download-rustc = false
17-
channel = "dev"
17+
channel = "nightly"
1818
description = "$PACKAGE_VERSION chromium"
1919

2020
[build]

update_rust.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'clang',
2828
'scripts'))
2929

30-
RUST_REVISION = '20220914'
30+
RUST_REVISION = '20221101'
3131
RUST_SUB_REVISION = 1
3232

3333
# Trunk on 2022-10-15.
@@ -45,13 +45,13 @@
4545
# This should almost always be None. When a breakage happens the fallback should
4646
# be temporary. Once fixed, the applicable revision(s) above should be updated
4747
# and FALLBACK_CLANG_VERSION should be reset to None.
48-
FALLBACK_CLANG_VERSION = 'llvmorg-16-init-8697-g60809cd2-1'
48+
FALLBACK_CLANG_VERSION = None
4949

5050
# Hash of src/stage0.json, which itself contains the stage0 toolchain hashes.
5151
# We trust the Rust build system checks, but to ensure it is not tampered with
5252
# itself check the hash.
5353
STAGE0_JSON_SHA256 = (
54-
'7ba877972bd98eed652293c16650006967326d9d86d3adae59054c7ba0c41df5')
54+
'c0909797c1901c32985a40ec6b54b9ccad8464aa5dbebd20235db094fee1a6bc')
5555

5656
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
5757
CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..'))
@@ -90,7 +90,8 @@ def GetStampVersion():
9090
if os.path.exists(RUST_TOOLCHAIN_OUT_DIR):
9191
with open(VERSION_STAMP_PATH) as version_file:
9292
existing_stamp = version_file.readline().rstrip()
93-
version_re = re.compile(r'rustc [0-9.]+-dev \((.+?) chromium\)')
93+
version_re = re.compile(
94+
r'rustc [0-9.]+-nightly \([0-9a-f -]+\) \((.+?) chromium\)')
9495
match = version_re.fullmatch(existing_stamp)
9596
if match is None:
9697
return None

0 commit comments

Comments
 (0)