public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] emacs r1272 - eselect-emacs
@ 2009-05-07 17:32 Ulrich Mueller (ulm)
  0 siblings, 0 replies; only message in thread
From: Ulrich Mueller (ulm) @ 2009-05-07 17:32 UTC (permalink / raw
  To: gentoo-commits

Author: ulm
Date: 2009-05-07 17:32:29 +0000 (Thu, 07 May 2009)
New Revision: 1272

Modified:
   eselect-emacs/ChangeLog
   eselect-emacs/ctags.eselect
   eselect-emacs/emacs.eselect
Log:
Call the ctags module also in the case when option "ifunset" was specified, bug 268064.

Modified: eselect-emacs/ChangeLog
===================================================================
--- eselect-emacs/ChangeLog	2009-05-07 16:57:15 UTC (rev 1271)
+++ eselect-emacs/ChangeLog	2009-05-07 17:32:29 UTC (rev 1272)
@@ -1,5 +1,10 @@
 2009-05-07  Ulrich Mueller  <ulm@gentoo.org>
 
+	* ctags.eselect (do_update, describe_update_options): Support new
+	option "ifunset" with the same meaning as for the emacs module.
+	* emacs.eselect (do_update): Call the ctags module also in the
+	case when option "ifunset" was specified, bug 268064.
+
 	* ctags.eselect (find_targets, do_show, do_update):
 	* emacs.eselect (do_show, do_update): "canonicalise" is not
 	necessary since "test -e" resolves symbolic links.

Modified: eselect-emacs/ctags.eselect
===================================================================
--- eselect-emacs/ctags.eselect	2009-05-07 16:57:15 UTC (rev 1271)
+++ eselect-emacs/ctags.eselect	2009-05-07 17:32:29 UTC (rev 1272)
@@ -191,44 +191,53 @@
 	echo "Automatically update the ${CTAGS} symlink"
 }
 
