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: Fri,  8 Jan 2016 21:50:23 +0000 (UTC)	[thread overview]
Message-ID: <1452279081.cc0b2730e408da529275b6688e9a381ae4b905dc.mjo@gentoo> (raw)

commit:     cc0b2730e408da529275b6688e9a381ae4b905dc
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  8 18:51:21 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan  8 18:51:21 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=cc0b2730

Add sapi_link_name_target() to clean up set_sapi().

There was a special case in set_sapi() for apache2's mod_php.so. Now
that has been factored out into a new function sapi_link_name_target()
which acts more or less like a hash table (dictionary lookup).

 src/php.eselect.in | 38 +++++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/src/php.eselect.in b/src/php.eselect.in
index 1288669..7acda64 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -36,6 +36,34 @@ sapi_active_link_names() {
 	esac
 }
 
+# The link names obtained from sapi_active_link_names() all need to
+# point somewhere. Usually the target is the same as the link name
+# itself, but not always. This function returns the link-target for a
+# given sapi, sapi-target, and link name.
+#
+# INPUT:
+#
+# The first parameter is a SAPI name. The second parameter is the
+# SAPI-target name (for example, "php7.0"). The third parameter is a
+# link name.
+#
+# OUTPUT:
+#
+# The name of the target (that is, file) for the given link name.
+#
+sapi_link_name_target() {
+	local sapi="${1}"
+	local target_name="${2}"
+	local link_name="${3}"
+
+	# For now, only apache2's mod_php.so gets special treatment.
+	if [[ "${sapi}" == "apache2" && "${link_name}" == "mod_php.so" ]] ; then
+		local major=$(parse_target_major_version "${target_name}")
+		echo "libphp${major}.so"
+	else
+		echo "${link_name}"
+	fi
+}
 
 # Each SAPI provides a few (one or more) "active" links in a
 # predictable location. The target directory (where they point) is
@@ -426,15 +454,7 @@ set_sapi() {
 	local link_dir=$(sapi_active_link_dir "${sapi}")
 
 	for link_name in $(sapi_active_link_names "${sapi}"); do
-		# Usually the link targets have the same name as the link itself...
-		local link_target="${link_name}"
-
-		if [[ "${link_name}" == "mod_php.so" ]] ; then
-		   # ...but apache2 needs special handling since we're not
-		   # linking from something named mod_php.so.
-		   local major=$(parse_target_major_version "${target_name}")
-		   link_target="libphp${major}.so"
-		fi
+		local link_target=$(sapi_link_name_target "${sapi}" "${target_name}" "${link_name}")
 
 		@LN_S@ --force "${link_tgt_dir}/${link_target}" \
 			"${link_dir}/${link_name}" || \


             reply	other threads:[~2016-01-08 21:50 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 21:50 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
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-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=1452279081.cc0b2730e408da529275b6688e9a381ae4b905dc.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