1 |
This time, use bash 4.0, but limit the use of this function to ebuild that have EAPI >= 6. |
2 |
Display a warning for maintainers to upgrade their ebuilds, or remove the call. |
3 |
Thanks to mgorny for the suggestion. |
4 |
|
5 |
Signed-off-by: Mike Pagano <mpagano@g.o> |
6 |
--- |
7 |
eclass/kernel-2.eclass | 20 +++++++++++++------- |
8 |
1 file changed, 13 insertions(+), 7 deletions(-) |
9 |
|
10 |
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass |
11 |
index 84909f30c..a80f3e91a 100644 |
12 |
--- a/eclass/kernel-2.eclass |
13 |
+++ b/eclass/kernel-2.eclass |
14 |
@@ -1407,11 +1407,20 @@ getfilevar() { |
15 |
# This function sets ARCH_URI and ARCH_PATCH |
16 |
# with the neccessary info for the arch sepecific compatibility |
17 |
# patchsets. |
18 |
+# To use, an ebuild could contain a line like: |
19 |
+# AMD64_URI=http//linktothearchspecificpatch |
20 |
+# This function requires EAPI >= 6. |
21 |
|
22 |
detect_arch() { |
23 |
|
24 |
- local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL |
25 |
+ if [[ "${EAPI}" -lt 6 ]]; then |
26 |
+ eqawarn "ebuild is attempting to call detect_arch when EAPI < 6." |
27 |
+ eqawarn "This function will not be executed." |
28 |
+ return |
29 |
+ fi |
30 |
|
31 |
+ local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL |
32 |
+ |
33 |
# COMPAT_URI is the contents of ${ARCH}_URI |
34 |
# ARCH_URI is the URI for all the ${ARCH}_URI patches |
35 |
# ARCH_PATCH is ARCH_URI broken into files for UNIPATCH |
36 |
@@ -1425,18 +1434,15 @@ detect_arch() { |
37 |
COMPAT_URI="${LOOP_ARCH}_URI" |
38 |
COMPAT_URI="${!COMPAT_URI}" |
39 |
|
40 |
- declare -l LOOP_ARCH_L=${LOOP_ARCH} |
41 |
- |
42 |
[[ -n ${COMPAT_URI} ]] && \ |
43 |
- ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )" |
44 |
+ ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )" |
45 |
|
46 |
- declare -u TC_ARCH_KERNEL=$(tc-arch-kernel) |
47 |
- if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then |
48 |
+ TC_ARCH_KERNEL=$(tc-arch-kernel); |
49 |
+ if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then |
50 |
for i in ${COMPAT_URI}; do |
51 |
ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}" |
52 |
done |
53 |
fi |
54 |
- |
55 |
done |
56 |
} |
57 |
|
58 |
-- |
59 |
2.13.5 |