Gentoo Archives: gentoo-dev

From: Martin Vaeth <martin@×××××.de>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: RFC: intel-sdp-r1.eclass
Date: Mon, 15 Feb 2016 18:48:59
Message-Id: n9t6i7$jgg$1@ger.gmane.org
In Reply to: Re: [gentoo-dev] RFC: intel-sdp-r1.eclass by "Justin Lecher (jlec)"
1 Justin Lecher (jlec) <jlec@g.o> wrote:
2 >>> [[ -n ${_INTEL_PV4} ]] && _INTEL_PV+="${_INTEL_PV4}-"
3 >>> [[ -n ${_INTEL_PV1} ]] && _INTEL_PV+="${_INTEL_PV1}"
4 >>> [[ -n ${_INTEL_PV2} ]] && _INTEL_PV+=".${_INTEL_PV2}"
5 >>> [[ -n ${_INTEL_PV3} ]] && _INTEL_PV+=".${_INTEL_PV3}"
6 >>> [[ -n ${_INTEL_PV4} ]] && _INTEL_PV+="-${_INTEL_PV4}"
7 >>
8 >> Now, this is crazy ;-). I don't see immediately how to improve that,
9 >> but I suggest you thought about that.
10 >
11 > [...] So there is no sanity other then reshuffling.
12
13 You could put the logic into the string:
14
15 _INTEL_PV+="${_INTEL_PV4}${_INTEL_PV4:+-}${_INTEL_PV1}"
16 _INTEL_PV+="${_INTEL_PV2:+.}${_INTEL_PV2}"
17 _INTEL_PV+="${_INTEL_PV3:+.}${_INTEL_PV3}"
18 _INTEL_PV+="${_INTEL_PV4:+-}${_INTEL_PV4}"