public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michael Orlitzky" <mjo@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect-php:master commit in: src/
Date: Sun, 20 Dec 2015 00:17:38 +0000 (UTC)	[thread overview]
Message-ID: <1450565270.6b913fd7a6a7c34ca6411f5117393ab5ded0c4f9.mjo@gentoo> (raw)

commit:     6b913fd7a6a7c34ca6411f5117393ab5ded0c4f9
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 19 22:47:50 2015 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Dec 19 22:47:50 2015 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=6b913fd7

Generalize sapi_active_bin_link_path() to sapi_active_link_path().

Generalize the sapi_active_bin_link_path() to work with the "apache2"
SAPI, too. Basically we just return the path of the mod_php symlink
for that SAPI even though it's not an executable. After doing so, it
makes sense to remove "bin" from the function name.

The sapi_active_link_path() function, called with "apache2" as its
argument, now replaces the get_apache2_active_symlink_path() function.

 src/php.eselect.in | 64 +++++++++++++++++++-----------------------------------
 1 file changed, 22 insertions(+), 42 deletions(-)

diff --git a/src/php.eselect.in b/src/php.eselect.in
index 0eb4ae4..6c1f803 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -9,34 +9,33 @@ MAINTAINER="php-bugs@gentoo.org"
 MODULES="cli apache2 fpm cgi phpdbg"
 
 
-# Most of the SAPIs (apache2 excluded) provide executables that we
-# symlink to a predictable location. Given a SAPI name, we output
-# that location.
+# Each SAPI provides at least one "active" link in a predictable
+# location.  For example, the "cgi" SAPI has its active symlink at
+# /usr/bin/php-cgi. Given a SAPI name we return the path to that link.
 #
-# For example, the "cgi" SAPI has its active symlink at /usr/bin/php-cgi.
-#
-# Note that the "cli" SAPI actually provides three binaries -- we
+# Note that the "cli" SAPI actually provides three executables -- we
 # return the path for only one. This is an API wart, not by design.
 #
 # INPUT:
 #
-# The name of a SAPI that provides an executable.
+# The name of a SAPI.
 #
 # OUTPUT:
 #
-# The path of the symlink for the executable provided by the active
-# version of the given SAPI. An error is raised if the given SAPI
-# does not provide an executable.
+# The path of the main symlink provided by the active version of the
+# given SAPI. An error is raised if the given SAPI is not valid.
 #
-sapi_active_bin_link_path() {
+sapi_active_link_path() {
 	local sapi="${1}"
 	local bin_dir="${EROOT}/usr/bin/"
 	case "${sapi}" in
-		cli) echo "${bin_dir}/php" ;;
+		apache2)
+			 echo "${EROOT}$(get_active_libdir)/apache2/modules/mod_php.so" ;;
+		cli) echo "${bin_dir}/php"     ;;
 		fpm) echo "${bin_dir}/php-fpm" ;;
 		cgi) echo "${bin_dir}/php-cgi" ;;
-		dbg) echo "${bin_dir}/phpdbg" ;;
-        *)   die "SAPI ${sapi} does not provide an executable" ;;
+		dbg) echo "${bin_dir}/phpdbg"  ;;
+        *)   die "invalid SAPI name: ${sapi}" ;;
 	esac
 }
 
