public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Mueller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: /
Date: Fri, 22 Jun 2012 17:29:22 +0000 (UTC)	[thread overview]
Message-ID: <1181063309.8a68ceeb005bd83efada18e686fc10640b849297.ulm@gentoo> (raw)

commit:     8a68ceeb005bd83efada18e686fc10640b849297
Author:     Christian Faulhammer <opfer <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  5 17:08:29 2007 +0000
Commit:     Ulrich Mueller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Jun  5 17:08:29 2007 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=8a68ceeb

	* added an additional die for remove_symlinks() in set_symlinks()

	* rephrased output in do_set() and do_update()

	* rewrote parts do_set() in such a way that an invalid target does
	not cause an undefined state.  An invalid target was checked after
	the symlinks were deleted and then not setting a new target

svn path=/emacs-extra/eselect-emacs/; revision=367

---
 emacs.eselect |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/emacs.eselect b/emacs.eselect
index 335c2c8..4c0ac9d 100644
--- a/emacs.eselect
+++ b/emacs.eselect
@@ -67,7 +67,7 @@ set_bin_symlinks() {
 		# set symlink only if target binary actually exists
 		if [[ -f "${ROOT}/usr/bin/${f}-${target}" ]]; then
 			ln -s "${f}-${target}" "${ROOT}/usr/bin/${f}" ||
-				die "Couldn't set ${f}-${target} /usr/bin/${f} symlink"
+				die "Couldn't set ${f}-${target} ${ROOT}/usr/bin/${f} symlink"
 		fi
 	done
 }
@@ -104,12 +104,12 @@ set_symlinks() {
 		|| die -q "Target \"${1}\" doesn't appear to be valid!"
 
 	echo "Switching to ${target} ..."
-	remove_symlinks
+	remove_symlinks || die -q "Couldn't remove existing symlink"
 	# the main /usr/bin/emacs symlink is only set for Emacs binaries
 	# (but not for other providers of auxiliary programs, e.g., XEmacs)
 	if [[ ${target} == emacs-* ]]; then
 		ln -s "${target}" "${ROOT}/usr/bin/emacs" \
-			|| die "Couldn't set ${target} /usr/bin/emacs symlink"
+			|| die "Couldn't set ${target} ${ROOT}/usr/bin/emacs symlink"
 	fi
 	set_bin_symlinks "${target}"
 	set_man_symlinks "${target}"
@@ -205,10 +205,8 @@ do_set() {
 	[[ -n "${2}" ]] && die -q "Too many parameters"
 	test_for_root
 
-	if [[ -L "${ROOT}/usr/bin/emacs" ]]; then
-		remove_symlinks || die -q "Couldn't remove existing symlink"
-	elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then
-		die -q "Sorry, ${ROOT}/usr/bin/emacs exists and is not a symlink"
+	if [[ -e "${ROOT}/usr/bin/emacs" ]] && ! [[ -L "${ROOT}/usr/bin/emacs" ]]; then
+		die -q "Sorry, ${ROOT}/usr/bin/emacs exists but is not a symlink"
 	fi
 
 	set_symlinks "${1}" || die -q "Couldn't set a new symlink"
@@ -234,7 +232,7 @@ do_update() {
 			&& -e "$(canonicalise ${ROOT}/usr/bin/emacs)" ]] && return
 		remove_symlinks || die -q "Couldn't remove existing symlink"
 	elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then
-		die -q "Sorry, ${ROOT}/usr/bin/emacs exists and is not a symlink"
+		die -q "Sorry, ${ROOT}/usr/bin/emacs exists but is not a symlink"
 	fi
 
 	local targets=( $(find_targets) )



             reply	other threads:[~2012-06-22 17:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 17:29 Ulrich Mueller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-22 17:29 [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: / Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller

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=1181063309.8a68ceeb005bd83efada18e686fc10640b849297.ulm@gentoo \
    --to=ulm@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