* [gentoo-dev] [PATCH] eapi7-ver.eclass: Support EAPIs 0 to 6.
@ 2018-05-08 19:16 Ulrich Müller
2018-05-08 19:39 ` [gentoo-dev] [PATCH v2] " Ulrich Müller
0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Müller @ 2018-05-08 19:16 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]
---
eclass/eapi7-ver.eclass | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index 6117124a90a5..3a200cbe9ef2 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: eapi7-ver.eclass
@@ -58,12 +58,8 @@
# the version string, it is truncated silently.
case ${EAPI:-0} in
- 0|1|2|3|4|5)
- die "${ECLASS}: EAPI=${EAPI:-0} not supported";;
- 6)
- ;;
- *)
- die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass";;
+ 0|1|2|3|4|5|6) ;;
+ *) die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass" ;;
esac
# @FUNCTION: _ver_parse_range
@@ -128,18 +124,22 @@ _ver_split() {
ver_cut() {
local range=${1}
local v=${2:-${PV}}
- local start end
+ local start end i out
local -a comp
_ver_split "${v}"
local max=$((${#comp[@]}/2))
_ver_parse_range "${range}" "${max}"
- local IFS=
if [[ ${start} -gt 0 ]]; then
start=$(( start*2 - 1 ))
fi
- echo "${comp[*]:start:end*2-start}"
+ # Work around a bug in bash-3.2, where "${comp[*]:start:end*2-start}"
+ # inserts spurious 0x7f characters for empty array elements
+ for (( i = start; i < end*2; i++ )); do
+ out+=${comp[i]}
+ done
+ echo "${out}"
}
# @FUNCTION: ver_rs
--
2.17.0
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-dev] [PATCH v2] eapi7-ver.eclass: Support EAPIs 0 to 6.
2018-05-08 19:16 [gentoo-dev] [PATCH] eapi7-ver.eclass: Support EAPIs 0 to 6 Ulrich Müller
@ 2018-05-08 19:39 ` Ulrich Müller
2018-05-09 0:25 ` [gentoo-dev] " Duncan
2018-05-09 8:19 ` [gentoo-dev] [PATCH v3] " Ulrich Müller
0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Müller @ 2018-05-08 19:39 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]
---
Sorry, I had sent the wrong patch.
eclass/eapi7-ver.eclass | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index 6117124a90a5..43b6a4122506 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: eapi7-ver.eclass
@@ -58,12 +58,8 @@
# the version string, it is truncated silently.
case ${EAPI:-0} in
- 0|1|2|3|4|5)
- die "${ECLASS}: EAPI=${EAPI:-0} not supported";;
- 6)
- ;;
- *)
- die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass";;
+ 0|1|2|3|4|5|6) ;;
+ *) die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass" ;;
esac
# @FUNCTION: _ver_parse_range
@@ -139,7 +135,10 @@ ver_cut() {
if [[ ${start} -gt 0 ]]; then
start=$(( start*2 - 1 ))
fi
- echo "${comp[*]:start:end*2-start}"
+ # Work around a bug in bash-3.2, where "${comp[*]:start:end*2-start}"
+ # inserts spurious 0x7f characters for empty array elements
+ local out=( "${comp[@]:start:end*2-start}" )
+ echo "${out[*]}"
}
# @FUNCTION: ver_rs
--
2.17.0
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-dev] Re: [PATCH v2] eapi7-ver.eclass: Support EAPIs 0 to 6.
2018-05-08 19:39 ` [gentoo-dev] [PATCH v2] " Ulrich Müller
@ 2018-05-09 0:25 ` Duncan
2018-05-09 8:19 ` [gentoo-dev] [PATCH v3] " Ulrich Müller
1 sibling, 0 replies; 5+ messages in thread
From: Duncan @ 2018-05-09 0:25 UTC (permalink / raw
To: gentoo-dev
Ulrich Müller posted on Tue, 08 May 2018 21:39:16 +0200 as excerpted:
> # @ECLASS: eapi7-ver.eclass
> @@ -58,12 +58,8 @@ # the version string, it is truncated silently.
>
> case ${EAPI:-0} in
> - 0|1|2|3|4|5)
> - die "${ECLASS}: EAPI=${EAPI:-0} not supported";;
> - 6)
> - ;;
> - *)
> - die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass";;
> + 0|1|2|3|4|5|6) ;;
> + *) die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass" ;;
> esac
>
You're simply continuing what was there before, but since you're working on
it already...
That generic *) case die claim is incorrectly specific for a generic catchall
case.
I'd suggest a 7) case with that specific claim, and an "EAPI Unknown" die
error for the generic *) catchall case. The error is then clearer if someone
typos EAPI=67 or the like.
+ 0|1|2|3|4|5|6) ;;
+ 7) die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass" ;;
+ *) die "${ECLASS}: EAPI=${EAPI} Unknown" ;;
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gentoo-dev] [PATCH v3] eapi7-ver.eclass: Support EAPIs 0 to 6.
2018-05-08 19:39 ` [gentoo-dev] [PATCH v2] " Ulrich Müller
2018-05-09 0:25 ` [gentoo-dev] " Duncan
@ 2018-05-09 8:19 ` Ulrich Müller
2018-05-13 22:40 ` [gentoo-dev] " Ulrich Mueller
1 sibling, 1 reply; 5+ messages in thread
From: Ulrich Müller @ 2018-05-09 8:19 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1388 bytes --]
---
v3, including suggestions from Duncan and Hello71.
eclass/eapi7-ver.eclass | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index 6117124a90a5..e34025e201c7 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: eapi7-ver.eclass
@@ -58,12 +58,9 @@
# the version string, it is truncated silently.
case ${EAPI:-0} in
- 0|1|2|3|4|5)
- die "${ECLASS}: EAPI=${EAPI:-0} not supported";;
- 6)
- ;;
- *)
- die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass";;
+ 0|1|2|3|4|5|6) ;;
+ 7) die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass" ;;
+ *) die "${ECLASS}: EAPI=${EAPI} unknown" ;;
esac
# @FUNCTION: _ver_parse_range
@@ -135,11 +132,12 @@ ver_cut() {
local max=$((${#comp[@]}/2))
_ver_parse_range "${range}" "${max}"
- local IFS=
if [[ ${start} -gt 0 ]]; then
start=$(( start*2 - 1 ))
fi
- echo "${comp[*]:start:end*2-start}"
+ # Work around a bug in bash-3.2, where "${comp[*]:start:end*2-start}"
+ # inserts spurious 0x7f characters for empty array elements
+ printf "%s" "${comp[@]:start:end*2-start}" $'\n'
}
# @FUNCTION: ver_rs
--
2.17.0
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-dev] Re: [PATCH v3] eapi7-ver.eclass: Support EAPIs 0 to 6.
2018-05-09 8:19 ` [gentoo-dev] [PATCH v3] " Ulrich Müller
@ 2018-05-13 22:40 ` Ulrich Mueller
0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Mueller @ 2018-05-13 22:40 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 8 bytes --]
Pushed.
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-05-13 22:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-08 19:16 [gentoo-dev] [PATCH] eapi7-ver.eclass: Support EAPIs 0 to 6 Ulrich Müller
2018-05-08 19:39 ` [gentoo-dev] [PATCH v2] " Ulrich Müller
2018-05-09 0:25 ` [gentoo-dev] " Duncan
2018-05-09 8:19 ` [gentoo-dev] [PATCH v3] " Ulrich Müller
2018-05-13 22:40 ` [gentoo-dev] " Ulrich Mueller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox