ebuild.sh: restore old has() implementation
authorBrian Harring <ferringb@gmail.com>
Mon, 11 Jul 2011 08:33:21 +0000 (01:33 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 11 Jul 2011 14:26:28 +0000 (07:26 -0700)
The needle/haystack implementation handles whitespace as originally
intended (prior to commit 659eafddd5964820ce8bdc0d90f5fcf7df04b5b7),
as discussed in bug #374791.

Signed-off-by: Brian Harring <ferringb@gmail.com>
bin/isolated-functions.sh

index 9d633973b12d9384017740a2f95171aabf43e6f8..574f949d7e97632cfcc710d585105fd9b5c597cc 100644 (file)
@@ -525,7 +525,14 @@ hasv() {
 }
 
 has() {
-       [[ " ${*:2} " == *" $1 "* ]]
+       local needle=$1
+       shift
+
+       local x
+       for x in "$@"; do
+               [ "${x}" = "${needle}" ] && return 0
+       done
+       return 1
 }
 
 # @FUNCTION: save_ebuild_env