Skip to content

Commit d9bfcda

Browse files
chbaker0Aravind Vasudevan
authored andcommitted
Update Rust revision
Includes Rust change to fix LLVM/Rust incompatibility Fixed: 1361327 Change-Id: I25ce65f6eec91bf024c9fbf6a63be91590b13180 No-Tree-Checks: true Cq-Include-Trybots: luci.chromium.try:android-rust-arm-dbg,android-rust-arm-rel,linux-rust-x64-dbg,linux-rust-x64-rel Change-Id: I25ce65f6eec91bf024c9fbf6a63be91590b13180 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3891693 Reviewed-by: Adrian Taylor <[email protected]> Commit-Queue: Collin Baker <[email protected]> Cr-Commit-Position: refs/heads/main@{#1047589} NOKEYCHECK=True GitOrigin-RevId: 65e24952d88818f71a661c9039f84587bd5bbeb4
1 parent 1630591 commit d9bfcda

File tree

3 files changed

+35
-21
lines changed

3 files changed

+35
-21
lines changed

build_rust.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656

5757
from update_rust import (CHROMIUM_DIR, RUST_REVISION, RUST_SUB_REVISION,
5858
RUST_TOOLCHAIN_OUT_DIR, STAGE0_JSON_SHA256,
59-
THIRD_PARTY_DIR, VERSION_STAMP_PATH, GetPackageVersion)
59+
THIRD_PARTY_DIR, VERSION_STAMP_PATH,
60+
GetPackageVersionForBuild)
6061

6162
RUST_GIT_URL = 'https://github.com/rust-lang/rust/'
6263

@@ -175,7 +176,7 @@ def Configure(llvm_libs_root):
175176
subs = {}
176177
subs['INSTALL_DIR'] = RUST_TOOLCHAIN_OUT_DIR
177178
subs['LLVM_ROOT'] = llvm_libs_root
178-
subs['PACKAGE_VERSION'] = GetPackageVersion()
179+
subs['PACKAGE_VERSION'] = GetPackageVersionForBuild()
179180

180181
# ...and apply substitutions, writing to config.toml in Rust tree.
181182
with open(os.path.join(RUST_SRC_DIR, 'config.toml'), 'w') as output:
@@ -358,7 +359,7 @@ def main():
358359
rust_version = version_file.readline().rstrip()
359360
with open(VERSION_STAMP_PATH, 'w') as stamp:
360361
stamp.write('rustc %s-dev (%s chromium)\n' %
361-
(rust_version, GetPackageVersion()))
362+
(rust_version, GetPackageVersionForBuild()))
362363

363364
return 0
364365

package_rust.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
from build_rust import (RUST_TOOLCHAIN_OUT_DIR, THIRD_PARTY_DIR,
1717
VERSION_STAMP_PATH)
18-
from update_rust import (GetPackageVersion)
18+
from update_rust import (GetPackageVersionForBuild)
1919
from package import (MaybeUpload, TeeCmd)
2020
from update import (CHROMIUM_DIR)
2121

22-
PACKAGE_VERSION = GetPackageVersion()
22+
PACKAGE_VERSION = GetPackageVersionForBuild()
2323
BUILDLOG_NAME = f'rust-buildlog-{PACKAGE_VERSION}.txt'
2424
RUST_TOOLCHAIN_PACKAGE_NAME = f'rust-toolchain-{PACKAGE_VERSION}.tgz'
2525

update_rust.py

Lines changed: 29 additions & 16 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 = 'e0dc8d78'
30+
RUST_REVISION = 'abd4d2ef'
3131
RUST_SUB_REVISION = 1
3232

3333
# Trunk on 2022-08-26.
@@ -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-3375-gfed71b04-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-
'd1b934c411fd4f94cc73d4ce3c191d2a7f66a13e0a52f30109c2f4e1d6874c45')
54+
'7ba877972bd98eed652293c16650006967326d9d86d3adae59054c7ba0c41df5')
5555

