diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-04 02:54:32 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-11 13:05:23 +0200 |
commit | a790b93a3cac5c82cb545b6213101b44b5d8f952 (patch) | |
tree | 93af5a13519d9c8fc0eda720baac4f261eb54ea7 /community/php7 | |
parent | 1413e46ebbc87a57b2f4943de7b20d57f951f728 (diff) | |
download | aports-a790b93a3cac5c82cb545b6213101b44b5d8f952.tar.bz2 aports-a790b93a3cac5c82cb545b6213101b44b5d8f952.tar.xz |
community/php7: refactor funcs for resolving exts load order
Diffstat (limited to 'community/php7')
-rw-r--r-- | community/php7/APKBUILD | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/community/php7/APKBUILD b/community/php7/APKBUILD index 78b05fad20..15c6812498 100644 --- a/community/php7/APKBUILD +++ b/community/php7/APKBUILD @@ -347,7 +347,7 @@ check() { # help it... # * opcache is Zend extension, it's handled specially in Makefile # * imap can't be loaded together with recode, so we must omit it - local php_modules=$(_extensions_by_deps_order \ + local php_modules=$(_extensions_by_load_order \ | grep -vx opcache \ | grep -vx imap \ | xargs -n 1 printf "'$builddir/modules/%s.la' ") @@ -546,10 +546,7 @@ _extension() { : ${extdepends:=$(_resolve_extension_deps "$extname")} depends="$depends $extdepends" - # Compute prefix for extension config, so extension depending on other - # extension(s) will be loaded later than those without dependencies. - # This is flawed, but good enough for now. - local index=$(echo "$extdepends" | wc -w) + local load_order=$(_extension_load_order "$extname") # extension prefix local prefix= @@ -560,7 +557,7 @@ _extension() { mkdir -p "$subpkgdir"/$_extension_confd echo "${prefix}extension=$extname.so" \ - > "$subpkgdir"/$_extension_confd/$(printf %02d $index)_$extname.ini + > "$subpkgdir"/$_extension_confd/$(printf %02d $load_order)_$extname.ini } # Resolves dependencies of the given extension name (without $pkgname- prefix) @@ -583,14 +580,23 @@ _resolve_extension_deps() { done } -# Prints $_extensions sorted by number of dependencies. -_extensions_by_deps_order() { +# Prints a load order (0-based integer) for the given extension name. Extension +# with lower load order should be loaded before exts with higher load order. +# It's based on number of dependencies of the extension, which is flawed, but +# simple and good enough for now. +_extension_load_order() { + local name="$1" + local deps=$(eval "echo \$_depends_$name") + + echo "${deps:=$(_resolve_extension_deps $name)}" | wc -w +} + +# Prints $_extensions sorted by load order and name. +_extensions_by_load_order() { local deps list name for name in $_extensions; do - deps=$(eval "echo \$_depends_$name") - : ${deps:=$(_resolve_extension_deps $name)} - list="$list $(echo "$deps" | wc -w);$name" + list="$list $(_extension_load_order $name);$name" done printf '%s\n' $list | sort -t ';' -k 1 | sed -E 's/\d+;//' } |