+describe_update_options() {
+	echo "ifunset : Do not override currently set version"
+}
+
 do_update() {
-	[[ -z $1 || $1 = norecursion ]] || die -q "Usage error"
-	[[ $# -gt 1 ]] && die -q "Too many parameters"
+	[[ -z $1 || $1 = ifunset || $1 = --if-unset ]] || die -q "Usage error"
+	[[ -z $2 || $2 = norecursion ]] || die -q "Usage error"
+	[[ $# -gt 2 ]] && die -q "Too many parameters"
 	test_for_root
 
-	local current=""
-	if [[ -L ${ROOT}${bindir}/${CTAGS} ]]; then
-		current=$(basename "$(readlink "${ROOT}${bindir}/${CTAGS}")")
-		if [[ ! -e ${ROOT}${bindir}/${CTAGS} ]]; then
-			# clean up dead symlinks
-			remove_symlinks || die -q "Couldn't remove existing symlink"
+	if ! [[ $1 == *if*unset \
+		&& -L ${ROOT}${bindir}/${CTAGS} && -e ${ROOT}${bindir}/${CTAGS} ]]
+	then
+		local current=""
+		if [[ -L ${ROOT}${bindir}/${CTAGS} ]]; then
+			current=$(basename "$(readlink "${ROOT}${bindir}/${CTAGS}")")
+			if [[ ! -e ${ROOT}${bindir}/${CTAGS} ]]; then
+				# clean up dead symlinks
+				remove_symlinks || die -q "Couldn't remove existing symlink"
+			fi
+		elif [[ -e ${ROOT}${bindir}/${CTAGS} ]]; then
+			if ! [[ ${CTAGS} = ctags && $(uname) = FreeBSD ]]; then
+				die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink"
+			fi
+			# On FreeBSD ctags is a real file, installed by freebsd-ubin
+			current=nolink
 		fi
-	elif [[ -e ${ROOT}${bindir}/${CTAGS} ]]; then
-		if ! [[ ${CTAGS} = ctags && $(uname) = FreeBSD ]]; then
-			die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink"
-		fi
-		# On FreeBSD ctags is a real file, installed by freebsd-ubin
-		current=nolink
-	fi
 
-	# For an "update" only the version should be changed, but not the
-	# provider (i.e. Emacs vs Exuberant). At the moment only (X)Emacs
-	# offers several concurrent versions.
+		# For an "update" only the version should be changed, but not the
+		# provider (i.e. Emacs vs Exuberant). At the moment only (X)Emacs
+		# offers several concurrent versions.
 
-	local i target targets=( $(find_targets) )
-	if [[ ${#targets[@]} -gt 0 && ${current} != nolink ]]; then
-		target=${targets[0]}
-		[[ ${current} == ${CTAGS}-*emacs* ]] && current=${CTAGS}-*emacs*
-		for i in ${targets[@]}; do
-			[[ ${i} == ${current} ]] && target=${i}
-		done
-		set_symlinks "${target}" || die -q "Couldn't set a new symlink"
+		local i target targets=( $(find_targets) )
+		if [[ ${#targets[@]} -gt 0 && ${current} != nolink ]]; then
+			target=${targets[0]}
+			[[ ${current} == ${CTAGS}-*emacs* ]] && current=${CTAGS}-*emacs*
+			for i in ${targets[@]}; do
+				[[ ${i} == ${current} ]] && target=${i}
+			done
+			set_symlinks "${target}" || die -q "Couldn't set a new symlink"
+		fi
 	fi
 
 	# Call "eselect etags update" from the ctags module and vice versa
-	[[ $1 = norecursion ]] && return
+	[[ $2 = norecursion ]] && return
 	case ${CTAGS} in
-		ctags) CTAGS=etags do_update norecursion ;;
-		etags) CTAGS=ctags do_update norecursion ;;
+		ctags) CTAGS=etags do_update "$1" norecursion ;;
+		etags) CTAGS=ctags do_update "$1" norecursion ;;
 	esac
 }

Modified: eselect-emacs/emacs.eselect
===================================================================
--- eselect-emacs/emacs.eselect	2009-05-07 16:57:15 UTC (rev 1271)
+++ eselect-emacs/emacs.eselect	2009-05-07 17:32:29 UTC (rev 1272)
@@ -246,24 +246,28 @@
 	[[ $# -gt 1 ]] && die -q "Too many parameters"
 	test_for_root
 
-	if [[ -L ${ROOT}${bindir}/emacs ]]; then
-		[[ $1 == *if*unset && -e ${ROOT}${bindir}/emacs ]] && return
-		# this is not redundant: "update" is called in pkg_postrm() of emacs
-		# and should clean up any dead symlinks if no valid target exists
-		remove_symlinks || die -q "Couldn't remove existing symlink"
-	elif [[ -e ${ROOT}${bindir}/emacs ]]; then
-		die -q "${ROOT}${bindir}/emacs exists but is not a symlink"
-	fi
+	if ! [[ $1 == *if*unset \
+		&& -L ${ROOT}${bindir}/emacs && -e ${ROOT}${bindir}/emacs ]]
+	then
+		if [[ -L ${ROOT}${bindir}/emacs ]]; then
+			# this is not redundant: "update" is called in pkg_postrm()
+			# of emacs and should clean up any dead symlinks if no
+			# valid target exists
+			remove_symlinks || die -q "Couldn't remove existing symlink"
+		elif [[ -e ${ROOT}${bindir}/emacs ]]; then
+			die -q "${ROOT}${bindir}/emacs exists but is not a symlink"
+		fi
 
-	local targets=( $(find_targets) )
-	if [[ ${#targets[@]} -gt 0 ]]; then
-		set_symlinks "${targets[${#targets[@]}-1]}" \
-			|| die -q "Couldn't set a new symlink"
-	elif [[ -f ${ROOT}${bindir}/xemacs ]]; then
+		local targets=( $(find_targets) )
+		if [[ ${#targets[@]} -gt 0 ]]; then
+			set_symlinks "${targets[${#targets[@]}-1]}" \
+				|| die -q "Couldn't set a new symlink"
+		elif [[ -f ${ROOT}${bindir}/xemacs ]]; then
 		# no Emacs target found - link to XEmacs versions
-		set_symlinks xemacs nomain
+			set_symlinks xemacs nomain
+		fi
 	fi
 
-	# ctags symlinks are handled in an own module now
-	do_action ctags update
+	# ctags and etags symlinks are handled in an own module
+	do_action ctags update "$@"
 }




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-07 17:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07 17:32 [gentoo-commits] emacs r1272 - eselect-emacs Ulrich Mueller (ulm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox