public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Aaron Swenson" <titanofold@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pgsql-patches:eselect commit in: /
Date: Sun, 27 Mar 2011 13:28:36 +0000 (UTC)	[thread overview]
Message-ID: <6de301e7951636e194ef95dbe90b9a0f9afdb459.titanofold@gentoo> (raw)

commit:     6de301e7951636e194ef95dbe90b9a0f9afdb459
Author:     Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 13:27:48 2011 +0000
Commit:     Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sun Mar 27 13:27:48 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pgsql-patches.git;a=commit;h=6de301e7

Cleaned up output and localized variables.

---
 postgresql.eselect |   47 +++++++++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/postgresql.eselect b/postgresql.eselect
index 8e4a63a..9a7e0c5 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -83,8 +83,10 @@ do_list() {
 	if $(is_output_mode brief) ; then
 		echo $(get_slots)
 	else
+		local slot
 		for slot in $(get_slots) ; do
 			local postgres_ebuilds=""
+			local src
 			for src in ${E_PATH}/slots/${slot}/{server,service,base,docs} ; do
 				[ -r ${src} ] && source ${src}
 			done
@@ -129,14 +131,14 @@ do_set() {
 		die -q "Not a valid slot."
 	fi
 
-	echo -e "\033[1mSetting ${SLOT} as the default installation...\033[0m"
+	echo "Setting ${SLOT} as the default installation..."
 
 	# Remove the active links to start a fresh list
-	printf "\tRemoving old links..."
+	echo -ne "\tRemoving old links..."
 	unlinker ${E_PATH}/active.links
-	echo "Done!"
+	echo "done."
 
-	printf "\tGenerating new links..."
+	echo -ne "\tGenerating new links..."
 	# Sources and targets for header files
 	local sources=(
 		${B_PATH}/include/postgresql-${SLOT}
@@ -153,6 +155,7 @@ do_set() {
 		${B_PATH}/include/postgres_ext.h
 	)
 	# The linker function cannot accomadate this special purpose.
+	local i
 	for (( i=0; $i < ${#sources[@]}; i++ )) ; do
 		# Remove target before creating the symlink
 		rm -f ${targets[$i]}
@@ -165,6 +168,7 @@ do_set() {
 	done
 
 	# Link modules to /usr/lib{,lib32,lib64}/
+	local x
 	for x in ${LIB_LIST} ; do
 		if [ -d ${B_PATH}/${x}/postgresql-${SLOT}/${x} ] ; then
 			# 'linker' function doesn't work for linking directories.
@@ -184,8 +188,8 @@ do_set() {
 	echo ${B_PATH}/share/postgresql >> ${E_PATH}/active.links
 
 	echo ${SLOT} > ${E_PATH}/active
-	echo "Done!"
-	echo -e "\033[1mSetting default successful!\033[0m"
+	echo "done."
+	echo -e "\033[1mSetting ${SLOT} as default was successful!\033[0m"
 }
 
 ### Unset Action ###
@@ -196,10 +200,10 @@ describe_unset() {
 do_unset() {
 	local SLOT=$1
 	if [ "${SLOT}" = "${ACTIVE_SLOT}" ] ; then
-		echo -e "\033[1mUnsetting ${SLOT} as the default installation...\033[0m"
+		echo -n "Unsetting ${SLOT} as the default installation..."
 		unlinker ${E_PATH}/active.links
 		rm -f ${E_PATH}/active
-		echo -e "\033[1mDone!\033[0m"
+		echo "done."
 	else
 		echo "Inactive slot selected. No work to do."
 	fi
@@ -211,7 +215,7 @@ describe_reset() {
 }
 
 do_reset() {
-	[ "${ACTIVE_SLOT}" = "(none)" ] && die -q "No active slot to reset. Set a slot."
+	[ "${ACTIVE_SLOT}" = "(none)" ] && die -q "No active slot to reset."
 	do_unset ${ACTIVE_SLOT}
 	do_set ${ACTIVE_SLOT}
 }
@@ -236,7 +240,7 @@ do_update() {
 		write_warning_msg "Removing files (Control-C to abort) in..."
 		local i=6
 		while [ $[i--] -gt 0 ] ; do
-			printf " $i"
+			echo -n " $i"
 			sleep 1
 		done
 		for sym_links in ${E_PATH}/active.links* ; do
@@ -258,34 +262,37 @@ do_update() {
 		do_set ${slots[$index-1]}
 	fi
 
-	# Clean out the cruft
-	printf "Removing old links..."
+	echo -en "\nCleaning out old links before refreshing..."
+	local sym_links
 	for sym_links in ${E_PATH}/active.links?* ; do
 		unlinker ${sym_links}
 	done
-	echo "Done!"
+	echo "done."
 
 	# Update paths to libs and docs
 	local ldpath
+	local x
 	for x in ${LIB_LIST} ; do
-		ldpath+="${B_PATH}/${x}/postgresql:"
+		[ -h ${B_PATH}/${x}/postgresql ] && ldpath+="${B_PATH}/${x}/postgresql:"
 	done
 	ldpath="${ldpath%:}"
 	local manpath="${B_PATH}/share/postgresql/"
 	while [ $[--index] -gt -1 ] ; do
-		echo -e "\n\033[1mGenerating symbolic links for ${slots[$index]} applications...\033[0m"
+		local curslot="${slots[$index]}"
+		echo -n "Refreshing symbolic links for ${curslot} applications (like /usr/bin/psql${curslot//.})..."
 		for x in ${LIB_LIST} ; do
-			local lib_path="${B_PATH}/${x}/postgresql-${slots[$index]}/${x}/"
+			local lib_path="${B_PATH}/${x}/postgresql-${curslot}/${x}/"
 			[ -d ${lib_path} ] && ldpath+=":${lib_path}"
 		done
-		local share_path="${B_PATH}/share/postgresql-${slots[$index]}/"
+		local share_path="${B_PATH}/share/postgresql-${curslot}/"
 		[ -d ${share_path} ] && manpath+=":${share_path}"
-		linker "${B_PATH}/${LIBDIR}/postgresql-${slots[$index]}/bin/*" "${B_PATH}/bin" "${slots[$index]//.}"
-		echo -e "\033[1mDone!\033[0m"
+		linker "${B_PATH}/${LIBDIR}/postgresql-${curslot}/bin/*" "${B_PATH}/bin" "${curslot//.}"
+		echo "done."
 	done
 
-	# Remove bad environment files that have been generated by the ebuilds
+	# Remove environment files that have been generated by the ebuilds
 	rm -f ${ENV_FILE}-*
+
 	store_config ${ENV_FILE} LDPATH "${ldpath}"
 	store_config ${ENV_FILE} MANPATH "${manpath}"
 	do_action env update &> /dev/null



             reply	other threads:[~2011-03-27 13:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27 13:28 Aaron Swenson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-11-21 11:38 [gentoo-commits] proj/pgsql-patches:eselect commit in: / Aaron Swenson
2013-11-21 11:19 Aaron Swenson
2013-07-27 21:42 Aaron Swenson
2013-07-27 21:34 Aaron Swenson
2013-07-13 14:06 Aaron Swenson
2013-06-13 10:33 Aaron Swenson
2013-02-08 12:35 Aaron Swenson
2013-02-03 13:35 Aaron Swenson
2012-02-22 11:43 Aaron Swenson
2011-04-26 21:46 Aaron Swenson
2011-04-26 21:46 Aaron Swenson
2011-04-24 13:18 Aaron Swenson
2011-04-22 10:45 Aaron Swenson
2011-04-22 10:27 Aaron Swenson
2011-04-22 10:08 Aaron Swenson
2011-04-21 23:30 Aaron Swenson
2011-04-21 23:27 Aaron Swenson
2011-04-19  0:45 Aaron Swenson
2011-04-14 11:52 Aaron Swenson
2011-04-02 11:24 Aaron Swenson
2011-04-01 11:51 Aaron Swenson
2011-04-01 11:49 Aaron Swenson
2011-04-01 11:43 Aaron Swenson
2011-04-01 11:14 Aaron Swenson
2011-03-29 19:34 Aaron Swenson
2011-03-29 19:34 Aaron Swenson
2011-03-26  2:13 Aaron Swenson
2011-03-24 22:41 Aaron Swenson
2011-03-22  3:07 Aaron Swenson

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=6de301e7951636e194ef95dbe90b9a0f9afdb459.titanofold@gentoo \
    --to=titanofold@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