@@ -52,7 +52,7 @@ def get(base, url, path, checksums, verbose=False):
52
52
53
53
try :
54
54
if url not in checksums :
55
- raise RuntimeError (("src/stage0.json doesn't contain a checksum for {}. "
55
+ raise RuntimeError (("src/stage0 doesn't contain a checksum for {}. "
56
56
"Pre-built artifacts might not be available for this "
57
57
"target at this time, see https://doc.rust-lang.org/nightly"
58
58
"/rustc/platform-support.html for more information." )
@@ -421,9 +421,9 @@ def output(filepath):
421
421
422
422
423
423
class Stage0Toolchain :
424
- def __init__ (self , stage0_payload ):
425
- self .date = stage0_payload [ " date" ]
426
- self .version = stage0_payload [ " version" ]
424
+ def __init__ (self , date , version ):
425
+ self .date = date
426
+ self .version = version
427
427
428
428
def channel (self ):
429
429
return self .version + "-" + self .date
@@ -439,7 +439,7 @@ def __init__(
439
439
bin_root ,
440
440
tarball_path ,
441
441
tarball_suffix ,
442
- checksums_sha256 ,
442
+ stage0_data ,
443
443
pattern ,
444
444
verbose ,
445
445
):
@@ -448,7 +448,7 @@ def __init__(
448
448
self .bin_root = bin_root
449
449
self .tarball_path = tarball_path
450
450
self .tarball_suffix = tarball_suffix
451
- self .checksums_sha256 = checksums_sha256
451
+ self .stage0_data = stage0_data
452
452
self .pattern = pattern
453
453
self .verbose = verbose
454
454
@@ -458,7 +458,7 @@ def download_component(download_info):
458
458
download_info .base_download_url ,
459
459
download_info .download_path ,
460
460
download_info .tarball_path ,
461
- download_info .checksums_sha256 ,
461
+ download_info .stage0_data ,
462
462
verbose = download_info .verbose ,
463
463
)
464
464
@@ -510,11 +510,9 @@ def __init__(self, config_toml="", args=None):
510
510
build_dir = args .build_dir or self .get_toml ('build-dir' , 'build' ) or 'build'
511
511
self .build_dir = os .path .abspath (build_dir )
512
512
513
- with open (os .path .join (self .rust_root , "src" , "stage0.json" )) as f :
514
- data = json .load (f )
515
- self .checksums_sha256 = data ["checksums_sha256" ]
516
- self .stage0_compiler = Stage0Toolchain (data ["compiler" ])
517
- self .download_url = os .getenv ("RUSTUP_DIST_SERVER" ) or data ["config" ]["dist_server" ]
513
+ self .stage0_data = parse_stage0_file (os .path .join (self .rust_root , "src" , "stage0" ))
514
+ self .stage0_compiler = Stage0Toolchain (self .stage0_data ["compiler_date" ], self .stage0_data ["compiler_version" ])
515
+ self .download_url = os .getenv ("RUSTUP_DIST_SERVER" ) or self .stage0_data ["dist_server" ]
518
516
519
517
self .build = args .build or self .build_triple ()
520
518
@@ -581,7 +579,7 @@ def download_toolchain(self):
581
579
bin_root = self .bin_root (),
582
580
tarball_path = os .path .join (rustc_cache , filename ),
583
581
tarball_suffix = tarball_suffix ,
584
- checksums_sha256 = self .checksums_sha256 ,
582
+ stage0_data = self .stage0_data ,
585
583
pattern = pattern ,
586
584
verbose = self .verbose ,
587
585
)
@@ -1071,6 +1069,16 @@ def parse_args(args):
1071
1069
1072
1070
return parser .parse_known_args (args )[0 ]
1073
1071
1072
+ def parse_stage0_file (path ):
1073
+ result = {}
1074
+ with open (path , 'r' ) as file :
1075
+ for line in file :
1076
+ line = line .strip ()
1077
+ if line and not line .startswith ('#' ):
1078
+ key , value = line .split ('=' , 1 )
1079
+ result [key .strip ()] = value .strip ()
1080
+ return result
1081
+
1074
1082
def bootstrap (args ):
1075
1083
"""Configure, fetch, build and run the initial bootstrap"""
1076
1084
rust_root = os .path .abspath (os .path .join (__file__ , '../../..' ))
0 commit comments