public inbox for gentoo-science@lists.gentoo.org
 help / color / mirror / Atom feed
From: Reinis Danne <rei4dan@gmail.com>
To: gentoo-science@lists.gentoo.org
Subject: [gentoo-science] [PATCH 09/10] alternatives-2.eclass: Minor comment changes
Date: Mon, 20 Jan 2014 19:53:11 +0200	[thread overview]
Message-ID: <1390240392-12173-10-git-send-email-rei4dan@gmail.com> (raw)
In-Reply-To: <1390240392-12173-1-git-send-email-rei4dan@gmail.com>

---
 eclass/alternatives-2.eclass | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
index e15edfa..d9896f1 100644
--- a/eclass/alternatives-2.eclass
+++ b/eclass/alternatives-2.eclass
@@ -57,22 +57,26 @@ alternatives_for() {
 	local alternative=${1} provider=${2} importance=${3} index src target ret=0
 	shift 3
 
-	# make sure importance is a signed integer
+	# Make sure importance is a signed integer
 	if [[ -n ${importance} ]] && ! [[ ${importance} =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
 		eerror "Invalid importance (${importance}) detected"
 		((ret++))
 	fi
 
+	# Create alternative provider subdirectories under ALTERNATIVES_DIR if needed
 	[[ -d "${ED}${ALTERNATIVES_DIR}/${alternative}/${provider}" ]] || dodir "${ALTERNATIVES_DIR}/${alternative}/${provider}"
 
-	# keep track of provided alternatives for use in pkg_{postinst,prerm}. keep a mapping between importance and
-	# provided alternatives and make sure the former is set to only one value
+	# Keep track of provided alternatives for use in pkg_{postinst,prerm}.
+	# Keep a mapping between importance and provided alternatives
+	# and make sure the former is set to only one value.
 	if ! has "${alternative}:${provider}" "${ALTERNATIVES_PROVIDED[@]}"; then
+		# Add new provider and set its importance
 		index=${#ALTERNATIVES_PROVIDED[@]}
 		ALTERNATIVES_PROVIDED+=( "${alternative}:${provider}" )
 		ALTERNATIVES_IMPORTANCE[index]=${importance}
 		[[ -n ${importance} ]] && echo "${importance}" > "${ED}${ALTERNATIVES_DIR}/${alternative}/${provider}/_importance"
 	else
+		# Set importance for existing provider
 		for((index=0;index<${#ALTERNATIVES_PROVIDED[@]};index++)); do
 			if [[ ${alternative}:${provider} == ${ALTERNATIVES_PROVIDED[index]} ]]; then
 				if [[ -n ${ALTERNATIVES_IMPORTANCE[index]} ]]; then
@@ -88,6 +92,7 @@ alternatives_for() {
 		done
 	fi
 
+	# Process source-target pairs
 	while (( $# >= 2 )); do
 		src=${1//+(\/)/\/}; target=${2//+(\/)/\/}
 		if [[ ${src} != /* ]]; then
@@ -107,8 +112,9 @@ alternatives_for() {
 			dodir "${ALTERNATIVES_DIR}/${alternative}/${provider}${src%/*}"
 			dosym "${reltarget}" "${ALTERNATIVES_DIR}/${alternative}/${provider}${src}"
 
-			# say ${ED}/sbin/init exists and links to /bin/systemd (which doesn't exist yet)
-			# the -e test will fail, so check for -L also
+			# The -e test will fail if existing symlink points to non-existing target,
+			# so check for -L also.
+			# Say ${ED}/sbin/init exists and links to /bin/systemd (which doesn't exist yet).
 			if [[ -e ${ED}${src} || -L ${ED}${src} ]]; then
 				local fulltarget=${target}
 				[[ ${fulltarget} != /* ]] && fulltarget=${src%/*}/${fulltarget}
@@ -122,6 +128,7 @@ alternatives_for() {
 		shift 2
 	done
 
+	# Stop if there were any errors
 	[[ ${ret} -eq 0 ]] || die "Errors detected for ${provider}, provided for ${alternative}"
 }
 
-- 
1.8.5.3



  parent reply	other threads:[~2014-01-20 17:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 17:53 [gentoo-science] [PATCH 00/10] alternatives-2.eclass updates Reinis Danne
2014-01-20 17:53 ` [gentoo-science] [PATCH 01/10] alternatives-2.eclass: Update copyright Reinis Danne
2014-01-20 17:53 ` [gentoo-science] [PATCH 02/10] alternatives-2.eclass: Remove unused variables Reinis Danne
2014-01-20 17:53 ` [gentoo-science] [PATCH 03/10] alternatives-2.eclass: Move EXPORT_FUNCTIONS to top Reinis Danne
2014-01-20 17:53 ` [gentoo-science] [PATCH 04/10] alternatives-2.eclass: Remove commented-out code Reinis Danne
2014-01-20 17:53 ` [gentoo-science] [PATCH 05/10] alternatives-2.eclass: Put commonly used path in local variable Reinis Danne
2014-01-20 17:53 ` [gentoo-science] [PATCH 06/10] alternatives-2.eclass: Fix eclass name in comments Reinis Danne
2014-01-20 17:53 ` [gentoo-science] [PATCH 07/10] alternatives-2.eclass: Add EAPI check Reinis Danne
2014-01-20 17:53 ` [gentoo-science] [PATCH 08/10] alternatives-2.eclass: Add documentation comments Reinis Danne
2014-01-20 17:53 ` Reinis Danne [this message]
2014-01-20 17:53 ` [gentoo-science] [PATCH 10/10] alternatives-2.eclass: Use consistent quoting Reinis Danne
2014-01-21  6:51 ` [gentoo-science] [PATCH 00/10] alternatives-2.eclass updates justin
2014-01-21 18:32   ` Reinis Danne
2014-01-21 17:04 ` Sébastien Fabbro
2014-01-21 19:26   ` Reinis Danne
2014-01-21 20:04     ` Sébastien Fabbro
2014-01-21 20:35       ` François Bissey
2014-01-21 21:30       ` Reinis Danne
2014-01-21 22:46         ` Sébastien Fabbro
2014-01-22  7:13           ` justin
2014-01-21 21:21   ` justin
2014-01-21 21:26     ` François Bissey

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=1390240392-12173-10-git-send-email-rei4dan@gmail.com \
    --to=rei4dan@gmail.com \
    --cc=gentoo-science@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