Skip to content

freeze used rustup version to 1.27.1, don't self-update rustup #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion examples/docs-builder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rustwide::cmd::SandboxImage;
use rustwide::{cmd::SandboxBuilder, Crate, Toolchain, WorkspaceBuilder};
use std::error::Error;
use std::path::Path;
Expand All @@ -7,7 +8,11 @@ fn main() -> Result<(), Box<dyn Error>> {

// Create a new workspace in .workspaces/docs-builder
let workspace =
WorkspaceBuilder::new(Path::new(".workspaces/docs-builder"), "rustwide-examples").init()?;
WorkspaceBuilder::new(Path::new(".workspaces/docs-builder"), "rustwide-examples")
.sandbox_image(SandboxImage::remote(
"ghcr.io/rust-lang/crates-build-env/linux-micro",
)?)
.init()?;

// Run the builds on stable
let toolchain = Toolchain::dist("stable");
Expand Down
1 change: 1 addition & 0 deletions src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl DistToolchain {
self.name(),
"--profile",
workspace.rustup_profile(),
"--no-self-update",
])
.run()
.with_context(|| format!("unable to install toolchain {} via rustup", self.name()))?;
Expand Down
19 changes: 9 additions & 10 deletions src/tools/rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use std::fs::{self, File};
use std::io;
use tempfile::tempdir;

static RUSTUP_BASE_URL: &str = "https://static.rust-lang.org/rustup/dist";
// we're using an old version of rustup, since rustup 1.28 is broken for rustwide for now.
// We'll try to either fix rustup, or adapt rustwide to fix this, until then, we'll use this version.
// see https://github.com/rust-lang/rustup/issues/4224
static RUSTUP_VERSION: &str = "1.27.1";

pub(crate) struct Rustup;

Expand Down Expand Up @@ -37,10 +40,10 @@ impl Tool for Rustup {
fs::create_dir_all(workspace.rustup_home())?;

let url = format!(
"{}/{}/rustup-init{}",
RUSTUP_BASE_URL,
crate::HOST_TARGET,
EXE_SUFFIX
"https://static.rust-lang.org/rustup/archive/{version}/{target}/rustup-init{exe_suffix}",
version = RUSTUP_VERSION,
target = crate::HOST_TARGET,
exe_suffix = EXE_SUFFIX
);
let mut resp = workspace
.http_client()
Expand Down Expand Up @@ -75,11 +78,7 @@ impl Tool for Rustup {

fn update(&self, workspace: &Workspace, _fast_install: bool) -> anyhow::Result<()> {
Command::new(workspace, &RUSTUP)
.args(&["self", "update"])
.run()
.context("failed to update rustup")?;
Command::new(workspace, &RUSTUP)
.args(&["update", MAIN_TOOLCHAIN_NAME])
.args(&["update", MAIN_TOOLCHAIN_NAME, "--no-self-update"])
.run()
.with_context(|| format!("failed to update main toolchain {}", MAIN_TOOLCHAIN_NAME))?;
Ok(())
Expand Down
3 changes: 3 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ pub(crate) fn file_lock<T>(
}

let res = std::panic::catch_unwind(f);
#[allow(unstable_name_collisions)]
// the method is coming from the `fs2` crate
// https://github.com/danburkert/fs2-rs/issues/50
let _ = file.unlock();

match res {
Expand Down