Gentoo Archives: gentoo-dev

From: Floyd Anderson <f.a@××××.net>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope
Date: Thu, 07 Sep 2017 01:14:01
Message-Id: 20170907011345.hlj2th4x56t5tdtc@31c0.net
In Reply to: [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope by Mike Pagano
1 Hello,
2
3 some remarks below ...
4
5 On Mi, 06 Sep 23:40:50 +0000
6 Mike Pagano <mpagano@g.o> wrote:
7 >This time, use bash 4.0, but limit the use of this function to ebuild that have EAPI >= 6.
8 >Display a warning for maintainers to upgrade their ebuilds, or remove the call.
9 >Thanks to mgorny for the suggestion.
10 >
11 >Signed-off-by: Mike Pagano <mpagano@g.o>
12 >---
13 > eclass/kernel-2.eclass | 20 +++++++++++++-------
14 > 1 file changed, 13 insertions(+), 7 deletions(-)
15 >
16 >diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
17 >index 84909f30c..a80f3e91a 100644
18 >--- a/eclass/kernel-2.eclass
19 >+++ b/eclass/kernel-2.eclass
20 >@@ -1407,11 +1407,20 @@ getfilevar() {
21 > # This function sets ARCH_URI and ARCH_PATCH
22 > # with the neccessary info for the arch sepecific compatibility
23 > # patchsets.
24 >+# To use, an ebuild could contain a line like:
25 >+# AMD64_URI=http//linktothearchspecificpatch
26
27 Even it’s just a comment:
28
29 # AMD64_URI="http://link-to-the-arch-specific-patch"
30
31 looks friendlier to my eyes. However at least the colon after the scheme
32 should be given.
33
34 >+# This function requires EAPI >= 6.
35 >
36 > detect_arch() {
37 >
38 >- local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
39 >+ if [[ "${EAPI}" -lt 6 ]]; then
40 >+ eqawarn "ebuild is attempting to call detect_arch when EAPI < 6."
41 >+ eqawarn "This function will not be executed."
42 >+ return
43 >+ fi
44 >
45 >+ local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
46
47 Declaration of LOOP_ARCH_L seems obsolete now.
48
49 >+
50 > # COMPAT_URI is the contents of ${ARCH}_URI
51 > # ARCH_URI is the URI for all the ${ARCH}_URI patches
52 > # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
53 >@@ -1425,18 +1434,15 @@ detect_arch() {
54 > COMPAT_URI="${LOOP_ARCH}_URI"
55 > COMPAT_URI="${!COMPAT_URI}"
56 >
57 >- declare -l LOOP_ARCH_L=${LOOP_ARCH}
58 >-
59 > [[ -n ${COMPAT_URI} ]] && \
60 >- ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )"
61 >+ ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )"
62 >
63 >- declare -u TC_ARCH_KERNEL=$(tc-arch-kernel)
64 >- if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then
65 >+ TC_ARCH_KERNEL=$(tc-arch-kernel);
66 >+ if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then
67 > for i in ${COMPAT_URI}; do
68 > ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
69 > done
70 > fi
71 >-
72 > done
73 > }
74 >
75 >--
76 >2.13.5
77 >
78 >
79
80
81 --
82 Regards,
83 floyd

Replies