diff options
author | Samuli Suominen <ssuominen@gentoo.org> | 2011-07-12 14:27:46 +0000 |
---|---|---|
committer | Samuli Suominen <ssuominen@gentoo.org> | 2011-07-12 14:27:46 +0000 |
commit | 3893ccd1dd225915279198f66892a549c77dfcef (patch) | |
tree | 8c6f0a4e0bbcade40c634d88f9eb3ad360a0337a /eclass/tests | |
parent | Fix paths for Gentoo Prefix (diff) | |
download | historical-3893ccd1dd225915279198f66892a549c77dfcef.tar.gz historical-3893ccd1dd225915279198f66892a549c77dfcef.tar.bz2 historical-3893ccd1dd225915279198f66892a549c77dfcef.zip |
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.
Diffstat (limited to 'eclass/tests')
-rw-r--r-- | eclass/tests/tests-common.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh index 3bba4946963b..8b6869bc5b47 100644 --- a/eclass/tests/tests-common.sh +++ b/eclass/tests/tests-common.sh @@ -27,5 +27,13 @@ debug-print-section() { debug-print "now in section ${*}" } -hasq() { [[ " ${*:2} " == *" $1 "* ]]; } -has() { hasq "$@"; } +has() { + local needle=$1 + shift + + local x + for x in "$@"; do + [ "${x}" = "${needle}" ] && return 0 + done + return 1 +} |