public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
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: <1552280084.47ad9a4eeb74a053d1fbc854fca7d13c96fb1a5b.whissi@gentoo> (raw)

commit:     47ad9a4eeb74a053d1fbc854fca7d13c96fb1a5b
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 01:11:16 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 11 04:54:44 2019 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=47ad9a4e

Add cleanup action

Cleanup action will make use of new find_missing_broken_symlinks() function
and should be called by ebuild during package removal.

If we detect a missing or broken symlink, we will automatically mark latest
available version as default (which will basically fix missing or broken
symlinks).

Bug: https://bugs.gentoo.org/671182
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 rust.eselect.in | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/rust.eselect.in b/rust.eselect.in
index d0f3361..1360dc2 100644
--- a/rust.eselect.in
+++ b/rust.eselect.in
@@ -177,6 +177,33 @@ set_version() {
 	    die -q "symlink list copying failed"
 }
 
+### cleanup action ###
+describe_cleanup() {
+	echo "This action is not to be called manually."
+}
+
+do_cleanup() {
+	[[ -z ${@} ]] || die -q "This function does not expect any arguments"
+
+	# Do we need to clean up?
+	local missing_symlinks=( $(find_missing_broken_symlinks) )
+	if [[ ${#missing_symlinks[@]} -eq 0 ]]; then
+		echo "Nothing to clean up."
+		return
+	fi
+
+	unset_version
+
+	local targets=( $(find_targets) )
+
+	if [[ ${#targets[@]} -ne 0 ]]; then
+		echo "Marking the latest still installed version as default..."
+		do_set ${#targets[@]}
+	else
+		echo "No Rust profiles left on the system. Stale symlinks removed."
+	fi
+}
+
 ### list action ###
 
 describe_list() {


             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 --
2021-07-03  7:49 [gentoo-commits] proj/eselect-rust:master commit in: / Georgy Yakovlev
2020-04-19  1:21 Thomas Deutschmann
2020-04-19  1:21 Thomas Deutschmann
2020-04-19  1:21 Thomas Deutschmann
2020-01-01 22:25 Thomas Deutschmann
2020-01-01 22:25 Thomas Deutschmann
2020-01-01 22:05 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
2019-03-11  5:02 Thomas Deutschmann

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=1552280084.47ad9a4eeb74a053d1fbc854fca7d13c96fb1a5b.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