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 | 61d206c3b9633e01a14adeb509a06f7d496a17c3 (patch) | |
tree | be4fd63f5e1f3de0c06936bf951deef1f48d13ff /eclass | |
parent | Fix paths for Gentoo Prefix (diff) | |
download | gentoo-2-61d206c3b9633e01a14adeb509a06f7d496a17c3.tar.gz gentoo-2-61d206c3b9633e01a14adeb509a06f7d496a17c3.tar.bz2 gentoo-2-61d206c3b9633e01a14adeb509a06f7d496a17c3.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')
-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 +} |