From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-662174-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 5B7CF138247
	for <garchives@archives.gentoo.org>; Wed, 22 Jan 2014 10:09:53 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B2C50E10BC;
	Wed, 22 Jan 2014 10:09:41 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 843AFE10AA
	for <gentoo-commits@lists.gentoo.org>; Wed, 22 Jan 2014 10:09:40 +0000 (UTC)
Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id D583133FB0F
	for <gentoo-commits@lists.gentoo.org>; Wed, 22 Jan 2014 10:09:38 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by spoonbill.gentoo.org (Postfix) with ESMTP id B69F3187BC
	for <gentoo-commits@lists.gentoo.org>; Wed, 22 Jan 2014 10:09:36 +0000 (UTC)
From: "Reinis Danne" <rei4dan@gmail.com>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Reinis Danne" <rei4dan@gmail.com>
Message-ID: <1390334121.5a4baf2fc4f4a1610069e0dafa85ec39aeca8496.rei4dan@gentoo>
Subject: [gentoo-commits] proj/sci:master commit in: eclass/
X-VCS-Repository: proj/sci
X-VCS-Files: eclass/alternatives-2.eclass
X-VCS-Directories: eclass/
X-VCS-Committer: rei4dan
X-VCS-Committer-Name: Reinis Danne
X-VCS-Revision: 5a4baf2fc4f4a1610069e0dafa85ec39aeca8496
X-VCS-Branch: master
Date: Wed, 22 Jan 2014 10:09:36 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: da88d4d8-c1dc-4571-b9b6-1ab5a6c98002
X-Archives-Hash: eb2e5500da59453725b90fc626175c42

commit:     5a4baf2fc4f4a1610069e0dafa85ec39aeca8496
Author:     Reinis Danne <rei4dan <AT> gmail <DOT> com>
AuthorDate: Mon Jan 20 17:14:18 2014 +0000
Commit:     Reinis Danne <rei4dan <AT> gmail <DOT> com>
CommitDate: Tue Jan 21 19:55:21 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=5a4baf2f

alternatives-2.eclass: Minor comment changes

---
 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 bc60108..132620e 100644
--- a/eclass/alternatives-2.eclass
+++ b/eclass/alternatives-2.eclass
@@ -61,22 +61,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
@@ -92,6 +96,7 @@ alternatives_for() {
 		done
 	fi
 
+	# Process source-target pairs
 	while (( $# >= 2 )); do
 		src=${1//+(\/)/\/}; target=${2//+(\/)/\/}
 		if [[ ${src} != /* ]]; then
@@ -111,8 +116,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}
@@ -126,6 +132,7 @@ alternatives_for() {
 		shift 2
 	done
 
+	# Stop if there were any errors
 	[[ ${ret} -eq 0 ]] || die "Errors detected for ${provider}, provided for ${alternative}"
 }