summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2024-02-22 20:22:34 +0200
committerLars Wirzenius <liw@liw.fi>2024-02-24 13:05:12 +0200
commit35d1db067027aee5d11096635b767f317b20547a (patch)
tree9c43cb2771b16196a1171c0a53c6bd899f1ea545
parent6b6719f706c1dec9a9a555e999605f653b532994 (diff)
downloadambient-driver-35d1db067027aee5d11096635b767f317b20547a.tar.gz
feat! drop rustup_setup
It's no longer useful. Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
-rw-r--r--src/action.rs34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/action.rs b/src/action.rs
index 06cae33..8e6f52e 100644
--- a/src/action.rs
+++ b/src/action.rs
@@ -140,7 +140,6 @@ pub enum Action {
Shell {
shell: String,
},
- RustupSetup,
CargoFmt,
CargoClippy,
CargoBuild,
@@ -157,7 +156,6 @@ impl Action {
"tar_extract",
"spawn",
"shell",
- "rustup_setup",
"cargo_fmt",
"cargo_clippy",
"cargo_build",
@@ -175,7 +173,6 @@ impl Action {
Self::TarExtract { archive, directory } => tar_extract(archive, directory),
Self::Spawn { argv } => spawn(argv, &[]),
Self::Shell { shell: snippet } => shell(snippet),
- Self::RustupSetup => rustup_setup(),
Self::CargoFmt => cargo_fmt(),
Self::CargoClippy => cargo_clippy(),
Self::CargoBuild => cargo_build(),
@@ -286,37 +283,6 @@ fn spawn_str(argv: &[&str], extra_env: &[(&str, &str)]) -> Result<(), ActionErro
spawn(&argv, extra_env)
}
-fn rustup_setup() -> Result<(), ActionError> {
- const DIRS: &[&str] = &["/root/.cargo/.package-cache", "/root/.cargo/registry"];
- for dir in DIRS.iter() {
- let dir = Path::new(dir);
- if dir.exists() {
- std::fs::remove_dir_all(dir).map_err(|e| ActionError::RemoveDir(dir.into(), e))?;
- }
- }
-
- const SYMLINKS: &[(&str, &str)] = &[
- (
- "/workspace/deps/.package-cache",
- "/root/.cargo/.package-cache",
- ),
- ("/workspace/deps/registry", "/root/.cargo/registry"),
- ];
- for (tgt, src) in SYMLINKS.iter() {
- std::os::unix::fs::symlink(tgt, src)
- .map_err(|e| ActionError::Symlink(tgt.into(), src.into(), e))?;
- }
-
- const SYSTEM_CARGO: &str = "/usr/bin/cargo";
- const RUSTUP_CARGO: &str = "/root/.cargo/bin/cargo";
- std::fs::remove_file(SYSTEM_CARGO)
- .map_err(|e| ActionError::RemoveFile(SYSTEM_CARGO.into(), e))?;
- std::os::unix::fs::symlink(RUSTUP_CARGO, SYSTEM_CARGO)
- .map_err(|e| ActionError::Symlink(RUSTUP_CARGO.into(), SYSTEM_CARGO.into(), e))?;
-
- Ok(())
-}
-
fn prepend_cargo_bin_dir_to_path() -> String {
let path = std::env::var("PATH").unwrap();
format!("/root/.cargo/bin:{path}")