111
111
RUST_BUILD_DIR = os .path .join (RUST_SRC_DIR , 'build' )
112
112
RUST_BOOTSTRAP_DIST_RS = os .path .join (RUST_SRC_DIR , 'src' , 'bootstrap' ,
113
113
'dist.rs' )
114
- STAGE0_JSON_PATH = os .path .join (RUST_SRC_DIR , 'src' , 'stage0.json ' )
114
+ STAGE0_JSON_PATH = os .path .join (RUST_SRC_DIR , 'src' , 'stage0' )
115
115
# Download crates.io dependencies to rust-src subdir (rather than $HOME/.cargo)
116
116
CARGO_HOME_DIR = os .path .join (RUST_SRC_DIR , 'cargo-home' )
117
117
RUST_SRC_VERSION_FILE_PATH = os .path .join (RUST_SRC_DIR , 'src' , 'version' )
@@ -211,7 +211,7 @@ def VerifyStage0JsonHash():
211
211
if actual_hash == STAGE0_JSON_SHA256 :
212
212
return
213
213
214
- print ('src/stage0.json hash is different than expected!' )
214
+ print ('src/stage0 hash is different than expected!' )
215
215
print ('Expected hash: ' + STAGE0_JSON_SHA256 )
216
216
print ('Actual hash: ' + actual_hash )
217
217
sys .exit (1 )
@@ -228,21 +228,23 @@ def FetchBetaPackage(name, rust_git_hash, triple=None):
228
228
triple = triple if triple else RustTargetTriple ()
229
229
filename = f'{ name } -beta-{ triple } '
230
230
231
- # Pull the stage0 JSON to find the package intended to be used to
232
- # build this version of the Rust compiler.
231
+ # Pull the stage0 to find the package intended to be used to build this
232
+ # version of the Rust compiler.
233
233
STAGE0_JSON_URL = (
234
234
'https://chromium.googlesource.com/external/github.com/'
235
- 'rust-lang/rust/+/{GIT_HASH}/src/stage0.json ?format=TEXT' )
235
+ 'rust-lang/rust/+/{GIT_HASH}/src/stage0?format=TEXT' )
236
236
base64_text = urllib .request .urlopen (
237
237
STAGE0_JSON_URL .format (GIT_HASH = rust_git_hash )).read ().decode ("utf-8" )
238
- stage0 = json .loads (base64 .b64decode (base64_text ))
238
+ stage0 = base64 .b64decode (base64_text ).decode ("utf-8" )
239
+ lines = stage0 .splitlines ()
239
240
240
- # The stage0 JSON contains the path to all tarballs it uses binaries from.
241
- for k in stage0 ['checksums_sha256' ].keys ():
242
- if k .endswith (filename + '.tar.gz' ):
243
- package_tgz = k
241
+ # The stage0 file contains the path to all tarballs it uses binaries from.
242
+ for l in lines :
243
+ if l .startswith ('dist_server=' ):
244
+ server = l .split ('=' )[1 ]
245
+ if (filename + '.tar.gz' ) in l :
246
+ package_tgz = l .split ('=' )[0 ]
244
247
245
- server = stage0 ['config' ]['dist_server' ]
246
248
DownloadAndUnpack (f'{ server } /{ package_tgz } ' , LLVM_BUILD_TOOLS_DIR )
247
249
return os .path .join (LLVM_BUILD_TOOLS_DIR , filename )
248
250
0 commit comments