5656
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
5757
CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..'))
@@ -60,17 +60,29 @@
6060
VERSION_STAMP_PATH = os.path.join(RUST_TOOLCHAIN_OUT_DIR, 'VERSION')
6161

6262

63-
# Get the target version as specified above.
64-
def GetPackageVersion():
65-
if FALLBACK_CLANG_VERSION:
66-
clang_version = FALLBACK_CLANG_VERSION
67-
else:
68-
from update import (CLANG_REVISION, CLANG_SUB_REVISION)
69-
clang_version = f'{CLANG_REVISION}-{CLANG_SUB_REVISION}'
63+
# Get the package version for the RUST_[SUB_]REVISION above with the specified
64+
# clang_version.
65+
def GetPackageVersion(clang_version):
7066
# TODO(lukasza): Include CRUBIT_REVISION and CRUBIT_SUB_REVISION once we
7167
# include Crubit binaries in the generated package. See also a TODO comment
7268
# in BuildCrubit in package_rust.py.
73-
return '%s-%s-%s' % (RUST_REVISION, RUST_SUB_REVISION, clang_version)
69+
return f'{RUST_REVISION}-{RUST_SUB_REVISION}-{clang_version}'
70+
71+
72+
# Package version built in build_rust.py, which is always built against the
73+
# latest Clang and never uses the FALLBACK_CLANG_VERSION.
74+
def GetPackageVersionForBuild():
75+
from update import (CLANG_REVISION, CLANG_SUB_REVISION)
76+
return GetPackageVersion(f'{CLANG_REVISION}-{CLANG_SUB_REVISION}')
77+
78+
79+
# Package version for download, which may differ from GetUploadPackageVersion()
80+
# if FALLBACK_CLANG_VERSION is set.
81+
def GetDownloadPackageVersion():
82+
if FALLBACK_CLANG_VERSION:
83+
return GetPackageVersion(FALLBACK_CLANG_VERSION)
84+
else:
85+
return GetPackageVersionForBuild()
7486

7587

7688
# Get the version of the toolchain package we already have.
@@ -102,7 +114,7 @@ def main():
102114
return 0
103115

104116
if args.print_package_version:
105-
print(GetPackageVersion())
117+
print(GetDownloadPackageVersion())
106118
return 0
107119

108120
from update import (DownloadAndUnpack, GetDefaultHostOs,
@@ -114,15 +126,16 @@ def main():
114126
# versions of the same rustlibs. build/rust/std/find_std_rlibs.py chokes in
115127
# this case.
116128
if os.path.exists(RUST_TOOLCHAIN_OUT_DIR):
117-
if GetPackageVersion() == GetStampVersion():
129+
if GetDownloadPackageVersion() == GetStampVersion():
118130
return 0
119131

120132
if os.path.exists(RUST_TOOLCHAIN_OUT_DIR):
121133
shutil.rmtree(RUST_TOOLCHAIN_OUT_DIR)
122134

123135
try:
124-
url = '%srust-toolchain-%s.tgz' % (GetPlatformUrlPrefix(
125-
GetDefaultHostOs()), GetPackageVersion())
136+
platform_prefix = GetPlatformUrlPrefix(GetDefaultHostOs())
137+
version = GetDownloadPackageVersion()
138+
url = f'{platform_prefix}rust-toolchain-{version}.tgz'
126139
DownloadAndUnpack(url, THIRD_PARTY_DIR)
127140
except urllib.error.HTTPError as e:
128141
# Fail softly for now. This can happen if a Rust package was not
@@ -133,7 +146,7 @@ def main():
133146
print(f'warning: could not download Rust package')
134147

135148
# Ensure the newly extracted package has the correct version.
136-
assert GetPackageVersion() == GetStampVersion()
149+
assert GetDownloadPackageVersion() == GetStampVersion()
137150

138151

139152
if __name__ == '__main__':

0 commit comments

Comments
 (0)