1 |
--- |
2 |
eclass/eapi7-ver.eclass | 20 ++++++++++---------- |
3 |
1 file changed, 10 insertions(+), 10 deletions(-) |
4 |
|
5 |
diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass |
6 |
index 6117124a90a5..3a200cbe9ef2 100644 |
7 |
--- a/eclass/eapi7-ver.eclass |
8 |
+++ b/eclass/eapi7-ver.eclass |
9 |
@@ -1,4 +1,4 @@ |
10 |
-# Copyright 1999-2017 Gentoo Foundation |
11 |
+# Copyright 1999-2018 Gentoo Foundation |
12 |
# Distributed under the terms of the GNU General Public License v2 |
13 |
|
14 |
# @ECLASS: eapi7-ver.eclass |
15 |
@@ -58,12 +58,8 @@ |
16 |
# the version string, it is truncated silently. |
17 |
|
18 |
case ${EAPI:-0} in |
19 |
- 0|1|2|3|4|5) |
20 |
- die "${ECLASS}: EAPI=${EAPI:-0} not supported";; |
21 |
- 6) |
22 |
- ;; |
23 |
- *) |
24 |
- die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass";; |
25 |
+ 0|1|2|3|4|5|6) ;; |
26 |
+ *) die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass" ;; |
27 |
esac |
28 |
|
29 |
# @FUNCTION: _ver_parse_range |
30 |
@@ -128,18 +124,22 @@ _ver_split() { |
31 |
ver_cut() { |
32 |
local range=${1} |
33 |
local v=${2:-${PV}} |
34 |
- local start end |
35 |
+ local start end i out |
36 |
local -a comp |
37 |
|
38 |
_ver_split "${v}" |
39 |
local max=$((${#comp[@]}/2)) |
40 |
_ver_parse_range "${range}" "${max}" |
41 |
|
42 |
- local IFS= |
43 |
if [[ ${start} -gt 0 ]]; then |
44 |
start=$(( start*2 - 1 )) |
45 |
fi |
46 |
- echo "${comp[*]:start:end*2-start}" |
47 |
+ # Work around a bug in bash-3.2, where "${comp[*]:start:end*2-start}" |
48 |
+ # inserts spurious 0x7f characters for empty array elements |
49 |
+ for (( i = start; i < end*2; i++ )); do |
50 |
+ out+=${comp[i]} |
51 |
+ done |
52 |
+ echo "${out}" |
53 |
} |
54 |
|
55 |
# @FUNCTION: ver_rs |
56 |
-- |
57 |
2.17.0 |