summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Yakovlev <gyakovlev@gentoo.org>2022-09-23 20:03:59 -0700
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2022-09-23 21:13:19 -0700
commitd83b20802b8b432ee79c666c772c60f07ae2424c (patch)
tree681c9e17c156317b65d5484f19481b2b1e7d0cc1 /dev-util
parentdev-util/rustup: drop 1.24.3 (diff)
downloadgentoo-d83b20802b8b432ee79c666c772c60f07ae2424c.tar.gz
gentoo-d83b20802b8b432ee79c666c772c60f07ae2424c.tar.bz2
gentoo-d83b20802b8b432ee79c666c772c60f07ae2424c.zip
dev-util/rustup: revbump, add rust-analyzer, add unsymlink support
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'dev-util')
-rw-r--r--dev-util/rustup/files/symlink_rustup.sh63
-rw-r--r--dev-util/rustup/rustup-1.25.1-r1.ebuild (renamed from dev-util/rustup/rustup-1.25.1.ebuild)0
2 files changed, 51 insertions, 12 deletions
diff --git a/dev-util/rustup/files/symlink_rustup.sh b/dev-util/rustup/files/symlink_rustup.sh
index 743072b8f96c..8ab6608686fc 100644
--- a/dev-util/rustup/files/symlink_rustup.sh
+++ b/dev-util/rustup/files/symlink_rustup.sh
@@ -3,13 +3,13 @@
set -euo pipefail
IFS=$'\n\t'
-SYMLINK_RUSTUP_VERSION="0.0.3"
-
+SYMLINK_RUSTUP_VERSION="0.0.4"
+binpath="@GENTOO_PORTAGE_EPREFIX@/usr/bin/rustup-init"
: "${CARGO_HOME:=${HOME}/.cargo}"
: "${RUSTUP_HOME:=${HOME}/.rustup}"
-__err_exists="already exists, remove and re-run the script"
+__err_exists="already exists, try using -u|--unsymlink option first"
# dies with optional message
die() {
@@ -38,23 +38,43 @@ help() {
echo " ${CARGO_HOME}"
echo
echo "Options:"
- echo " -a, --apply Apply changes (required)"
+ echo " -s, --symlink Setup rustup symlinks in ${CARGO_HOME}/bin"
echo " -C, --nocolor Disable colored output"
echo " -d, --debug Debug mode (sets -x shell option)"
echo " -V, --version Print version number"
+ echo " -u, --unsymlink Remove rustup symlinks from ${CARGO_HOME}/bin"
echo " -q, --quiet Quiet mode"
} # help()
symlink_rustup() {
- local binpath gentoo_rust tool tools=(
- cargo{,-clippy,-fmt,-miri}
- clippy-driver
+ local gentoo_rust tool
+ # rustup calls those proxies
+ # src/lib.rs TOOLS
+ local tools=(
+ rustc
+ rustdoc
+ cargo
+ rust-lldb
+ rust-gdb
+ rust-gdbgui
rls
- rust{c,doc,fmt,-gdb,-lldb,up}
+ cargo-clippy
+ clippy-driver
+ cargo-miri
)
- binpath="@GENTOO_PORTAGE_EPREFIX@/usr/bin/rustup-init"
+ # src/lib.rs DUP_TOOLS
+ # those can be installed via cargo and not with rust itself
+ local dup_tools=(
+ rust-analyzer
+ rustfmt
+ cargo-fmt
+ )
+
+ # we need rustup symlink too, so add it to final list
+ tools+=( "${dup_tools[@]}" rustup )
+
gentoo_rust="$(eselect --brief rust show 2>/dev/null)"
mkdir -p "${CARGO_HOME}/bin" || die
@@ -78,15 +98,32 @@ symlink_rustup() {
good "rustup selfupdate is disabled, it will be updated by portage"
} # symlink_rustup()
+unsymlink_rustup() {
+ local symlinks
+ IFS= mapfile -d '' symlinks < <(find -L "${CARGO_HOME}/bin" \
+ -samefile "${binpath}" -print0 )
+ if [[ "${symlinks-}" ]]; then
+ rm -v "${symlinks[@]}" || die
+ else
+ die "already clean"
+ fi
+}
main(){
[[ "$EUID" -eq 0 ]] && die "Running as root is not supported"
local me
me="$(basename "${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}")"
+
+ local symlink=no
+ local unsymlink=no
+
while [[ ${#} -gt 0 ]]; do
case ${1} in
- -a|--apply)
- APPLY=true
+ -s|--symlink)
+ symlink=yes
+ ;;
+ -u|--unsymlink)
+ unsymlink=yes
;;
-h|--help)
help
@@ -112,8 +149,10 @@ main(){
esac
shift
done
- if [[ ${APPLY:-false} == true ]]; then
+ if [[ ${symlink} == yes ]]; then
symlink_rustup
+ elif [[ ${unsymlink} == yes ]]; then
+ unsymlink_rustup
else
help
fi
diff --git a/dev-util/rustup/rustup-1.25.1.ebuild b/dev-util/rustup/rustup-1.25.1-r1.ebuild
index 5f76d5206991..5f76d5206991 100644
--- a/dev-util/rustup/rustup-1.25.1.ebuild
+++ b/dev-util/rustup/rustup-1.25.1-r1.ebuild