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: <1450564841.7d9d9e7ef2a642c2f568de59b1af5f20a0c828ab.mjo@gentoo> (raw)
commit: 7d9d9e7ef2a642c2f568de59b1af5f20a0c828ab
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 19 22:40:41 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Dec 19 22:40:41 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=7d9d9e7e
Factor out the target major version number parsing into a function.
src/php.eselect.in | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 4af8650..0eb4ae4 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -40,6 +40,28 @@ sapi_active_bin_link_path() {
esac
}
+
+# Parse and return the major version from a target name. For example,
+# the "php5.6" target has a major version of "5".
+#
+# INPUT:
+#
+# The name of a valid PHP target, like php5.6 or php7.0.
+#
+# OUTPUT:
+#
+# A major version number. An error is raised if the given target is
+# not valid.
+#
+parse_target_major_version() {
+ local target="${1}"
+ local major="${target:3:1}"
+ case "${major}" in
+ 5|7) echo "${major}" ;;
+ *) die "invalid PHP target name: ${target}"
+ esac
+}
+
cleanup_sapis() {
local m
local link
@@ -273,9 +295,7 @@ write_mod_php_conf() {
@MKDIR_P@ "${conf_dir}" || die "failed to create ${conf_dir}"
- # Parse the major version (for example "5" or "7") out of the
- # target name.
- local major="${target:3:1}"
+ local major=$(parse_target_major_version "${target}")
cat <<-EOF > "${conf_path}" || die "failed to write mod_php.conf"
<IfModule !php${major}_module>
LoadModule php${major}_module modules/mod_php.so
@@ -367,15 +387,17 @@ list_phpdbg() {
}
set_apache2() {
- local active_symlink libdir target=$(resolv_target apache2 $1)
+ local active_symlink libdir major target=$(resolv_target apache2 $1)
active_symlink="$(get_apache2_active_symlink_path)"
+ major=$(parse_target_major_version "${target}")
[[ -z $target ]] && die -q "invalid target"
+
for libdir in $(get_libdirs); do
rm --force "${active_symlink}" || \
die "failed to remove active module symlink"
- @LN_S@ --force "../../${target}/apache2/libphp${target:3:1}.so" \
+ @LN_S@ --force "../../${target}/apache2/libphp${major}.so" \
"${active_symlink}" || \
die -q "failed to create active mod_php symlink"
done
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=1450564841.7d9d9e7ef2a642c2f568de59b1af5f20a0c828ab.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