[packages/php] dep-tests.sh: move main to function
glen
glen at pld-linux.org
Wed Aug 7 23:09:43 CEST 2019
commit 93d946f280ce84ad4cafa9358e2727e40871254e
Author: Elan Ruusamäe <glen at pld-linux.org>
Date: Wed Aug 7 23:08:32 2019 +0300
dep-tests.sh: move main to function
dep-tests.sh | 60 ++++++++++++++++++++++++++++++++----------------------------
1 file changed, 32 insertions(+), 28 deletions(-)
---
diff --git a/dep-tests.sh b/dep-tests.sh
index 3d1a398..c79530a 100755
--- a/dep-tests.sh
+++ b/dep-tests.sh
@@ -33,31 +33,35 @@ dep_opcache='pcre'
php=${PHP:-$(php-config --php-binary)}
ext_dir=${EXTENSION_DIR:-$(php-config --extension-dir)}
conf_dir=${CONFIG_DIR:-$(php-config --sysconfdir)/conf.d $(php-config --sysconfdir)/cli.d}
-tmpini=$(mktemp)
-
-# poldek --sn ac-ready -u php-*
-for ext in ${*:-$ext_dir/*.so}; do
- [ -f $ext ] || continue
- ext=${ext##*/}; ext=${ext%.so}
-
- deps=$(eval echo \$dep_$ext)
- # add ext itself, if already not in list (spl case)
- [[ $deps = *\ $ext\ * ]] || deps="$deps $ext"
-
- echo -n "$ext (deps: ${deps# })..."
-
- # special: opcache is listed as "Zend Opcache"
- [ "$ext" = "opcache" ] && ext="zend opcache"
-
- grep -rlE '^(zend_)?extension=('$(echo "${deps# }" | tr ' ' '|')').so$' $conf_dir | LC_ALL=C sort | xargs cat > $tmpini
- $php -n -d extension_dir=$ext_dir -c $tmpini -r "exit(extension_loaded('${ext}') ? 0 : 1);"
- rc=$?
- if [ $rc = 0 ]; then
- echo OK
- else
- echo FAIL
- echo "Failed config was:"
- cat $tmpini
- fi
-done
-rm -f $t
+
+test_deps() {
+ tmpini=$(mktemp)
+
+ # poldek --sn ac-ready -u php-*
+ for ext in ${*:-$ext_dir/*.so}; do
+ [ -f $ext ] || continue
+ ext=${ext##*/}; ext=${ext%.so}
+
+ deps=$(eval echo \$dep_$ext)
+ # add ext itself, if already not in list (spl case)
+ [[ $deps = *\ $ext\ * ]] || deps="$deps $ext"
+
+ echo -n "$ext (deps: ${deps# })..."
+
+ # special: opcache is listed as "Zend Opcache"
+ [ "$ext" = "opcache" ] && ext="zend opcache"
+
+ grep -rlE '^(zend_)?extension=('$(echo "${deps# }" | tr ' ' '|')').so$' $conf_dir | LC_ALL=C sort | xargs cat > $tmpini
+ $php -n -d extension_dir=$ext_dir -c $tmpini -r "exit(extension_loaded('${ext}') ? 0 : 1);"
+ rc=$?
+ if [ $rc = 0 ]; then
+ echo OK
+ else
+ echo FAIL
+ echo "Failed config was:"
+ cat $tmpini
+ fi
+ done
+}
+
+test_deps "$@"
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/php.git/commitdiff/77ab4842119965b7dc6804e7be6b1a5521d947a5
More information about the pld-cvs-commit
mailing list