Gentoo Archives: gentoo-dev

From: Davide Pesavento <pesa@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] eutils.eclass: In EAPI conditionals, replace "has" by case statements.
Date: Mon, 30 Nov 2015 17:34:32
Message-Id: CADfzvvZiXfR5SENfxnHPgffKpCoR5Z-Hv23ExaoBN1S2yjgr6w@mail.gmail.com
In Reply to: Re: [gentoo-dev] [PATCH] eutils.eclass: In EAPI conditionals, replace "has" by case statements. by Ulrich Mueller
1 On Mon, Nov 30, 2015 at 7:52 AM, Ulrich Mueller <ulm@g.o> wrote:
2 >>>>>> On Mon, 30 Nov 2015, Davide Pesavento wrote:
3 >
4 >>> The patch below replaces them by case statements. (Unfortunately we
5 >>> cannot use fall-through (&;) because it is a bash 4 feature.)
6 >
7 >> Sounds reasonable, although I'd find an 'if' clause slightly more
8 >> readable, since there wouldn't be an 'else' branch in 2 out of 3
9 >> cases.
10 >
11 > It is slightly more complicated to match multiple patterns with [[ ]]
12 > because it requires multiple conditions, regexps, or extglob. We could
13 > of course use a bracket expression like [[ ${EAPI:-0} = [012345] ]]
14 > but I find it ugly in this context (and it won't be able to check for
15 > EAPI 10 ;) ).
16
17 Yeah I had a bracket expression in mind... which I find less ugly than
18 a case/esac in this context. And I agree with mgorny that the EAPI=10
19 argument is kinda moot. Anyway, this is really not important, feel
20 free to ignore my comment.
21
22 Thanks,
23 Davide