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: <1450564181.20bd3ef735c06af203f826e0a0b9c5603e00af8c.mjo@gentoo> (raw)
commit: 20bd3ef735c06af203f826e0a0b9c5603e00af8c
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 19 22:29:41 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Dec 19 22:29:41 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=20bd3ef7
Replace hard-coded SAPI executable link paths with a function call.
src/php.eselect.in | 49 ++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 38 insertions(+), 11 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 10edcbd..4af8650 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -8,10 +8,37 @@ MAINTAINER="php-bugs@gentoo.org"
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
+
+# Most of the SAPIs (apache2 excluded) provide executables that we
+# symlink to a predictable location. Given a SAPI name, we output
+# that location.
+#
+# For example, the "cgi" SAPI has its active symlink at /usr/bin/php-cgi.
+#
+# Note that the "cli" SAPI actually provides three binaries -- 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.
+#
+# 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.
+#
+sapi_active_bin_link_path() {
+ local sapi="${1}"
+ local bin_dir="${EROOT}/usr/bin/"
+ case "${sapi}" in
+ 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" ;;
+ esac
+}
cleanup_sapis() {
local m
@@ -149,28 +176,28 @@ find_targets_phpdbg() {
get_active_cli() {
# See get_active_apache2() for an explanation of the sed call.
- local target=$(canonicalise "${cli_link}")
+ local target=$(canonicalise "$(sapi_active_bin_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 "${cgi_link}")
+ local target=$(canonicalise "$(sapi_active_bin_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 "${fpm_link}")
+ local target=$(canonicalise "$(sapi_active_bin_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 "${dbg_link}")
+ local target=$(canonicalise "$(sapi_active_bin_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}"
}
@@ -371,7 +398,7 @@ set_cgi() {
t=$(resolv_target cgi $1)
[[ -z $t ]] && die -q "invalid target"
@LN_S@ --force "../..$(get_active_libdir)/${t}/bin/php-cgi" \
- "${cgi_link}" || \
+ "$(sapi_active_bin_link_path cgi)" || \
die -q "failed to create active php-cgi symlink"
}
@@ -379,7 +406,7 @@ set_phpdbg() {
t=$(resolv_target phpdbg $1)
[[ -z $t ]] && die -q "invalid target"
@LN_S@ --force "../..$(get_active_libdir)/${t}/bin/phpdbg" \
- "${dbg_link}" || \
+ "$(sapi_active_bin_link_path dbg)" || \
die -q "failed to create active phpdbg symlink"
}
@@ -387,7 +414,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" \
- "${fpm_link}" || \
+ "$(sapi_active_bin_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."
}
next 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=1450564181.20bd3ef735c06af203f826e0a0b9c5603e00af8c.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