Skip to content

Commit f5e7d92

Browse files
committed
rustbuild: Update Cargo download location
I updated the beta compiler used to bootstrap the master branch in #38438 with the intention of fixing Travis OSX linkage issues but I mistakenly forgot that the PR only updated rustc, not Cargo itself. Cargo has a new release process with downloads in a different location, so this commit updates rustbuild to download from this new location by tracking revisions instead of Cargo nightly dates.
1 parent 94ae2a2 commit f5e7d92

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/bootstrap/bootstrap.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def verify(path, sha_path, verbose):
8181
with open(path, "rb") as f:
8282
found = hashlib.sha256(f.read()).hexdigest()
8383
with open(sha_path, "r") as f:
84-
expected, _ = f.readline().split()
84+
expected = f.readline().split()[0]
8585
verified = found == expected
8686
if not verified:
8787
print("invalid checksum:\n"
@@ -146,7 +146,7 @@ class RustBuild(object):
146146
def download_stage0(self):
147147
cache_dst = os.path.join(self.build_dir, "cache")
148148
rustc_cache = os.path.join(cache_dst, self.stage0_rustc_date())
149-
cargo_cache = os.path.join(cache_dst, self.stage0_cargo_date())
149+
cargo_cache = os.path.join(cache_dst, self.stage0_cargo_rev())
150150
if not os.path.exists(rustc_cache):
151151
os.makedirs(rustc_cache)
152152
if not os.path.exists(cargo_cache):
@@ -179,21 +179,17 @@ def download_stage0(self):
179179
if self.cargo().startswith(self.bin_root()) and \
180180
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
181181
self.print_what_it_means_to_bootstrap()
182-
channel = self.stage0_cargo_channel()
183-
filename = "cargo-{}-{}.tar.gz".format(channel, self.build)
184-
url = "https://static.rust-lang.org/cargo-dist/" + self.stage0_cargo_date()
182+
filename = "cargo-nightly-{}.tar.gz".format(self.build)
183+
url = "https://s3.amazonaws.com/rust-lang-ci/cargo-builds/" + self.stage0_cargo_rev()
185184
tarball = os.path.join(cargo_cache, filename)
186185
if not os.path.exists(tarball):
187186
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
188187
unpack(tarball, self.bin_root(), match="cargo", verbose=self.verbose)
189188
with open(self.cargo_stamp(), 'w') as f:
190-
f.write(self.stage0_cargo_date())
189+
f.write(self.stage0_cargo_rev())
191190

192-
def stage0_cargo_date(self):
193-
return self._cargo_date
194-
195-
def stage0_cargo_channel(self):
196-
return self._cargo_channel
191+
def stage0_cargo_rev(self):
192+
return self._cargo_rev
197193

198194
def stage0_rustc_date(self):
199195
return self._rustc_date
@@ -217,7 +213,7 @@ def cargo_out_of_date(self):
217213
if not os.path.exists(self.cargo_stamp()) or self.clean:
218214
return True
219215
with open(self.cargo_stamp(), 'r') as f:
220-
return self.stage0_cargo_date() != f.read()
216+
return self.stage0_cargo_rev() != f.read()
221217

222218
def bin_root(self):
223219
return os.path.join(self.build_dir, self.build, "stage0")
@@ -469,7 +465,7 @@ def main():
469465

470466
data = stage0_data(rb.rust_root)
471467
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
472-
rb._cargo_channel, rb._cargo_date = data['cargo'].split('-', 1)
468+
rb._cargo_rev = data['cargo']
473469

474470
start_time = time()
475471

src/stage0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# released on `$date`
1414

1515
rustc: beta-2016-12-16
16-
cargo: nightly-2016-11-16
16+
cargo: fbeea902d2c9a5be6d99cc35681565d8f7832592

0 commit comments

Comments
 (0)