public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope
@ 2017-09-06 23:40 99% Mike Pagano
  0 siblings, 0 replies; 1+ results
From: Mike Pagano @ 2017-09-06 23:40 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 1978 bytes --]

This time, use bash 4.0, but limit the use of this function to ebuild that have EAPI >= 6.
Display a warning for maintainers to upgrade their ebuilds, or remove the call.
Thanks to mgorny for the suggestion.

Signed-off-by: Mike Pagano <mpagano@gentoo.org>
---
 eclass/kernel-2.eclass | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 84909f30c..a80f3e91a 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1407,11 +1407,20 @@ getfilevar() {
 # This function sets ARCH_URI and ARCH_PATCH
 # with the neccessary info for the arch sepecific compatibility
 # patchsets.
+# To use, an ebuild could contain a line like:
+# AMD64_URI=http//linktothearchspecificpatch
+# This function requires EAPI >= 6.
 
 detect_arch() {
 
-	local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
+	if [[ "${EAPI}" -lt 6 ]]; then 
+		eqawarn "ebuild is attempting to call detect_arch when EAPI < 6." 
+		eqawarn "This function will not be executed." 
+		return
+	fi
 
+	local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
+	
 	# COMPAT_URI is the contents of ${ARCH}_URI
 	# ARCH_URI is the URI for all the ${ARCH}_URI patches
 	# ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
@@ -1425,18 +1434,15 @@ detect_arch() {
 		COMPAT_URI="${LOOP_ARCH}_URI"
 		COMPAT_URI="${!COMPAT_URI}"
 
-		declare -l LOOP_ARCH_L=${LOOP_ARCH}
-
 		[[ -n ${COMPAT_URI} ]] && \
-			ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )"
+			ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )"
 
-		declare -u TC_ARCH_KERNEL=$(tc-arch-kernel)
-		if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then
+		TC_ARCH_KERNEL=$(tc-arch-kernel);
+		if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then
 			for i in ${COMPAT_URI}; do
 				ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
 			done
 		fi
-
 	done
 }
 
-- 
2.13.5



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-09-06 23:40 99% [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope Mike Pagano

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