27
27
os .path .join (os .path .dirname (os .path .abspath (__file__ )), '..' , 'clang' ,
28
28
'scripts' ))
29
29
30
- RUST_REVISION = 'e0dc8d78 '
30
+ RUST_REVISION = 'abd4d2ef '
31
31
RUST_SUB_REVISION = 1
32
32
33
33
# Trunk on 2022-08-26.
45
45
# This should almost always be None. When a breakage happens the fallback should
46
46
# be temporary. Once fixed, the applicable revision(s) above should be updated
47
47
# and FALLBACK_CLANG_VERSION should be reset to None.
48
- FALLBACK_CLANG_VERSION = 'llvmorg-16-init-3375-gfed71b04-1'
48
+ FALLBACK_CLANG_VERSION = None
49
49
50
50
# Hash of src/stage0.json, which itself contains the stage0 toolchain hashes.
51
51
# We trust the Rust build system checks, but to ensure it is not tampered with
52
52
# itself check the hash.
53
53
STAGE0_JSON_SHA256 = (
54
- 'd1b934c411fd4f94cc73d4ce3c191d2a7f66a13e0a52f30109c2f4e1d6874c45 ' )
54
+ '7ba877972bd98eed652293c16650006967326d9d86d3adae59054c7ba0c41df5 ' )
55
55
56
56
THIS_DIR = os .path .abspath (os .path .dirname (__file__ ))
57
57
CHROMIUM_DIR = os .path .abspath (os .path .join (THIS_DIR , '..' , '..' ))
60
60
VERSION_STAMP_PATH = os .path .join (RUST_TOOLCHAIN_OUT_DIR , 'VERSION' )
61
61
62
62
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 ):
70
66
# TODO(lukasza): Include CRUBIT_REVISION and CRUBIT_SUB_REVISION once we
71
67
# include Crubit binaries in the generated package. See also a TODO comment
72
68
# 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 ()
74
86
75
87
76
88
# Get the version of the toolchain package we already have.
@@ -102,7 +114,7 @@ def main():
102
114
return 0
103
115
104
116
if args .print_package_version :
105
- print (GetPackageVersion ())
117
+ print (GetDownloadPackageVersion ())
106
118
return 0
107
119
108
120
from update import (DownloadAndUnpack , GetDefaultHostOs ,
@@ -114,15 +126,16 @@ def main():
114
126
# versions of the same rustlibs. build/rust/std/find_std_rlibs.py chokes in
115
127
# this case.
116
128
if os .path .exists (RUST_TOOLCHAIN_OUT_DIR ):
117
- if GetPackageVersion () == GetStampVersion ():
129
+ if GetDownloadPackageVersion () == GetStampVersion ():
118
130
return 0
119
131
120
132
if os .path .exists (RUST_TOOLCHAIN_OUT_DIR ):
121
133
shutil .rmtree (RUST_TOOLCHAIN_OUT_DIR )
122
134
123
135
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'
126
139
DownloadAndUnpack (url , THIRD_PARTY_DIR )
127
140
except urllib .error .HTTPError as e :
128
141
# Fail softly for now. This can happen if a Rust package was not
@@ -133,7 +146,7 @@ def main():
133
146
print (f'warning: could not download Rust package' )
134
147
135
148
# Ensure the newly extracted package has the correct version.
136
- assert GetPackageVersion () == GetStampVersion ()
149
+ assert GetDownloadPackageVersion () == GetStampVersion ()
137
150
138
151
139
152
if __name__ == '__main__' :
0 commit comments