Gentoo Archives: gentoo-commits

From: "Samuli Suominen (ssuominen)" <ssuominen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
Date: Tue, 12 Jul 2011 14:27:58
Message-Id: 20110712142746.BDBF82004B@flycatcher.gentoo.org
1 ssuominen 11/07/12 14:27:46
2
3 Modified: tests-common.sh
4 Log:
5 Copy Portage's code for has -function to tests-common.sh. None of the eclasses use hasq anymore, so assuming this is safe. Feel free to yell at me if this breaks.
6
7 Revision Changes Path
8 1.4 eclass/tests/tests-common.sh
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.4&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.4&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.3&r2=1.4
13
14 Index: tests-common.sh
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
17 retrieving revision 1.3
18 retrieving revision 1.4
19 diff -u -r1.3 -r1.4
20 --- tests-common.sh 18 Oct 2010 07:18:14 -0000 1.3
21 +++ tests-common.sh 12 Jul 2011 14:27:46 -0000 1.4
22 @@ -27,5 +27,13 @@
23 debug-print "now in section ${*}"
24 }
25
26 -hasq() { [[ " ${*:2} " == *" $1 "* ]]; }
27 -has() { hasq "$@"; }
28 +has() {
29 + local needle=$1
30 + shift
31 +
32 + local x
33 + for x in "$@"; do
34 + [ "${x}" = "${needle}" ] && return 0
35 + done
36 + return 1
37 +}