void-packages/srcpkgs/rustup/patches/0001-Symlink-rustup-instead...

46 lines
1.5 KiB
Diff

From e512f8222fddecf23552ed490f71cc3c444abc53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?=
<jan.christian@gruenhage.xyz>
Date: Tue, 12 Jul 2022 08:16:08 +0200
Subject: [PATCH] Symlink rustup instead of copying it
To make sure that we can update rustup using xbps, we need to symlink
rustup into $CARGO_HOME/bin instead of copying it.
Upstream doesn't want the patch as it is right now.
---
src/cli/self_update.rs | 3 +--
src/utils/utils.rs | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs
index a4c00d57..82a4d67a 100644
--- a/src/cli/self_update.rs
+++ b/src/cli/self_update.rs
@@ -729,8 +729,7 @@ fn install_bins() -> Result<()> {
if rustup_path.exists() {
utils::remove_file("rustup-bin", &rustup_path)?;
}
- utils::copy_file(&this_exe_path, &rustup_path)?;
- utils::make_executable(&rustup_path)?;
+ utils::symlink_file(&this_exe_path, &rustup_path)?;
install_proxies()
}
diff --git a/src/utils/utils.rs b/src/utils/utils.rs
index 0362372b..9e5a5fe2 100644
--- a/src/utils/utils.rs
+++ b/src/utils/utils.rs
@@ -306,7 +306,7 @@ pub fn hardlink_file(src: &Path, dest: &Path) -> Result<()> {
}
#[cfg(unix)]
-fn symlink_file(src: &Path, dest: &Path) -> Result<()> {
+pub(crate) fn symlink_file(src: &Path, dest: &Path) -> Result<()> {
std::os::unix::fs::symlink(src, dest).with_context(|| RustupError::LinkingFile {
src: PathBuf::from(src),
dest: PathBuf::from(dest),
--
2.37.0