commit: 270d0436bdffcf82d8981b28a9833569146332d0 Author: Brian Evans <grknight <AT> gentoo <DOT> org> AuthorDate: Fri Dec 18 02:27:28 2015 +0000 Commit: Brian Evans <grknight <AT> gentoo <DOT> org> CommitDate: Fri Dec 18 02:27:28 2015 +0000 URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=270d0436
Add support for the phpdbg SAPI target Signed-off-by: Brian Evans <grknight <AT> gentoo.org> src/php.eselect.in | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/php.eselect.in b/src/php.eselect.in index 7e918ab..10edcbd 100644 --- a/src/php.eselect.in +++ b/src/php.eselect.in @@ -6,11 +6,12 @@ inherit config multilib DESCRIPTION="Manage php installations" MAINTAINER="php-b...@gentoo.org" -MODULES="cli apache2 fpm cgi" +MODULES="cli apache2 fpm cgi phpdbg" cli_link="${EROOT}"/usr/bin/php fpm_link="${EROOT}"/usr/bin/php-fpm cgi_link="${EROOT}"/usr/bin/php-cgi +dbg_link="${EROOT}"/usr/bin/phpdbg cleanup_sapis() { local m @@ -137,6 +138,15 @@ find_targets_cgi() { done | @SORT@ | @UNIQ@ } +find_targets_phpdbg() { + local target libdir + for target in $(find_targets); do + for libdir in $(get_libdirs); do + [[ -f ${EROOT}${libdir}/$target/bin/phpdbg ]] && echo $target + done + done | @SORT@ | @UNIQ@ +} + get_active_cli() { # See get_active_apache2() for an explanation of the sed call. local target=$(canonicalise "${cli_link}") @@ -158,6 +168,13 @@ get_active_fpm() { [[ -a "${target}" ]] && echo "${target}" | @SED@ -ne "${ver}" } +get_active_phpdbg() { + # See get_active_apache2() for an explanation of the sed call. + local target=$(canonicalise "${dbg_link}") + local ver="s:.*/usr/.*/\(php[0-9]\.[0-9][0-9]*\)/bin/phpdbg:\1:p" + [[ -a "${target}" ]] && echo "${target}" | @SED@ -ne "${ver}" +} + # The path to the active version of the apache2 module, which should # be a symlink. This is the path used by our apache configuration to # load the PHP module. The path is unversioned (that is, it has no "5" @@ -309,6 +326,19 @@ list_fpm() { write_numbered_list -m "(none found)" "${targets[@]}" } +list_phpdbg() { + local targets + local a + targets=( $(find_targets_phpdbg) ) + a=$(get_active_phpdbg) + for (( i = 0; i < ${#targets[@]}; i++ )) ; do + if [[ $a == ${targets[i]} ]] ; then + targets[i]=$(highlight_marker "${targets[i]}") + fi + done + write_numbered_list -m "(none found)" "${targets[@]}" +} + set_apache2() { local active_symlink libdir target=$(resolv_target apache2 $1) active_symlink="$(get_apache2_active_symlink_path)" @@ -345,6 +375,14 @@ set_cgi() { die -q "failed to create active php-cgi symlink" } +set_phpdbg() { + t=$(resolv_target phpdbg $1) + [[ -z $t ]] && die -q "invalid target" + @LN_S@ --force "../..$(get_active_libdir)/${t}/bin/phpdbg" \ + "${dbg_link}" || \ + die -q "failed to create active phpdbg symlink" +} + set_fpm() { local t=$(resolv_target fpm $1) [[ -z $t ]] && die -q "invalid target"