Skip to content

Commit ace9066

Browse files
committed
Download the rustup installer as well
1 parent f420838 commit ace9066

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

local/rustup.sh

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ for target in "${DOWNLOAD_TARGETS[@]}"; do
5858
fi
5959
done
6060

61+
if ! mc stat "local/rustup-builds/${commit}/rustup-init.sh" >/dev/null 2>&1; then
62+
echo "==> copying rustup-init.sh from S3"
63+
64+
if curl -Lo /tmp/component "${DOWNLOAD_BASE}/${commit}/rustup-init.sh" --fail; then
65+
mc cp /tmp/component "local/rustup-builds/${commit}/rustup-init.sh" >/dev/null
66+
fi
67+
else
68+
echo "==> reusing cached rustup-init.sh"
69+
fi
70+
6171
# Build the promote-release binary if it hasn't been pre-built
6272
if [[ ! -f "/src/target/release/promote-release" ]]; then
6373
echo "==> building promote-release"

src/rustup.rs

+25
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ impl Context {
7272
// Promote the artifacts to the release bucket
7373
self.promote_rustup_artifacts(&dist_dir)?;
7474

75+
// Update the `rustup` installer
76+
self.update_rustup_installer(&dist_dir)?;
77+
7578
// Update the release number
7679
self.update_rustup_release(&version)?;
7780

@@ -187,6 +190,28 @@ impl Context {
187190
.arg(&release_bucket_url))
188191
}
189192

193+
fn update_rustup_installer(&mut self, dist_dir: &Path) -> Result<(), Error> {
194+
println!("Updating the rustup installer...");
195+
196+
let release_bucket_url = format!(
197+
"s3://{}/{}",
198+
self.config.upload_bucket, self.config.upload_dir,
199+
);
200+
201+
let destinations = ["rustup-init.sh", "rustup.sh"];
202+
203+
for destination in destinations {
204+
run(self
205+
.aws_s3()
206+
.arg("cp")
207+
.arg("--only-show-errors")
208+
.arg(format!("{}/rustup-init.sh", dist_dir.display()))
209+
.arg(format!("{}/{}", release_bucket_url, destination)))?;
210+
}
211+
212+
Ok(())
213+
}
214+
190215
fn upload_rustup_artifacts(&mut self, dist_dir: &Path, target_path: &str) -> Result<(), Error> {
191216
run(self
192217
.aws_s3()

0 commit comments

Comments
 (0)