@@ -198,51 +197,32 @@ find_targets_phpdbg() {
 
 get_active_cli() {
 	# See get_active_apache2() for an explanation of the sed call.
-	local target=$(canonicalise "$(sapi_active_bin_link_path cli)")
+	local target=$(canonicalise "$(sapi_active_link_path cli)")
 	local ver="s:.*/usr/.*/\(php[0-9]\.[0-9][0-9]*\)/bin/php:\1:p"
 	[[ -a "${target}" ]] &&	echo "${target}" | @SED@ -ne "${ver}"
 }
 
 get_active_cgi() {
 	# See get_active_apache2() for an explanation of the sed call.
-	local target=$(canonicalise "$(sapi_active_bin_link_path cgi)")
+	local target=$(canonicalise "$(sapi_active_link_path cgi)")
 	local ver="s:.*/usr/.*/\(php[0-9]\.[0-9][0-9]*\)/bin/php-cgi:\1:p"
 	[[ -a "${target}" ]] &&	echo "${target}" | @SED@ -ne "${ver}"
 }
 
 get_active_fpm() {
 	# See get_active_apache2() for an explanation of the sed call.
-	local target=$(canonicalise "$(sapi_active_bin_link_path fpm)")
+	local target=$(canonicalise "$(sapi_active_link_path fpm)")
 	local ver="s:.*/usr/.*/\(php[0-9]\.[0-9][0-9]*\)/bin/php-fpm:\1:p"
 	[[ -a "${target}" ]] &&	echo "${target}" | @SED@ -ne "${ver}"
 }
 
 get_active_phpdbg() {
 	# See get_active_apache2() for an explanation of the sed call.
-	local target=$(canonicalise "$(sapi_active_bin_link_path dbg)")
+	local target=$(canonicalise "$(sapi_active_link_path dbg)")
 	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"
-# or "7" in it) so that the apache configuration does not need to
-# change after the user eselects a different version.
-#
-# INPUT:
-#
-# None.
-#
-# OUTPUT:
-#
-# The path to our mod_php.so symlink, which should (but is not
-# guaranteed to) point to a real apache DSO.
-#
-get_apache2_active_symlink_path() {
-	echo "${EROOT}$(get_active_libdir)/apache2/modules/mod_php.so"
-}
-
 # Find the active (selected) version of the apache2 module. Used to
 # decorate the output of the `eselect php list apache2` command.
 #
@@ -259,7 +239,7 @@ get_active_apache2() {
 	local active_symlink target ver
 
 	# The symlink to our active module.
-	active_symlink="$(get_apache2_active_symlink_path)"
+	active_symlink="$(sapi_active_link_path apache2)"
 
 	# This sed expression finds the "display name" of the PHP version
 	# corresponding to a copy of libphp. For example, it parses the
@@ -388,7 +368,7 @@ list_phpdbg() {
 
 set_apache2() {
 	local active_symlink libdir major target=$(resolv_target apache2 $1)
-	active_symlink="$(get_apache2_active_symlink_path)"
+	active_symlink="$(sapi_active_link_path apache2)"
 	major=$(parse_target_major_version "${target}")
 
 	[[ -z $target ]] && die -q "invalid target"
@@ -420,7 +400,7 @@ set_cgi() {
 	t=$(resolv_target cgi $1)
 	[[ -z $t ]] && die -q "invalid target"
 	@LN_S@ --force "../..$(get_active_libdir)/${t}/bin/php-cgi" \
-		"$(sapi_active_bin_link_path cgi)" || \
+		"$(sapi_active_link_path cgi)" || \
 		die -q "failed to create active php-cgi symlink"
 }
 
@@ -428,7 +408,7 @@ set_phpdbg() {
 	t=$(resolv_target phpdbg $1)
 	[[ -z $t ]] && die -q "invalid target"
 	@LN_S@ --force "../..$(get_active_libdir)/${t}/bin/phpdbg" \
-		"$(sapi_active_bin_link_path dbg)" || \
+		"$(sapi_active_link_path dbg)" || \
 		die -q "failed to create active phpdbg symlink"
 }
 
@@ -436,7 +416,7 @@ set_fpm() {
 	local t=$(resolv_target fpm $1)
 	[[ -z $t ]] && die -q "invalid target"
 	@LN_S@ --force "../..$(get_active_libdir)/${t}/bin/php-fpm" \
-		"$(sapi_active_bin_link_path fpm)" || \
+		"$(sapi_active_link_path fpm)" || \
 		die -q "failed to create symlink for the php-fpm binary"
 	echo "Please restart php-fpm for the changes to take effect."
 }


             reply	other threads:[~2015-12-20  0:17 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-20  0:17 Michael Orlitzky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-12-08  2:24 [gentoo-commits] proj/eselect-php:master commit in: src/ Brian Evans
2020-03-01 12:59 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-12 22:30 Michael Orlitzky
2018-04-12  2:24 Michael Orlitzky
2016-01-22 20:53 Michael Orlitzky
2016-01-22 19:42 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-20 14:42 Michael Orlitzky
2016-01-09 17:20 Michael Orlitzky
2016-01-09 17:20 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-18  2:27 Brian Evans
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450565270.6b913fd7a6a7c34ca6411f5117393ab5ded0c4f9.mjo@gentoo \
    --to=mjo@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox