From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect-rust:master commit in: /
Date: Mon, 11 Mar 2019 05:02:44 +0000 (UTC) [thread overview]
Message-ID: <1552280076.99577f8e98440da176709b6e4b988b40ae42b8d1.whissi@gentoo> (raw)
commit: 99577f8e98440da176709b6e4b988b40ae42b8d1
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 00:42:52 2019 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 04:54:36 2019 +0000
URL: https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=99577f8e
Add and make use of find_missing_broken_symlinks()
dev-lang/rust or dev-lang/rust-bin install more than one binary (program),
just checking for "rustc" is not enough.
In addition, set of installed programs depends on USE flags.
This new (internal) function will check for all provided programs.
Bug: https://bugs.gentoo.org/671182
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
rust.eselect.in | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/rust.eselect.in b/rust.eselect.in
index 02f7b75..d0f3361 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -10,6 +10,28 @@ BIN_DIR="${EROOT%/}/usr/bin"
inherit package-manager path-manipulation
+# find a list of missing or broken symlinks
+# each compiler installs a list of provided programs.
+# this function checks if a symlink for a provided program
+# is missing or broken for the current active Rust implementation
+find_missing_broken_symlinks() {
+ local -a missing_symlinks
+ local required_symlinks=( "/usr/bin/rustc" $(get_last_set_symlinks) )
+
+ for i in "${required_symlinks[@]}"; do
+ local symlink="${EROOT%/}${i}"
+
+ if [[ -L "${symlink}" && -e "${symlink}" ]]; then
+ # existing symlink
+ continue
+ else
+ missing_symlinks+=( "${symlink}" )
+ fi
+ done
+
+ echo "${missing_symlinks[@]}"
+}
+
# find a list of installed rust compilers
# each compiler provider should install
# a config file named provider-$pkgname-$pkgver
@@ -219,8 +241,13 @@ do_update() {
shift
done
- if [[ "${if_unset}" == "1" && -f "${BIN_DIR}/rustc" ]]; then
- return
+ if [[ "${if_unset}" == "1" ]]; then
+ local missing_symlinks=( $(find_missing_broken_symlinks) )
+ if [[ ${#missing_symlinks[@]} -eq 0 ]]; then
+ return
+ else
+ echo "Not all symlinks set. Will switch to the most recent Rust compiler!"
+ fi
fi
local targets=( $(find_targets) )
@@ -251,8 +278,13 @@ do_unset() {
shift
done
- if [[ "${if_invalid}" == "1" && -e "${BIN_DIR}/rustc" ]]; then
- return
+ if [[ "${if_invalid}" == "1" ]]; then
+ local missing_symlinks=( $(find_missing_broken_symlinks) )
+ if [[ ${#missing_symlinks[@]} -eq 0 ]]; then
+ return
+ else
+ echo "Not all symlinks set. Will unset current symlinked Rust binaries!"
+ fi
fi
unset_version || die -q "Couldn't unset active version"
next reply other threads:[~2019-03-11 5:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 5:02 Thomas Deutschmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-03-11 5:02 [gentoo-commits] proj/eselect-rust:master commit in: / Thomas Deutschmann
2019-03-11 5:02 Thomas Deutschmann
2019-03-11 5:02 Thomas Deutschmann
2019-03-11 5:02 Thomas Deutschmann
2019-03-11 5:02 Thomas Deutschmann
2019-03-11 5:02 Thomas Deutschmann
2020-01-01 22:05 Thomas Deutschmann
2020-01-01 22:25 Thomas Deutschmann
2020-01-01 22:25 Thomas Deutschmann
2020-04-19 1:21 Thomas Deutschmann
2020-04-19 1:21 Thomas Deutschmann
2020-04-19 1:21 Thomas Deutschmann
2021-07-03 7:49 Georgy Yakovlev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1552280076.99577f8e98440da176709b6e4b988b40ae42b8d1.whissi@gentoo \
--to=whissi@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox