* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: c09a74e0b46e3cd72c5057d23b2ec2038b82a6f0
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 14:02:45 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 14:02:45 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=c09a74e0
Document the find_targets_apache2() and get_active_apache2() functions.
src/php.eselect.in | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 5bbb491..e08afbe 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -82,6 +82,22 @@ find_targets() {
echo $dirs
}
+# List all valid apache2 targets. The list is obtained by searching
+# for libphp*.so in locations determined by find_targets(). This list
+# should therefore be a subset of find_targets().
+#
+# INPUT:
+#
+# None.
+#
+# OUTPUT:
+#
+# The "display name" of every available apache PHP module, one per line.
+# For example,
+#
+# php5.6
+# php7.0
+#
find_targets_apache2() {
local libs target libdir
for target in $(find_targets); do
@@ -143,6 +159,18 @@ get_active_fpm() {
}
+# Find the active (selected) version of the apache2 module. Used to
+# decorate the output of the `eselect php list apache2` command.
+#
+# INPUT:
+#
+# None.
+#
+# OUTPUT:
+#
+# The "display name" of the active apache2 module. For example,
+# "php5.6" or "php7.0".
+#
get_active_apache2() {
local libs target ver
libs="${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: 9ad05523d41421d97ae54e47bf3fdd293a48e275
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 14:03:13 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 14:03:13 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=9ad05523
Add curly braces around an interpolated string variable.
src/php.eselect.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index e08afbe..2ea8c3d 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -102,7 +102,7 @@ find_targets_apache2() {
local libs target libdir
for target in $(find_targets); do
for libdir in $(get_libdirs); do
- libs="${EROOT}${libdir}/$target/apache2/libphp[57].so"
+ libs="${EROOT}${libdir}/${target}/apache2/libphp[57].so"
for lib in $libs; do
[[ -f "${lib}" ]] && echo $target
done
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: f835773f9365d1f5fe46079df7cb7477f200f2ed
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 13:45:25 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 13:45:25 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=f835773f
Use fixed ".so" suffix for libphp instead of computing it.
The only supported way to run PHP/Apache these days is as a dynamic
shared object (DSO). The DSO will have an ".so" suffix, so we don't
need to probe to see if libphp*.a exists.
This also avoids a hidden dependency on libz, for whose static library
we were probing.
src/php.eselect.in | 30 +++++++-----------------------
1 file changed, 7 insertions(+), 23 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 363dc1d..5bbb491 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -65,22 +65,6 @@ get_active_libdir() {
echo /usr/lib
}
-get_libname() {
- # probe on a well-known library
- local lib ret=.so
- for lib in "${EROOT}"$(get_active_libdir)/libz.* ; do
- case "${lib##*/}" in
- libz.a) ret=.a ;; # some platforms use .a as ext
- libz.*.*) continue ;;
- libz.*)
- ret=${lib##*libz}
- break
- ;;
- esac
- done
- echo ${ret}
-}
-
cleanup() {
local target=$(find_targets_$1 | tail -n 1)
[[ -z $target ]] &&
@@ -102,7 +86,7 @@ find_targets_apache2() {
local libs target libdir
for target in $(find_targets); do
for libdir in $(get_libdirs); do
- libs="${EROOT}${libdir}/$target/apache2/libphp[57]$(get_libname)"
+ libs="${EROOT}${libdir}/$target/apache2/libphp[57].so"
for lib in $libs; do
[[ -f "${lib}" ]] && echo $target
done
@@ -161,12 +145,12 @@ get_active_fpm() {
get_active_apache2() {
local libs target ver
- libs="${EROOT}$(get_active_libdir)/apache2/modules/libphp[57]$(get_libname)"
+ libs="${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so"
# This sed expression finds the "display name" of the PHP version
# corresponding to a copy of libphp. For example, it parses the
# string "php5.6" out of "/usr/lib64/php5.6/apache2/libphp5.so".
- ver="s:.*/usr/.*/\(php[0-9]\.[0-9]\)/apache2/libphp[57]$(get_libname):\1:p"
+ ver="s:.*/usr/.*/\(php[0-9]\.[0-9]\)/apache2/libphp[57].so:\1:p"
for lib in $libs; do
if [[ -L "${lib}" ]] ; then
target=$(canonicalise "${lib}")
@@ -254,10 +238,10 @@ set_apache2() {
local libdir t=$(resolv_target apache2 $1)
[[ -z $t ]] && die -q "Bad target"
for libdir in $(get_libdirs); do
- rm -f "${EROOT}${libdir}"/apache2/modules/libphp{5,7}$(get_libname)
- @LN_S@ --force ../../$t/apache2/libphp${t:3:1}$(get_libname) \
- "${EROOT}"${libdir}/apache2/modules/ || \
- die -q "Failed to set symlink for ${EPREFIX}${libdir}/apache2/modules/libphp${t:3:1}$(get_libname)"
+ rm -f "${EROOT}${libdir}/apache2/modules/libphp[57].so"
+ @LN_S@ --force "../../$t/apache2/libphp${t:3:1}.so" \
+ "${EROOT}${libdir}/apache2/modules/" || \
+ die -q "Failed to set symlink for ${EPREFIX}${libdir}/apache2/modules/libphp${t:3:1}.so"
done
echo "You have to run \`${EPREFIX}/etc/init.d/apache2 restart' for the changes to take effect"
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: 41eea178ac8b07da9795ef3ec4c77595037fdb2c
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 21:00:29 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 21:00:29 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=41eea178
Add the get_apache2_active_symlink_path() function.
The "active symlink" is used in two places: to determine the active
version, and to set it. Factor its magic out into a separate function.
src/php.eselect.in | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 2ea8c3d..d882095 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -158,6 +158,24 @@ get_active_fpm() {
[[ -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 libphp.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/libphp.so"
+}
# Find the active (selected) version of the apache2 module. Used to
# decorate the output of the `eselect php list apache2` command.
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: 0a14910c4b819a4200e37ab0ffbc7dc126451be6
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 22:15:08 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 22:15:08 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=0a14910c
Rename our active DSO symlink to mod_php.so.
Our DSO symlink used to be called libphp5.so or libphp7.so. This was
very recently changed to an unversioned libphp.so, but at that point,
we might as well just call it mod_php.so for consistency. Note that
our 70_mod_php5.conf currently points directly to the libphp file and
doesn't use the symlink, no matter its name. That will need to be
changed.
An unused cleanup() function was removed in the process, because the
function that is actually used was updated to remove the obsolete
libphp* symlinks.
src/php.eselect.in | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index d882095..e77b86a 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -34,6 +34,12 @@ cleanup_sapi() {
return
fi
fi
+
+ if [[ "${1}" == "apache2" ]]; then
+ rm -f "${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so" \
+ || die "failed to remove old libphp.so symlink"
+ fi
+
return 1
}
@@ -65,12 +71,6 @@ get_active_libdir() {
echo /usr/lib
}
-cleanup() {
- local target=$(find_targets_$1 | tail -n 1)
- [[ -z $target ]] &&
- set_$1 $target
-}
-
find_targets() {
local dir dirs libdir
for libdir in $(get_libdirs); do
@@ -170,11 +170,11 @@ get_active_fpm() {
#
# OUTPUT:
#
-# The path to our libphp.so symlink, which should (but is not
+# 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/libphp.so"
+ echo "${EROOT}$(get_active_libdir)/apache2/modules/mod_php.so"
}
# Find the active (selected) version of the apache2 module. Used to
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: 0e8210cb39211c30ec8b02006d0e695bc8e6130f
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 22:30:04 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 22:30:04 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=0e8210cb
Switch get_active_apache2() and set_apache2() to the new mod_php.so symlink.
src/php.eselect.in | 38 ++++++++++++++++++++------------------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 14ba819..4bbc695 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -190,24 +190,22 @@ get_apache2_active_symlink_path() {
# "php5.6" or "php7.0".
#
get_active_apache2() {
- local libs target ver
- libs="${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so"
+ local active_symlink target ver
+
+ # The symlink to our active module.
+ active_symlink="$(get_apache2_active_symlink_path)"
# This sed expression finds the "display name" of the PHP version
# corresponding to a copy of libphp. For example, it parses the
# string "php5.6" out of "/usr/lib64/php5.6/apache2/libphp5.so".
ver="s:.*/usr/.*/\(php[0-9]\.[0-9]\)/apache2/libphp[57].so:\1:p"
- for lib in $libs; do
- if [[ -L "${lib}" ]] ; then
- target=$(canonicalise "${lib}")
- if [[ -a "${target}" ]] ; then
- echo "${target}" | @SED@ -ne "${ver}"
- # Short-circuit here because we should never have more
- # than one active version.
- return
- fi
+
+ if [[ -L "${active_symlink}" ]] ; then
+ target=$(canonicalise "${active_symlink}")
+ if [[ -a "${target}" ]] ; then
+ echo "${target}" | @SED@ -ne "${ver}"
fi
- done
+ fi
}
resolv_target() {
@@ -281,13 +279,17 @@ list_fpm() {
}
set_apache2() {
- local libdir t=$(resolv_target apache2 $1)
- [[ -z $t ]] && die -q "Bad target"
+ local active_symlink libdir t=$(resolv_target apache2 $1)
+ active_symlink="$(get_apache2_active_symlink_path)"
+
+ [[ -z $t ]] && die -q "invalid target"
for libdir in $(get_libdirs); do
- rm -f "${EROOT}${libdir}/apache2/modules/libphp[57].so"
- @LN_S@ --force "../../$t/apache2/libphp${t:3:1}.so" \
- "${EROOT}${libdir}/apache2/modules/" || \
- die -q "Failed to set symlink for ${EPREFIX}${libdir}/apache2/modules/libphp${t:3:1}.so"
+ rm --force "${active_symlink}" || \
+ die "failed to remove active module symlink"
+
+ @LN_S@ --force "../../${t}/apache2/libphp${t:3:1}.so" \
+ "${active_symlink}" || \
+ die -q "failed to create active mod_php symlink"
done
echo "Please restart apache for the changes to take effect."
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: b1509ffcc83d25bf7b379ef55c4e5d8c75a8de8f
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 22:28:27 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 22:28:27 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=b1509ffc
Add a missing die() on a call to rm.
src/php.eselect.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index e77b86a..4de770f 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -29,7 +29,7 @@ cleanup_sapi() {
echo ", updated version to $(get_active_$1)"
return
else
- rm $link
+ rm $link || die "failed to remove ${link}"
return
fi
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: c5c96ff3aa9777818de6185045c41426214e3493
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 11 00:24:32 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Dec 11 00:24:32 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=c5c96ff3
Write an apache configuration file to /var/lib/eselect-php/mod_php.conf.
With the mod_php.so symlinking done, we realize a new problem: each
apache module has its "module name" hardcoded into the binary. For
example, in mod_php7.c, we find,
AP_MODULE_DECLARE_DATA module php7_module
and likewise with php5_module in the 5.x series of PHP. This means
that we can't load both of these modules with one LoadModule statement
regardless of its filename -- we need to know the module name too.
This commit adds a function to write out an apache config file for the
current active module. The main apache config file should Include this
file, which will be updated whenever an apache2 target is set.
src/php.eselect.in | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index ea8676f..aa8ad68 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -208,6 +208,37 @@ get_active_apache2() {
fi
}
+# Write an apache configuration file to load the active version of
+# mod_php. The 5.x and 7.x series (at least...) have different module
+# names, and so require a different apache configuration when
+# switching between the two.
+#
+# INPUT:
+#
+# The name of the target (php5.6, php7.0) for which to write the
+# configuration file.
+#
+# OUTPUT:
+#
+# None.
+#
+write_mod_php_conf() {
+ local target="${1}"
+ local conf_dir="${EROOT}"/var/lib/eselect-php
+ local conf_path="${conf_dir}/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}"
+ cat <<-EOF > "${conf_path}" || die "failed to write mod_php.conf"
+ <IfModule !php${major}_module>
+ LoadModule php${major}_module modules/mod_php.so
+ </IfModule>
+ EOF
+}
+
resolv_target() {
local targets=( $(find_targets_$1) )
if is_number $2; then
@@ -279,18 +310,20 @@ list_fpm() {
}
set_apache2() {
- local active_symlink libdir t=$(resolv_target apache2 $1)
+ local active_symlink libdir target=$(resolv_target apache2 $1)
active_symlink="$(get_apache2_active_symlink_path)"
- [[ -z $t ]] && die -q "invalid 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 "../../${t}/apache2/libphp${t:3:1}.so" \
+ @LN_S@ --force "../../${target}/apache2/libphp${target:3:1}.so" \
"${active_symlink}" || \
die -q "failed to create active mod_php symlink"
done
+
+ write_mod_php_conf "${target}"
echo "Please restart apache for the changes to take effect."
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: 064b605e2bda578b8480b391484be52b0dd9222d
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 22:29:29 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 22:29:29 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=064b605e
Clean up error/info messages and quoting in the set_* functions.
src/php.eselect.in | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 4de770f..14ba819 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -289,34 +289,34 @@ set_apache2() {
"${EROOT}${libdir}/apache2/modules/" || \
die -q "Failed to set symlink for ${EPREFIX}${libdir}/apache2/modules/libphp${t:3:1}.so"
done
- echo "You have to run \`${EPREFIX}/etc/init.d/apache2 restart' for the changes to take effect"
+ echo "Please restart apache for the changes to take effect."
}
set_cli() {
local file libdir t=$(resolv_target cli $1)
- [[ -z $t ]] && die -q "Bad target"
+ [[ -z $t ]] && die -q "invalid target"
for file in php phpize php-config; do
- @LN_S@ --force ../..$(get_active_libdir)/$t/bin/$file \
- "${EROOT}"/usr/bin/$file || \
- die -q "Failed to create symlink for ${file}"
+ @LN_S@ --force "../..$(get_active_libdir)/${t}/bin/${file}" \
+ "${EROOT}/usr/bin/${file}" || \
+ die -q "failed to create active ${file} symlink"
done
}
set_cgi() {
t=$(resolv_target cgi $1)
- [[ -z $t ]] && die -q "Bad target"
- @LN_S@ --force ../..$(get_active_libdir)/$t/bin/php-cgi \
+ [[ -z $t ]] && die -q "invalid target"
+ @LN_S@ --force "../..$(get_active_libdir)/${t}/bin/php-cgi" \
"${EROOT}"/usr/bin/php-cgi || \
- die -q "Failed to create symlink for php-cgi"
+ die -q "failed to create active php-cgi symlink"
}
set_fpm() {
local t=$(resolv_target fpm $1)
- [[ -z $t ]] && die -q "Bad target"
- @LN_S@ --force ../..$(get_active_libdir)/$t/bin/php-fpm \
+ [[ -z $t ]] && die -q "invalid target"
+ @LN_S@ --force "../..$(get_active_libdir)/${t}/bin/php-fpm" \
"${EROOT}"/usr/bin/php-fpm || \
- die -q "Failed to create symlink for the php-fpm binary"
- echo "You have to run \`${EPREFIX}/etc/init.d/php-fpm restart' for the changes to take effect"
+ die -q "failed to create symlink for the php-fpm binary"
+ echo "Please restart php-fpm for the changes to take effect."
}
## set action
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-11 0:40 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-11 0:40 UTC (permalink / raw
To: gentoo-commits
commit: 80898dea109417f9b8990837a4292ed90018f8d9
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 22:35:55 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 22:35:55 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=80898dea
Use {cli,cgi,fpm}_link variables where appropriate.
These variables were all defined but not used. There were a few places
where they could be profitably inserted.
src/php.eselect.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 4bbc695..ea8676f 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -139,21 +139,21 @@ find_targets_cgi() {
get_active_cli() {
# See get_active_apache2() for an explanation of the sed call.
- local target=$(canonicalise "${EROOT}"/usr/bin/php)
+ local target=$(canonicalise "${cli_link}")
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 "${EROOT}"/usr/bin/php-cgi)
+ local target=$(canonicalise "${cgi_link}")
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 "${EROOT}"/usr/bin/php-fpm)
+ local target=$(canonicalise "${fpm_link}")
local ver="s:.*/usr/.*/\(php[0-9]\.[0-9][0-9]*\)/bin/php-fpm:\1:p"
[[ -a "${target}" ]] && echo "${target}" | @SED@ -ne "${ver}"
}
@@ -308,7 +308,7 @@ set_cgi() {
t=$(resolv_target cgi $1)
[[ -z $t ]] && die -q "invalid target"
@LN_S@ --force "../..$(get_active_libdir)/${t}/bin/php-cgi" \
- "${EROOT}"/usr/bin/php-cgi || \
+ "${cgi_link}" || \
die -q "failed to create active php-cgi symlink"
}
@@ -316,7 +316,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" \
- "${EROOT}"/usr/bin/php-fpm || \
+ "${fpm_link}" || \
die -q "failed to create symlink for the php-fpm binary"
echo "Please restart php-fpm for the changes to take effect."
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-18 2:27 Brian Evans
0 siblings, 0 replies; 60+ messages in thread
From: Brian Evans @ 2015-12-18 2:27 UTC (permalink / raw
To: gentoo-commits
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-bugs@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"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
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."
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
commit: f5f1575593c3c2792a50e61e08db4d72757bf731
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 19 23:55:00 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Dec 19 23:55:00 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=f5f15755
Add some missing semicolons at the end of a case statement.
src/php.eselect.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index a2266c5..d9c1555 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -57,7 +57,7 @@ parse_target_major_version() {
local major="${target:3:1}"
case "${major}" in
5|7) echo "${major}" ;;
- *) die "invalid PHP target name: ${target}"
+ *) die "invalid PHP target name: ${target}" ;;
esac
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
commit: 1926650b7c0f73fb44d8ca1c32f92883ed851e52
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 20 00:16:02 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sun Dec 20 00:16:02 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=1926650b
Fix bug in resolv_target() introduced while refactoring.
The resolv_target() function was making a call to find_targets_$1.
This was incorrectly refacored to "find_targets $1" instead of
"find_sapi_targets $1" and has been fixed.
src/php.eselect.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 9a1d628..d730e00 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -232,7 +232,7 @@ write_mod_php_conf() {
}
resolv_target() {
- local targets=( $(find_targets $1) )
+ local targets=( $(find_sapi_targets $1) )
if is_number $2; then
if [[ $2 -le ${#targets[@]} && $2 -gt 0 ]] ; then
echo "${targets[ $(( $2 - 1 )) ]}"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
commit: 4f1ff31c738d4abe67849eb4280154889275127f
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 19 23:55:33 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Dec 19 23:55:33 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=4f1ff31c
Add the find_sapi_targets() function and refactor.
The new function find_sapi_targets() takes a SAPI name as an argument
and outputs the valid targets for that SAPI. With it we replace the
following five functions that all did more or less the same thing:
1. find_targets_apache2()
2. find_targets_cli()
3. find_targets_fpm()
4. find_targets_cgi()
5. find_targets_phpdbg()
src/php.eselect.in | 82 +++++++++++++++++++-----------------------------------
1 file changed, 29 insertions(+), 53 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index d9c1555..a377116 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -93,7 +93,7 @@ cleanup_sapi() {
}
update_sapi() {
- local target=$(find_targets_$1 | tail -n 1)
+ local target=$(find_sapi_targets $1 | tail -n 1)
local current=$(get_active_$1)
[[ -z $target ]] && return 1
[[ $current = $target ]] && return 1
@@ -131,66 +131,42 @@ find_targets() {
echo $dirs
}
-# List all valid apache2 targets. The list is obtained by searching
-# for libphp*.so in locations determined by find_targets(). This list
-# should therefore be a subset of find_targets().
+# List all valid targets for the given SAPI. The list is obtained by
+# searching the filesystem for a particular (SAPI-specific) file in
+# locations determined by find_targets(). This list should therefore
+# be a subset of find_targets().
#
# INPUT:
#
-# None.
+# The name of a SAPI.
#
# OUTPUT:
#
-# The "display name" of every available apache PHP module, one per line.
-# For example,
+# The "display name" of every available target for this SAPI, one per
+# line. For example,
#
# php5.6
# php7.0
#
-find_targets_apache2() {
- local libs target libdir
- for target in $(find_targets); do
- for libdir in $(get_libdirs); do
- libs="${EROOT}${libdir}/${target}/apache2/libphp[57].so"
- for lib in $libs; do
- [[ -f "${lib}" ]] && echo $target
- done
- done
- done | @SORT@ | @UNIQ@
-}
-
-find_targets_cli() {
- local target libdir
- for target in $(find_targets); do
- for libdir in $(get_libdirs); do
- [[ -f ${EROOT}${libdir}/$target/bin/php ]] && echo $target
- done
- done | @SORT@ | @UNIQ@
-}
-
-find_targets_fpm() {
- local target libdir
- for target in $(find_targets); do
- for libdir in $(get_libdirs); do
- [[ -f ${EROOT}${libdir}/$target/bin/php-fpm ]] && echo $target
- done
- done | @SORT@ | @UNIQ@
-}
+find_sapi_targets() {
+ local sapi="${1}"
-find_targets_cgi() {
- local target libdir
- for target in $(find_targets); do
- for libdir in $(get_libdirs); do
- [[ -f ${EROOT}${libdir}/$target/bin/php-cgi ]] && echo $target
- done
- done | @SORT@ | @UNIQ@
-}
+ local pattern_suffix
+ case "${sapi}" in
+ apache2) pattern_suffix="apache2/libphp[57].so" ;;
+ cli) pattern_suffix="bin/php" ;;
+ fpm) pattern_suffix="bin/php-fpm" ;;
+ cgi) pattern_suffix="bin/php-cgi" ;;
+ dbg) pattern_suffix="bin/phpdbg" ;;
+ *) die "invalid SAPI name: ${sapi}" ;;
+ esac
-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
+ local pattern="${EROOT}${libdir}/${target}/${pattern_suffix}"
+ for file in $pattern; do
+ [[ -f "${file}" ]] && echo "${target}"
+ done
done
done | @SORT@ | @UNIQ@
}
@@ -256,7 +232,7 @@ write_mod_php_conf() {
}
resolv_target() {
- local targets=( $(find_targets_$1) )
+ local targets=( $(find_targets $1) )
if is_number $2; then
if [[ $2 -le ${#targets[@]} && $2 -gt 0 ]] ; then
echo "${targets[ $(( $2 - 1 )) ]}"
@@ -276,7 +252,7 @@ check_module() {
list_apache2() {
local targets
local a
- targets=( $(find_targets_apache2) )
+ targets=( $(find_sapi_targets apache2) )
a=$(get_sapi_active_target apache2)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
@@ -289,7 +265,7 @@ list_apache2() {
list_cli() {
local targets
local a
- targets=( $(find_targets_cli) )
+ targets=( $(find_sapi_targets cli) )
a=$(get_sapi_active_target cli)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
@@ -302,7 +278,7 @@ list_cli() {
list_cgi() {
local targets
local a
- targets=( $(find_targets_cgi) )
+ targets=( $(find_sapi_targets cgi) )
a=$(get_sapi_active_target cgi)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
@@ -315,7 +291,7 @@ list_cgi() {
list_fpm() {
local targets
local a
- targets=( $(find_targets_fpm) )
+ targets=( $(find_sapi_targets fpm) )
a=$(get_sapi_active_target fpm)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
@@ -328,7 +304,7 @@ list_fpm() {
list_phpdbg() {
local targets
local a
- targets=( $(find_targets_phpdbg) )
+ targets=( $(find_sapi_targets dbg) )
a=$(get_sapi_active_target dbg)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
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."
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
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
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
commit: b363dda0a3d3bdab2874b3f12c64c9fc8beeef4c
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 19 23:29:40 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Dec 19 23:29:40 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=b363dda0
Factor our the active SAPI target getter functions.
We had five functions doing essentially the same thing:
1. get_active_cli()
2. get_active_cgi()
3. get_active_fpm()
4. get_active_phpdbg()
5. get_active_apache2()
Now that we have the sapi_active_link_path() function taking a SAPI
name as an argument, these have been refactored. One new function
get_sapi_active_target() takes a SAPI name as an argument and returns
the name of the active target (using sapi_active_link_path).
src/php.eselect.in | 62 +++++++++++++++---------------------------------------
1 file changed, 17 insertions(+), 45 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 6c1f803..fff7784 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -195,33 +195,6 @@ find_targets_phpdbg() {
done | @SORT@ | @UNIQ@
}
-get_active_cli() {
- # See get_active_apache2() for an explanation of the sed call.
- 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_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_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_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}"
-}
# Find the active (selected) version of the apache2 module. Used to
# decorate the output of the `eselect php list apache2` command.
@@ -235,21 +208,20 @@ get_active_phpdbg() {
# The "display name" of the active apache2 module. For example,
# "php5.6" or "php7.0".
#
-get_active_apache2() {
- local active_symlink target ver
-
- # The symlink to our active module.
- 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
- # string "php5.6" out of "/usr/lib64/php5.6/apache2/libphp5.so".
- ver="s:.*/usr/.*/\(php[0-9]\.[0-9]\)/apache2/libphp[57].so:\1:p"
+get_sapi_active_target() {
+ local sapi="${1}"
+ local active_symlink=$(sapi_active_link_path "${sapi}")
if [[ -L "${active_symlink}" ]] ; then
- target=$(canonicalise "${active_symlink}")
- if [[ -a "${target}" ]] ; then
- echo "${target}" | @SED@ -ne "${ver}"
+ local active_file=$(canonicalise "${active_symlink}")
+ if [[ -a "${active_file}" ]] ; then
+ # This sed command (regular expression) finds a target name
+ # contained in a filesystem path. For example, it parses
+ # "php5.6" from "/usr/lib64/php5.6/apache2/libphp5.so".
+ # The curly braces are an attempt to avoid '+' which is
+ # a GNU extension.
+ local sed_cmd='s:.*/\(php[0-9]\.[0-9]\{1,\}\)/.*:\1:p'
+ echo "${active_file}" | @SED@ -ne "${sed_cmd}"
fi
fi
}
@@ -305,7 +277,7 @@ list_apache2() {
local targets
local a
targets=( $(find_targets_apache2) )
- a=$(get_active_apache2)
+ a=$(get_sapi_active_target apache2)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
targets[i]=$(highlight_marker "${targets[i]}")
@@ -318,7 +290,7 @@ list_cli() {
local targets
local a
targets=( $(find_targets_cli) )
- a=$(get_active_cli)
+ a=$(get_sapi_active_target cli)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
targets[i]=$(highlight_marker "${targets[i]}")
@@ -331,7 +303,7 @@ list_cgi() {
local targets
local a
targets=( $(find_targets_cgi) )
- a=$(get_active_cgi)
+ a=$(get_sapi_active_target cgi)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
targets[i]=$(highlight_marker "${targets[i]}")
@@ -344,7 +316,7 @@ list_fpm() {
local targets
local a
targets=( $(find_targets_fpm) )
- a=$(get_active_fpm)
+ a=$(get_sapi_active_target fpm)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
targets[i]=$(highlight_marker "${targets[i]}")
@@ -357,7 +329,7 @@ list_phpdbg() {
local targets
local a
targets=( $(find_targets_phpdbg) )
- a=$(get_active_phpdbg)
+ a=$(get_sapi_active_target dbg)
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
if [[ $a == ${targets[i]} ]] ; then
targets[i]=$(highlight_marker "${targets[i]}")
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
commit: a3091c3b9dcae38cc1b6a78f8f963e2cbc3144be
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 20 00:06:47 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sun Dec 20 00:06:47 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=a3091c3b
Consolidate all list_foo actions into one new list_sapi() function.
This follows in the same vein as the other recent refactorings. With
the machinery in place, list_cli, list_cgi, etc. are all replaced by
one function list_sapi() taking a SAPI name as an argument.
src/php.eselect.in | 70 +++++++++++++++++++-----------------------------------
1 file changed, 24 insertions(+), 46 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index a377116..9a1d628 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -249,69 +249,47 @@ check_module() {
## Actual actions
-list_apache2() {
- local targets
- local a
- targets=( $(find_sapi_targets apache2) )
- a=$(get_sapi_active_target apache2)
+# Perform the "list" action for the given SAPI.
+#
+# INPUT:
+#
+# The SAPI name.
+#
+# OUTPUT:
+#
+# A numbered and decorated list of targets for the given SAPI.
+#
+list_sapi() {
+ local sapi="${1}"
+ local targets=( $(find_sapi_targets "${sapi}") )
+ local active=$(get_sapi_active_target "${sapi}")
+
for (( i = 0; i < ${#targets[@]}; i++ )) ; do
- if [[ $a == ${targets[i]} ]] ; then
+ if [[ $active == ${targets[i]} ]] ; then
targets[i]=$(highlight_marker "${targets[i]}")
fi
done
write_numbered_list -m "(none found)" "${targets[@]}"
}
+list_apache2() {
+ list_sapi apache2
+}
+
list_cli() {
- local targets
- local a
- targets=( $(find_sapi_targets cli) )
- a=$(get_sapi_active_target cli)
- 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[@]}"
+ list_sapi cli
}
list_cgi() {
- local targets
- local a
- targets=( $(find_sapi_targets cgi) )
- a=$(get_sapi_active_target cgi)
- 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[@]}"
+ list_sapi cgi
}
list_fpm() {
- local targets
- local a
- targets=( $(find_sapi_targets fpm) )
- a=$(get_sapi_active_target fpm)
- 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[@]}"
+ list_sapi fpm
}
list_phpdbg() {
- local targets
- local a
- targets=( $(find_sapi_targets dbg) )
- a=$(get_sapi_active_target dbg)
- 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[@]}"
+ list_sapi dbg
}
set_apache2() {
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2015-12-20 0:17 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2015-12-20 0:17 UTC (permalink / raw
To: gentoo-commits
commit: 313a8dafa0a6fd39c2acd27ab39f6d7b119b7835
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 19 23:34:38 2015 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Dec 19 23:34:38 2015 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=313a8daf
Fix documentation for the get_sapi_active_target() function.
The documentation for the get_sapi_active_target() was copy/pasted and
never updated. Whoops. It's been fixed.
src/php.eselect.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index fff7784..a2266c5 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -196,17 +196,17 @@ find_targets_phpdbg() {
}
-# Find the active (selected) version of the apache2 module. Used to
-# decorate the output of the `eselect php list apache2` command.
+# Find the active (selected) target for the given SAPI. This is used
+# to decorate the output of the `eselect php list <sapi>` command.
#
# INPUT:
#
-# None.
+# The name of a SAPI.
#
# OUTPUT:
#
-# The "display name" of the active apache2 module. For example,
-# "php5.6" or "php7.0".
+# The "display name" of the active target for the given SAPI. For
+# example, "php5.6" or "php7.0".
#
get_sapi_active_target() {
local sapi="${1}"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: 91160d1d55182b52650910472288e283d55f2811
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 17:14:51 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 17:14:51 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=91160d1d
Split sapi_active_link_path() into sapi_active_link_{names,dir}().
In preparation for refactoting the set_foo() functions, refactor the
function that gets the (one) active link path into two functions that
get the (one) active link directory and (more than one, potentially)
active link names.
src/php.eselect.in | 89 ++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 77 insertions(+), 12 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 72e6610..15792f3 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -8,13 +8,71 @@ MAINTAINER="php-bugs@gentoo.org"
MODULES="cli apache2 fpm cgi phpdbg"
+#
+# Output a list of link names (not full paths) belonging to the given
+# SAPI. These need to be updated when the user changes his active
+# target.
+#
+# INPUT:
+#
+# The name of a SAPI.
+#
+# OUTPUT:
+#
+# A space-separated list of link names belonging to the given
+# SAPI. For example, the "cli" SAPI has three link names: "php phpize
+# php-config". The "cgi" sapi has only "php-cgi".
+#
+sapi_active_link_names() {
+ local sapi="${1}"
+
+ case "${sapi}" in
+ apache2) echo "mod_php.so" ;;
+ cli) echo "php phpize php-config" ;;
+ fpm) echo "php-fpm" ;;
+ cgi) echo "php-cgi" ;;
+ dbg) echo "phpdbg" ;;
+ *) die "invalid SAPI name: ${sapi}" ;;
+ esac
+}
+
+
+# Each SAPI provides a few (one or more) "active" links in a
+# predictable location. And fortunately that location is fixed for a
+# given SAPI. For example, the "cgi" SAPI has its sole active symlink,
+# /usr/bin/php-cgi, in /usr/bin. Given a SAPI name, we return the
+# directory where that SAPI's links are located.
+#
+# INPUT:
+#
+# The name of a SAPI.
+#
+# OUTPUT:
+#
+# The directory in which the given SAPI's symlinks are located. For
+# example, the "cli" sapi has its three executable links in "/usr/bin".
+#
+sapi_active_link_dir() {
+ local sapi="${1}"
+ local bin_dir="${EROOT}/usr/bin"
+
+ case "${sapi}" in
+ apache2) echo "${EROOT}$(get_active_libdir)/apache2/modules" ;;
+ cli) echo "${bin_dir}" ;;
+ fpm) echo "${bin_dir}" ;;
+ cgi) echo "${bin_dir}" ;;
+ dbg) echo "${bin_dir}" ;;
+ *) die "invalid SAPI name: ${sapi}" ;;
+ esac
+}
+
# 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.
#
-# Note that the "cli" SAPI actually provides three executables -- we
-# return the path for only one. This is an API wart, not by design.
+# Note that SAPIs may provide more than one active link -- we return
+# the path for only the first.
#
# INPUT:
#
@@ -27,16 +85,11 @@ MODULES="cli apache2 fpm cgi phpdbg"
#
sapi_active_link_path() {
local sapi="${1}"
- local bin_dir="${EROOT}/usr/bin/"
- case "${sapi}" in
- 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 "invalid SAPI name: ${sapi}" ;;
- esac
+ local dir=$(sapi_active_link_dir "${sapi}")
+ local link_names=( $(sapi_active_link_names "${sapi}") )
+
+ # Use the first link name only.
+ echo "${dir}/${link_names[0]}"
}
@@ -319,6 +372,18 @@ list_phpdbg() {
list_sapi dbg
}
+
+set_sapi() {
+ local sapi="${1}"
+ local target="${2}"
+ local target_name=$(resolv_target "${sapi}" "${target}")
+ [[ -z $t ]] && die -q "invalid target ${target} for SAPI ${sapi}"
+
+ @LN_S@ --force "../..$(get_active_libdir)/${t}/bin/php-cgi" \
+ "$(sapi_active_link_path cgi)" || \
+ die -q "failed to create active php-cgi symlink"
+}
+
set_apache2() {
local active_symlink libdir major target=$(resolv_target apache2 $1)
active_symlink="$(sapi_active_link_path apache2)"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: e05ad5dc17a9501bf14e56652a42cf66a545e512
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 16:32:30 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 16:32:30 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=e05ad5dc
Document and clean up the resolv_target function.
src/php.eselect.in | 39 +++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index d868082..72e6610 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -231,14 +231,41 @@ write_mod_php_conf() {
EOF
}
+
+# Resolve an index or target name for a given SAPI into the "display
+# name" of that target.
+#
+# INPUT:
+#
+# The first parameter is the name of a SAPI. The second parameter is
+# either a number (the index of a target), or a target name.
+#
+# OUTPUT:
+#
+# The "display name" of the given target for the given SAPI. For
+# example, if the first parameter is "cli" and the second parameter is
+# "1", then the output will be the display name of the first target
+# for the cli SAPI (e.g. "php5.6").
+#
+# If the index or target name is invalid (that is, does not correspond
+# to one of the valid targets for the given SAPI), then nothing is
+# output.
+#
resolv_target() {
- local targets=( $(find_sapi_targets $1) )
- if is_number $2; then
- if [[ $2 -le ${#targets[@]} && $2 -gt 0 ]] ; then
- echo "${targets[ $(( $2 - 1 )) ]}"
+ local sapi="${1}"
+ local target="${2}"
+
+ # $targets is an array of things like "php5.6" and "php7.0"
+ local targets=( $(find_sapi_targets "${sapi}") )
+
+ if is_number "${target}" ; then
+ if [[ $target -le ${#targets[@]} && $target -gt 0 ]] ; then
+ # $target looks like an index into the $targets array.
+ echo "${targets[ $(( $target - 1 )) ]}"
fi
- elif has $2 ${targets[@]}; then
- echo $2
+ elif has "${target}" ${targets[@]} ; then
+ # $target is the *name* of a valid target for this SAPI.
+ echo "${target}"
fi
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: 2f1ec08068f8c91a0fd9b70a1426cd78bbcad6ac
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 19:23:41 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 19:23:41 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=2f1ec080
Add config warning when setting the apache2 target.
src/php.eselect.in | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 7acda64..b47d218 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -463,7 +463,27 @@ set_sapi() {
}
+# Check to see if the user is still using the old-style apache
+# configuration with -DPHP5 and 70_mod_php5.conf. If he is, warn him
+# that it is outdated, and that his eselect choices will not have any
+# effect until the configuration is updated.
+apache2_php5_config_check() {
+ if [ -f "${EROOT}/etc/apache2/modules.d/70_mod_php5.conf" ] ; then
+ local msg
+ write_warning_msg "The apache2 configuration has changed in this"
+ write_warning_msg "version of eselect-php. You should define \"-D PHP\""
+ write_warning_msg "and not \"-D PHP5\" for apache. The module is now"
+ write_warning_msg "loaded by 70_mod_php.conf (was 70_mod_php5.conf)."
+ write_warning_msg "After you have changed \"-D PHP5\" to \"-D PHP\", "
+ write_warning_msg "you should remove 70_mod_php5.conf to eliminate"
+ write_warning_msg "this warning. Until you have done so, your eselect"
+ write_warning_msg "choices for apache2 will have no effect."
+ echo
+ fi
+}
+
set_apache2() {
+ apache2_php5_config_check
local target="${1}"
set_sapi apache2 "${target}"
write_mod_php_conf "$(resolv_target apache2 "${target}")"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: b4f9495ddadc157e3f0f46c15d3e8ce9e0890b23
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 18:28:30 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 18:28:30 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=b4f9495d
Update copyright year.
src/php.eselect.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 97e7940..9f5ee1a 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -1,4 +1,4 @@
-# Copyright 2010-2015 Gentoo Foundation
+# Copyright 2010-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
inherit config multilib
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: ee46243308594a232f10f32b9243e91e608415b5
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 16:24:44 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 16:24:44 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=ee462433
Fix call to resolv_target() in set_phpdbg().
The first parameter to resolv_target should be the name of a SAPI. The
current call passes "phpdbg" which is incorrect. Change it to "dbg".
src/php.eselect.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index d730e00..d868082 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -331,7 +331,7 @@ set_cgi() {
}
set_phpdbg() {
- t=$(resolv_target phpdbg $1)
+ t=$(resolv_target dbg $1)
[[ -z $t ]] && die -q "invalid target"
@LN_S@ --force "../..$(get_active_libdir)/${t}/bin/phpdbg" \
"$(sapi_active_link_path dbg)" || \
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: b82579ced667244764c67d9fbe622695c3e9fe61
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 18:29:13 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 18:29:13 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=b82579ce
Remove unnecessary quoting.
src/php.eselect.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 9f5ee1a..2e9ec8d 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -422,19 +422,19 @@ set_apache2() {
}
set_cli() {
- set_sapi "cli" "${1}"
+ set_sapi cli "${1}"
}
set_cgi() {
- set_sapi "cgi" "${1}"
+ set_sapi cgi "${1}"
}
set_phpdbg() {
- set_sapi "dbg" "${1}"
+ set_sapi dbg "${1}"
}
set_fpm() {
- set_sapi "fpm" "${1}"
+ set_sapi fpm "${1}"
echo "Please restart php-fpm for the changes to take effect."
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: a84247840eb392d2e248a116828d8941d507b033
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 17:31:44 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 17:31:44 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=a8424784
Refactor most set_foo() functions to use set_sapi().
The set_sapi() function was accidentally introduced in commit 91160d1
but was not used until now. This commit finishes its implementation,
and refactors the "easy" SAPI set_* functions to use set_sapi(). The
set_apache2() function still requires more work.
src/php.eselect.in | 52 ++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index aa681f0..97e7940 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -373,17 +373,34 @@ list_phpdbg() {
}
+# Perform the "set" action for the given SAPI.
+#
+# INPUT:
+#
+# The first parameter is the SAPI name, and the second parameter is
+# the desired target.
+#
+# OUTPUT:
+#
+# None.
+#
set_sapi() {
local sapi="${1}"
local target="${2}"
local target_name=$(resolv_target "${sapi}" "${target}")
- [[ -z $t ]] && die -q "invalid target ${target} for SAPI ${sapi}"
+ [[ -z $target_name ]] && die -q "invalid target ${target} for SAPI ${sapi}"
+
+ local link_src_dir="../..$(get_active_libdir)/${target_name}/bin"
+ local link_dst_dir=$(sapi_active_link_dir "${sapi}")
- @LN_S@ --force "../..$(get_active_libdir)/${t}/bin/php-cgi" \
- "$(sapi_active_link_path cgi)" || \
- die -q "failed to create active php-cgi symlink"
+ for link_name in $(sapi_active_link_names "${sapi}"); do
+ @LN_S@ --force "${link_src_dir}/${link_name}" \
+ "${link_dst_dir}/${link_name}" || \
+ die -q "failed to create active ${link_name} symlink"
+ done
}
+
set_apache2() {
local active_symlink libdir major target=$(resolv_target apache2 $1)
active_symlink="$(sapi_active_link_path apache2)"
@@ -405,39 +422,22 @@ set_apache2() {
}
set_cli() {
- local file libdir t=$(resolv_target cli $1)
- [[ -z $t ]] && die -q "invalid target"
- for file in php phpize php-config; do
- @LN_S@ --force "../..$(get_active_libdir)/${t}/bin/${file}" \
- "${EROOT}/usr/bin/${file}" || \
- die -q "failed to create active ${file} symlink"
- done
+ set_sapi "cli" "${1}"
}
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_link_path cgi)" || \
- die -q "failed to create active php-cgi symlink"
+ set_sapi "cgi" "${1}"
}
set_phpdbg() {
- t=$(resolv_target dbg $1)
- [[ -z $t ]] && die -q "invalid target"
- @LN_S@ --force "../..$(get_active_libdir)/${t}/bin/phpdbg" \
- "$(sapi_active_link_path dbg)" || \
- die -q "failed to create active phpdbg symlink"
+ set_sapi "dbg" "${1}"
}
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_link_path fpm)" || \
- die -q "failed to create symlink for the php-fpm binary"
+ set_sapi "fpm" "${1}"
echo "Please restart php-fpm for the changes to take effect."
}
+
## set action
describe_set() {
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: 976d0542987023dfe6ba97e3e297c36e7317c1bd
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 18:33:08 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 18:33:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=976d0542
Refactor set_apache2() to use set_sapi().
With a little bit of mangling and a new (trivial) function, the
set_sapi() function now does the work of set_apache2(). There is
probably a better "big picture" to handle the symlinking, but this
works for now and is an improvement.
src/php.eselect.in | 69 ++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 49 insertions(+), 20 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 2e9ec8d..1288669 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -38,6 +38,38 @@ sapi_active_link_names() {
# Each SAPI provides a few (one or more) "active" links in a
+# predictable location. The target directory (where they point) is
+# fixed for a given SAPI, and this function returns it.
+#
+# The name "target" is unfortunate, but that's the terminology that
+# "ln" uses. The link_name is the name of the link on the filesystem,
+# and target is where it points.
+#
+# INPUT:
+#
+# The first parameter is the name of a SAPI. The second parameter is
+# the name of a target.
+#
+# OUTPUT:
+#
+# The directory to which the given SAPI's symlinks point. For example,
+# the "cli" sapi has three executable symlinks and all of them point
+# to executables in /usr/lib/phpX.Y/bin.
+#
+sapi_active_link_target_dir() {
+ local sapi="${1}"
+ local target="${2}"
+
+ local link_target_dir="${EROOT}$(get_active_libdir)/${target}/bin"
+ if [[ "${sapi}" == "apache2" ]] ; then
+ link_target_dir+="/../apache2"
+ fi
+
+ echo "${link_target_dir}"
+}
+
+
+# Each SAPI provides a few (one or more) "active" links in a
# predictable location. And fortunately that location is fixed for a
# given SAPI. For example, the "cgi" SAPI has its sole active symlink,
# /usr/bin/php-cgi, in /usr/bin. Given a SAPI name, we return the
@@ -390,34 +422,31 @@ set_sapi() {
local target_name=$(resolv_target "${sapi}" "${target}")
[[ -z $target_name ]] && die -q "invalid target ${target} for SAPI ${sapi}"
- local link_src_dir="../..$(get_active_libdir)/${target_name}/bin"
- local link_dst_dir=$(sapi_active_link_dir "${sapi}")
+ local link_tgt_dir=$(sapi_active_link_target_dir "${sapi}" "${target_name}")
+ local link_dir=$(sapi_active_link_dir "${sapi}")
for link_name in $(sapi_active_link_names "${sapi}"); do
- @LN_S@ --force "${link_src_dir}/${link_name}" \
- "${link_dst_dir}/${link_name}" || \
+ # 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
+
+ @LN_S@ --force "${link_tgt_dir}/${link_target}" \
+ "${link_dir}/${link_name}" || \
die -q "failed to create active ${link_name} symlink"
done
}
set_apache2() {
- local active_symlink libdir major target=$(resolv_target apache2 $1)
- active_symlink="$(sapi_active_link_path apache2)"
- 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${major}.so" \
- "${active_symlink}" || \
- die -q "failed to create active mod_php symlink"
- done
-
- write_mod_php_conf "${target}"
+ local target="${1}"
+ set_sapi apache2 "${target}"
+ write_mod_php_conf "$(resolv_target apache2 "${target}")"
echo "Please restart apache for the changes to take effect."
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
commit: b5940f040300a84e9ed321d22e6f110a05a631d6
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 8 17:16:32 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 8 17:16:32 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=b5940f04
Whitespace cleanup.
src/php.eselect.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 15792f3..aa681f0 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -32,7 +32,7 @@ sapi_active_link_names() {
fpm) echo "php-fpm" ;;
cgi) echo "php-cgi" ;;
dbg) echo "phpdbg" ;;
- *) die "invalid SAPI name: ${sapi}" ;;
+ *) die "invalid SAPI name: ${sapi}" ;;
esac
}
@@ -62,7 +62,7 @@ sapi_active_link_dir() {
fpm) echo "${bin_dir}" ;;
cgi) echo "${bin_dir}" ;;
dbg) echo "${bin_dir}" ;;
- *) die "invalid SAPI name: ${sapi}" ;;
+ *) die "invalid SAPI name: ${sapi}" ;;
esac
}
@@ -515,7 +515,7 @@ describe_update_options() {
}
do_update() {
- check_module $1
+ check_module $1
[[ -z ${2} || ( -z ${3} && ( ${2} == ifunset || ${2} == '--if-unset' ) ) ]] || \
die -q "Usage error"
@@ -524,7 +524,7 @@ do_update() {
return
fi
- update_sapi $1 || echo "Nothing to update"
+ update_sapi $1 || echo "Nothing to update"
}
## cleanup action
@@ -542,5 +542,5 @@ describe_cleanup_options() {
}
do_cleanup() {
- cleanup_sapis
+ cleanup_sapis
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-08 21:50 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-08 21:50 UTC (permalink / raw
To: gentoo-commits
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}" || \
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-09 2:24 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-09 2:24 UTC (permalink / raw
To: gentoo-commits
commit: 98bd99ab0dfb91297091b52fad8622b1b689b096
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 9 02:21:08 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 9 02:21:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=98bd99ab
Fix cleanup and update actions.
src/php.eselect.in | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index d19b93a..e0c208a 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -183,12 +183,13 @@ cleanup_sapis() {
}
cleanup_sapi() {
- local l=${1}_link
+ local sapi="${1}"
+ local l="${sapi}_link"
local link=${!l}
if [[ -L $link && ! -e $link ]] ; then
- echo -n "Broken link for $1"
+ echo -n "Broken link for ${sapi}"
if update_sapi $1 ; then
- echo ", updated version to $(get_active_$1)"
+ echo ", updated version to $(get_sapi_active_target "${sapi}")"
return
else
rm $link || die "failed to remove ${link}"
@@ -197,7 +198,7 @@ cleanup_sapi() {
fi
fi
- if [[ "${1}" == "apache2" ]]; then
+ if [[ "${sapi}" == "apache2" ]] ; then
rm -f "${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so" \
|| die "failed to remove old libphp.so symlink"
fi
@@ -206,11 +207,12 @@ cleanup_sapi() {
}
update_sapi() {
- local target=$(find_sapi_targets $1 | tail -n 1)
- local current=$(get_active_$1)
+ local sapi="${1}"
+ local target=$(find_sapi_targets "${sapi}" | tail -n 1)
+ local current=$(get_sapi_active_target "${sapi}")
[[ -z $target ]] && return 1
[[ $current = $target ]] && return 1
- set_$1 $target
+ set_$sapi $target
}
get_libdirs() {
@@ -580,16 +582,17 @@ describe_update_options() {
}
do_update() {
- check_module $1
+ local sapi="${1}"
+ check_module "${sapi}"
[[ -z ${2} || ( -z ${3} && ( ${2} == ifunset || ${2} == '--if-unset' ) ) ]] || \
die -q "Usage error"
- if [[ (${2} == ifunset || ${2} == '--if-unset') && -n $(get_active_$1) ]];
+ if [[ (${2} == ifunset || ${2} == '--if-unset') && -n $(get_sapi_active_target "${sapi}") ]];
then
return
fi
- update_sapi $1 || echo "Nothing to update"
+ update_sapi "${sapi}" || echo "Nothing to update"
}
## cleanup action
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-09 2:24 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-09 2:24 UTC (permalink / raw
To: gentoo-commits
commit: d4fe480eed309b82de1a2370ac85ae1d2367f17d
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 9 02:13:41 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 9 02:13:41 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=d4fe480e
Clean up check_module() a bit and give it some documentation.
src/php.eselect.in | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 26c43d8..d19b93a 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -382,8 +382,22 @@ resolv_target() {
fi
}
+
+# Die if the given module name is not valid.
+#
+# INPUT:
+#
+# A module name.
+#
+# OUTPUT:
+#
+# None; the function will die() if the given module name is invalid
+# (that is, not one of our declared $MODULES), and do nothing
+# otherwise.
+#
check_module() {
- has $1 $(echo $MODULES) || \
+ local module="${1}"
+ has "${module}" $MODULES || \
die -q "Please choose one of the following modules: ${MODULES}"
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-09 2:24 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-09 2:24 UTC (permalink / raw
To: gentoo-commits
commit: 41f92b84f7871ae913bf8a462b88a3808f1df208
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 9 02:00:11 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 9 02:00:11 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=41f92b84
Fix the "show" action for SAPIs other than phpdbg.
src/php.eselect.in | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index b47d218..d9c44f7 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -564,8 +564,9 @@ describe_show_options() {
}
do_show() {
- check_module $1
- get_active_$1
+ local sapi="${1}"
+ check_module "${sapi}"
+ get_sapi_active_target "${sapi}"
}
## update action
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-09 2:24 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-09 2:24 UTC (permalink / raw
To: gentoo-commits
commit: a8bf1158974984c91ccbe8c83c74f41c7c51337d
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 9 02:03:04 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 9 02:03:04 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=a8bf1158
Remove superfluous list_foo() functions.
src/php.eselect.in | 25 +++----------------------
1 file changed, 3 insertions(+), 22 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index efd52c2..26c43d8 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -412,26 +412,6 @@ list_sapi() {
write_numbered_list -m "(none found)" "${targets[@]}"
}
-list_apache2() {
- list_sapi apache2
-}
-
-list_cli() {
- list_sapi cli
-}
-
-list_cgi() {
- list_sapi cgi
-}
-
-list_fpm() {
- list_sapi fpm
-}
-
-list_dbg() {
- list_sapi dbg
-}
-
# Perform the "set" action for the given SAPI.
#
@@ -545,8 +525,9 @@ describe_list_options() {
}
do_list() {
- check_module $1
- list_$1
+ local sapi="${1}"
+ check_module "${sapi}"
+ list_sapi "${sapi}"
}
## Show action
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-09 2:24 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-09 2:24 UTC (permalink / raw
To: gentoo-commits
commit: 5ebfa5ec899c6a0827e4f60c06cdadeb2e2c2dd9
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 9 02:01:30 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 9 02:01:30 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=5ebfa5ec
Rename "phpdbg" to "dbg" for consistency and to fix its show action.
src/php.eselect.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index d9c44f7..efd52c2 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -6,7 +6,7 @@ inherit config multilib
DESCRIPTION="Manage php installations"
MAINTAINER="php-bugs@gentoo.org"
-MODULES="cli apache2 fpm cgi phpdbg"
+MODULES="cli apache2 fpm cgi dbg"
#
# Output a list of link names (not full paths) belonging to the given
@@ -428,7 +428,7 @@ list_fpm() {
list_sapi fpm
}
-list_phpdbg() {
+list_dbg() {
list_sapi dbg
}
@@ -498,7 +498,7 @@ set_cgi() {
set_sapi cgi "${1}"
}
-set_phpdbg() {
+set_dbg() {
set_sapi dbg "${1}"
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-09 17:20 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-09 17:20 UTC (permalink / raw
To: gentoo-commits
commit: 86c833863a6febca1f1bd4c8408239853ed3acfb
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 9 17:14:24 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 9 17:14:24 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=86c83386
Consolidate all of the set_foo() functions.
src/php.eselect.in | 43 ++++++++++++++++---------------------------
1 file changed, 16 insertions(+), 27 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 8f752e4..9970520 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -463,6 +463,9 @@ set_sapi() {
# configuration with -DPHP5 and 70_mod_php5.conf. If he is, warn him
# that it is outdated, and that his eselect choices will not have any
# effect until the configuration is updated.
+#
+# This can be removed after around a year.
+#
apache2_php5_config_check() {
if [ -f "${EROOT}/etc/apache2/modules.d/70_mod_php5.conf" ] ; then
local msg
@@ -478,31 +481,6 @@ apache2_php5_config_check() {
fi
}
-set_apache2() {
- apache2_php5_config_check
- local target="${1}"
- set_sapi apache2 "${target}"
- write_mod_php_conf "$(resolv_target apache2 "${target}")"
- echo "Please restart apache for the changes to take effect."
-}
-
-set_cli() {
- set_sapi cli "${1}"
-}
-
-set_cgi() {
- set_sapi cgi "${1}"
-}
-
-set_phpdbg() {
- set_sapi phpdbg "${1}"
-}
-
-set_fpm() {
- set_sapi fpm "${1}"
- echo "Please restart php-fpm for the changes to take effect."
-}
-
## set action
describe_set() {
@@ -520,8 +498,19 @@ describe_set_options() {
do_set() {
- check_module $1
- set_$1 $2
+ local sapi="${1}"
+ local target="${2}"
+ check_module "${sapi}"
+
+ set_sapi "${sapi}" "${target}"
+
+ if [[ "${sapi}" == "apache2" ]]; then
+ apache2_php5_config_check
+ write_mod_php_conf "$(resolv_target apache2 "${target}")"
+ echo "Please restart apache for the changes to take effect."
+ elif [[ "${sapi}" == "fpm" ]]; then
+ echo "Please restart php-fpm for the changes to take effect."
+ fi
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-09 17:20 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-09 17:20 UTC (permalink / raw
To: gentoo-commits
commit: 05ad4ef371b474d9f86ca8236881022e4f8f7bb0
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 9 17:06:03 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 9 17:06:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=05ad4ef3
Undo the change from phpdbg -> dbg, using "phpdbg" everywhere makes more sense.
src/php.eselect.in | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index e0c208a..8f752e4 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -6,7 +6,7 @@ inherit config multilib
DESCRIPTION="Manage php installations"
MAINTAINER="php-bugs@gentoo.org"
-MODULES="cli apache2 fpm cgi dbg"
+MODULES="cli apache2 fpm cgi phpdbg"
#
# Output a list of link names (not full paths) belonging to the given
@@ -31,7 +31,7 @@ sapi_active_link_names() {
cli) echo "php phpize php-config" ;;
fpm) echo "php-fpm" ;;
cgi) echo "php-cgi" ;;
- dbg) echo "phpdbg" ;;
+ phpdbg) echo "phpdbg" ;;
*) die "invalid SAPI name: ${sapi}" ;;
esac
}
@@ -121,7 +121,7 @@ sapi_active_link_dir() {
cli) echo "${bin_dir}" ;;
fpm) echo "${bin_dir}" ;;
cgi) echo "${bin_dir}" ;;
- dbg) echo "${bin_dir}" ;;
+ phpdbg) echo "${bin_dir}" ;;
*) die "invalid SAPI name: ${sapi}" ;;
esac
}
@@ -272,7 +272,7 @@ find_sapi_targets() {
cli) pattern_suffix="bin/php" ;;
fpm) pattern_suffix="bin/php-fpm" ;;
cgi) pattern_suffix="bin/php-cgi" ;;
- dbg) pattern_suffix="bin/phpdbg" ;;
+ phpdbg) pattern_suffix="bin/phpdbg" ;;
*) die "invalid SAPI name: ${sapi}" ;;
esac
@@ -494,8 +494,8 @@ set_cgi() {
set_sapi cgi "${1}"
}
-set_dbg() {
- set_sapi dbg "${1}"
+set_phpdbg() {
+ set_sapi phpdbg "${1}"
}
set_fpm() {
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-20 14:42 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-20 14:42 UTC (permalink / raw
To: gentoo-commits
commit: 64f783dff3a2d62de670c8a5994d012751d2440e
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 20 14:40:00 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Jan 20 14:40:00 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=64f783df
Fix cleanup up libphp[57].so symlinks.
The cleanup() action is supposed to remove the old links to libphp5.so
and libphp7.so, but the pattern was accidentally quoted and thus
nothing was removed. Unquote it so that those symlinks will actually
be removed.
Gentoo-Bug: 572436
src/php.eselect.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in b/src/php.eselect.in
index 9970520..b2a0dd5 100644
--- a/src/php.eselect.in
+++ b/src/php.eselect.in
@@ -199,7 +199,7 @@ cleanup_sapi() {
fi
if [[ "${sapi}" == "apache2" ]] ; then
- rm -f "${EROOT}$(get_active_libdir)/apache2/modules/libphp[57].so" \
+ rm -f "${EROOT}$(get_active_libdir)"/apache2/modules/libphp[57].so \
|| die "failed to remove old libphp.so symlink"
fi
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 3:15 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 3:15 UTC (permalink / raw
To: gentoo-commits
commit: bd79e633184e446b6e0985e80539dd7ce6c81a62
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 00:00:32 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 00:00:32 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=bd79e633
Replace custom bindir handling with the new autotools magic.
As a first test of the new directory substitution, replace one
instance of custom bindir handling. Use @bindir@ instead of
"${EROOT}/usr/bin" sapi_active_link_dir(). The results should
coincide when configured with,
./configure --bindir="${EROOT}"/usr/bin
src/php.eselect.in.in | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index b2a0dd5..e24cd39 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -114,14 +114,13 @@ sapi_active_link_target_dir() {
#
sapi_active_link_dir() {
local sapi="${1}"
- local bin_dir="${EROOT}/usr/bin"
case "${sapi}" in
apache2) echo "${EROOT}$(get_active_libdir)/apache2/modules" ;;
- cli) echo "${bin_dir}" ;;
- fpm) echo "${bin_dir}" ;;
- cgi) echo "${bin_dir}" ;;
- phpdbg) echo "${bin_dir}" ;;
+ cli) echo "@bindir@" ;;
+ fpm) echo "@bindir@" ;;
+ cgi) echo "@bindir@" ;;
+ phpdbg) echo "@bindir@" ;;
*) die "invalid SAPI name: ${sapi}" ;;
esac
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 3:15 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 3:15 UTC (permalink / raw
To: gentoo-commits
commit: 32f6c1c424df3e8f7ed9705323e2911ee43b7696
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 02:11:54 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 02:11:54 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=32f6c1c4
Clean up and document find_targets().
src/php.eselect.in.in | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 0c83de7..e1edb42 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -214,15 +214,17 @@ update_sapi() {
set_$sapi $target
}
-find_targets() {
- local dirs
-
- for dir in "@libdir@"/php*.*; do
- t=$(basename $dir)
- has $t $dirs || dirs="${dirs} $t"
- done
- echo $dirs
+#
+# Find all valid target names by searching libdir for directories like
+# php5.6, php7.0, etc.
+#
+# OUTPUT:
+#
+# A space-separated list of target names, for example, "php5.6 php7.0".
+#
+find_targets() {
+ cd "@LIBDIR@" && echo php*.*
}
# List all valid targets for the given SAPI. The list is obtained by
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 3:15 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 3:15 UTC (permalink / raw
To: gentoo-commits
commit: 34ff75367a2941a99339a9ea46bf6faaad270f0f
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 03:11:51 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 03:11:51 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=34ff7536
Add a TODO to find_targets() about an error condition.
src/php.eselect.in.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index d3428bd..ff3914f 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -224,6 +224,9 @@ update_sapi() {
# A space-separated list of target names, for example, "php5.6 php7.0".
#
find_targets() {
+ # TODO: when there aren't any phpX.Y directories, this returns
+ # "php*.*". This doesn't seem to bother our consumers, but it
+ # would probably be more polite to return nothing in that case.
cd "@LIBDIR@" && echo php*.*
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 3:15 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 3:15 UTC (permalink / raw
To: gentoo-commits
commit: 71d449ab84cacc518b6a11c891feed86367c8244
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 01:47:16 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 01:47:16 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=71d449ab
Replace get_libdirs() and get_active_libdir() with autotools magic.
The get_libdirs() function is a heuristic to determine which libdirs
are available on the system. The get_active_libdir() function then
chose the first one as the "active" libdir. In a few places we either
chose the "active" libdir, or looped through all of them to find some
other thing of interest (like the valid targets).
Now that we compute @libdir@ at build time, we can replace all of that
with the one correct value of @libdir@. The functions get_libdirs()
and get_active_libdir() are removed entirely.
src/php.eselect.in.in | 47 +++++++++++++----------------------------------
1 file changed, 13 insertions(+), 34 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 689b1db..0c83de7 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -88,7 +88,7 @@ sapi_active_link_target_dir() {
local sapi="${1}"
local target="${2}"
- local link_target_dir="${EROOT}$(get_active_libdir)/${target}/bin"
+ local link_target_dir="@libdir@/${target}/bin"
if [[ "${sapi}" == "apache2" ]] ; then
link_target_dir+="/../apache2"
fi
@@ -116,7 +116,7 @@ sapi_active_link_dir() {
local sapi="${1}"
case "${sapi}" in
- apache2) echo "${EROOT}$(get_active_libdir)/apache2/modules" ;;
+ apache2) echo "@libdir@/apache2/modules" ;;
cli) echo "@bindir@" ;;
fpm) echo "@bindir@" ;;
cgi) echo "@bindir@" ;;
@@ -198,7 +198,7 @@ cleanup_sapi() {
fi
if [[ "${sapi}" == "apache2" ]] ; then
- rm -f "${EROOT}$(get_active_libdir)"/apache2/modules/libphp[57].so \
+ rm -f "@libdir@"/apache2/modules/libphp[57].so \
|| die "failed to remove old libphp.so symlink"
fi
@@ -214,35 +214,15 @@ update_sapi() {
set_$sapi $target
}
-get_libdirs() {
- local dir libdirs
- for dir in $(list_libdirs); do
- [[ -L ${EROOT}/usr/${dir} ]] && continue
- ls "${EROOT}"/usr/${dir}/php*.* > /dev/null 2>&1 || continue
-
- libdirs+=' '/usr/${dir}
- done
- echo ${libdirs:-/usr/lib}
-}
+find_targets() {
+ local dirs
-get_active_libdir() {
- local dir
- for dir in $(get_libdirs); do
- echo ${dir}
- return
+ for dir in "@libdir@"/php*.*; do
+ t=$(basename $dir)
+ has $t $dirs || dirs="${dirs} $t"
done
- echo /usr/lib
-}
-find_targets() {
- local dir dirs libdir
- for libdir in $(get_libdirs); do
- for dir in "${EROOT}"${libdir}/php*.*; do
- t=$(basename $dir)
- has $t $dirs || dirs="${dirs} $t"
- done
- done
- echo $dirs
+ echo $dirs
}
# List all valid targets for the given SAPI. The list is obtained by
@@ -276,11 +256,10 @@ find_sapi_targets() {
esac
for target in $(find_targets); do
- for libdir in $(get_libdirs); do
- local pattern="${EROOT}${libdir}/${target}/${pattern_suffix}"
- for file in $pattern; do
- [[ -f "${file}" ]] && echo "${target}"
- done
+ local pattern="@libdir@/${target}/${pattern_suffix}"
+
+ for file in $pattern; do
+ [[ -f "${file}" ]] && echo "${target}"
done
done | @SORT@ | @UNIQ@
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:14 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:14 UTC (permalink / raw
To: gentoo-commits
commit: d50f77c79f3a7e2ce129ef69ff4cc662d1b95ad6
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 18:19:34 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:19:34 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=d50f77c7
Clean up and document the cleanup_sapi() function.
src/php.eselect.in.in | 47 +++++++++++++++++++++++++++++++++--------------
1 file changed, 33 insertions(+), 14 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 7e52f53..63b9d42 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -173,23 +173,42 @@ parse_target_major_version() {
esac
}
+# Remove dead active symlinks for the given SAPI.
+#
+# If a symlink for an SAPI is dead, then that SAPI is at least
+# partially broken. For example, if the symlink to php-cgi is dead,
+# then CGI just isn't going to work -- the SAPI is broken. It
+# therefore makes sense to run update() after we find and remove any
+# broken links. The update at least has the potential to leave things
+# working.
+#
+# There is one potential caveat to that approach, for SAPIs with more
+# than one active symlink. What if "phpize" is broken but "php" is OK?
+# (Forget for the moment how that might happen...). Do we want to
+# update() the entire SAPI because one of the symlinks is dead?
+# Answer: I guess.
+#
+# INPUT:
+#
+# The name of the SAPI to clean up.
+#
+# OUTPUT:
+#
+# If any symlinks are removed, that fact will be announced. If an
+# update occurs, that will be noted as well
+#
cleanup_sapi() {
local sapi="${1}"
- local l="${sapi}_link"
- local link=${!l}
- if [[ -L $link && ! -e $link ]] ; then
- echo -n "Broken link for ${sapi}"
- if update_sapi $1 ; then
- echo ", updated version to $(get_sapi_active_target "${sapi}")"
- return
- else
- rm $link || die "failed to remove ${link}"
-
- return
- fi
- fi
+ local link_dir=$(sapi_active_link_dir "${sapi}")
- return 1
+ for link_name in $(sapi_active_link_names "${sapi}"); do
+ local link_path="${link_dir}/${link_name}"
+ if [[ -L "${link_path}" && ! -e "${link_path}" ]] ; then
+ rm -f "${link_path}" || die "failed to remove ${link_path}"
+ echo "Removed broken symlink ${link_path}."
+ update_sapi "${sapi}" # Try to fix it.
+ fi
+ done
}
update_sapi() {
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:14 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:14 UTC (permalink / raw
To: gentoo-commits
commit: 2b82d0c0c967f59f5993bea53bb5dd86693beef0
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 17:47:43 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 17:47:43 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=2b82d0c0
Remove cleanup_sapis() and ensmarten the libphp[57].so symlink removal.
The cleanup_sapis() function was only called in one place, so it was a
pointless layer of indirection. Move it into do_cleanup(). Also, make
sure we don't remove libphp[57].so symlinks unless they're actually
symlinks and in fact dead.
src/php.eselect.in.in | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index ff3914f..7e52f53 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -173,14 +173,6 @@ parse_target_major_version() {
esac
}
-cleanup_sapis() {
- local m
- local link
- for m in $MODULES ; do
- cleanup_sapi $m
- done
-}
-
cleanup_sapi() {
local sapi="${1}"
local l="${sapi}_link"
@@ -197,11 +189,6 @@ cleanup_sapi() {
fi
fi
- if [[ "${sapi}" == "apache2" ]] ; then
- rm -f "@LIBDIR@"/apache2/modules/libphp[57].so \
- || die "failed to remove old libphp.so symlink"
- fi
-
return 1
}
@@ -582,5 +569,18 @@ describe_cleanup_options() {
}
do_cleanup() {
- cleanup_sapis
+ for sapi in $MODULES ; do
+ cleanup_sapi "${sapi}"
+ done
+
+ # Remove older (and dead) apache2 symlinks. These days the symlink
+ # is called mod_php.so. This cleanup code can be removed after a
+ # while, after we think most people will have switched to the new
+ # symlink and removed the old one.
+ for link in "@LIBDIR@"/apache2/modules/libphp[57].so; do
+ if [[ -L "${link}" && ! -e "${link}" ]] ; then
+ rm -f "${link}" || die "failed to remove old libphp.so symlink"
+ echo "Removed broken symlink ${link}."
+ fi
+ done
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:14 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:14 UTC (permalink / raw
To: gentoo-commits
commit: caac4444f99bcef4161a416af8d1f678314a3e80
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 19:01:41 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 19:01:41 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=caac4444
Add a "modules" action to list all valid modules (requested in bug 491866).
Gentoo-Bug: 491866
src/php.eselect.in.in | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index db7a96f..2467ce3 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -619,3 +619,13 @@ do_cleanup() {
fi
done
}
+
+## modules action
+
+describe_modules() {
+ echo "List all valid modules, separated by spaces"
+}
+
+do_modules() {
+ echo "${MODULES}"
+}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:14 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:14 UTC (permalink / raw
To: gentoo-commits
commit: e64cb2825a6429fcb3e7c760538bcfa3890faa97
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 19:13:14 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 19:13:14 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=e64cb282
Rename the "modules" action to "list-modules".
The name "list-modules" was always more appropriate; it just took a
moment to realize that "-" is valid in bash function names.
src/php.eselect.in.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index ac05d3a..8f241ce 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -620,12 +620,12 @@ do_cleanup() {
done
}
-## modules action
+## list-modules action
-describe_modules() {
+describe_list-modules() {
echo "output a space-separated list of valid modules"
}
-do_modules() {
+do_list-modules() {
echo "${MODULES}"
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:14 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:14 UTC (permalink / raw
To: gentoo-commits
commit: e70582051f77f157be6038683f1dac8a2a079800
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 18:53:53 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:53:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=e7058205
Remove the word "automatically" from the cleanup description.
src/php.eselect.in.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 63b9d42..a9c6efd 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -576,7 +576,7 @@ do_update() {
## cleanup action
describe_cleanup() {
- echo "Automatically clean up stale links"
+ echo "Clean up stale links"
}
describe_cleanup_parameters() {
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:14 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:14 UTC (permalink / raw
To: gentoo-commits
commit: 6c32b7cef3c114a4b134af2296a867bba5e717e2
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 19:12:10 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 19:12:10 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=6c32b7ce
Cosmetic changes to help text.
src/php.eselect.in.in | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 2467ce3..ac05d3a 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -492,7 +492,7 @@ apache2_php5_config_check() {
## set action
describe_set() {
- echo "Sets the current configuration for a module"
+ echo "make <target> active for <module>"
}
describe_set_parameters() {
@@ -500,8 +500,8 @@ describe_set_parameters() {
}
describe_set_options() {
- echo "module: one of ${MODULES}"
- echo "target: Target name or number (from the 'list' action)"
+ echo "module: one of: ${MODULES}"
+ echo "target: target name or number (from the \"list\" action)"
}
@@ -526,7 +526,7 @@ do_set() {
## List action
describe_list() {
- echo "Lists available php installs for a module"
+ echo "lists valid targets for <module>"
}
describe_list_parameters() {
@@ -534,7 +534,7 @@ describe_list_parameters() {
}
describe_list_options() {
- echo "module: one of ${MODULES}"
+ echo "module: one of: ${MODULES}"
}
do_list() {
@@ -546,7 +546,7 @@ do_list() {
## Show action
describe_show() {
- echo "Lists available php installs for a module"
+ echo "show the active target for <module>"
}
describe_show_parameters() {
@@ -554,7 +554,7 @@ describe_show_parameters() {
}
describe_show_options() {
- echo "module: one of ${MODULES}"
+ echo "module: one of: ${MODULES}"
}
do_show() {
@@ -566,7 +566,7 @@ do_show() {
## update action
describe_update() {
- echo "Automatically update the php versions"
+ echo "update <module> to latest target"
}
describe_update_parameters() {
@@ -574,8 +574,8 @@ describe_update_parameters() {
}
describe_update_options() {
- echo "module: one of ${MODULES}"
- echo "ifunset : Do not override existing implementation"
+ echo "module: one of: ${MODULES}"
+ echo "--if-unset: do nothing if <module> target already exists"
}
do_update() {
@@ -600,7 +600,7 @@ do_update() {
## cleanup action
describe_cleanup() {
- echo "Clean up stale links"
+ echo "remove and try to fix stale links"
}
do_cleanup() {
@@ -623,7 +623,7 @@ do_cleanup() {
## modules action
describe_modules() {
- echo "List all valid modules, separated by spaces"
+ echo "output a space-separated list of valid modules"
}
do_modules() {
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:14 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:14 UTC (permalink / raw
To: gentoo-commits
commit: 370b720eb65f976d7a7e2b95b6a9f0b9ccae86d3
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 19:00:34 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 19:00:34 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=370b720e
Remove useless describe_cleanup_parameters() and describe_cleanup_options().
src/php.eselect.in.in | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 4e5e4b7..db7a96f 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -603,14 +603,6 @@ describe_cleanup() {
echo "Clean up stale links"
}
-describe_cleanup_parameters() {
- echo
-}
-
-describe_cleanup_options() {
- echo
-}
-
do_cleanup() {
for sapi in $MODULES ; do
cleanup_sapi "${sapi}"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:14 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:14 UTC (permalink / raw
To: gentoo-commits
commit: 56261aef608438c77df89aa5782cd9285d5f9d2f
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 18:54:59 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:54:59 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=56261aef
Document and fix the update functionality.
The update_sapi() function was not working due to a call to set_$sapi
that was never caught. Some of the logic in both do_update() and
update_sapi() was clarified, and the update_sapi() function was
documented. The "update" action and "cleanup" (which uses it) now work
as expected.
src/php.eselect.in.in | 46 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 11 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index a9c6efd..4e5e4b7 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -211,13 +211,32 @@ cleanup_sapi() {
done
}
+
+# Update the given SAPI to the latest valid target.
+#
+# The "latest" target is really just the last available one in the
+# list for this SAPI.
+#
+# INPUT:
+#
+# The name of a SAPI.
+#
+# OUTPUT:
+#
+# An error code "1" is returned if there are no valid targets for the
+# given SAPI. Otherwise, we return whatever comes back from set_sapi()
+#
update_sapi() {
local sapi="${1}"
- local target=$(find_sapi_targets "${sapi}" | tail -n 1)
- local current=$(get_sapi_active_target "${sapi}")
- [[ -z $target ]] && return 1
- [[ $current = $target ]] && return 1
- set_$sapi $target
+ local latest_target=$(find_sapi_targets "${sapi}" | tail -n 1)
+
+ # No valid targets?
+ [[ -z "${latest_target}" ]] && return 1
+
+ # Proceed even if the current target is the latest one. This can
+ # fix issues where, for example, the "phpize" symlink is broken
+ # but "php" is fine and points to the latest target.
+ set_sapi "${sapi}" "${latest_target}"
}
@@ -551,7 +570,7 @@ describe_update() {
}
describe_update_parameters() {
- echo "<module> [ifunset]"
+ echo "<module> [--if-unset]"
}
describe_update_options() {
@@ -561,13 +580,18 @@ describe_update_options() {
do_update() {
local sapi="${1}"
+ local ifunset="${2}"
+
+ # Input sanity check.
check_module "${sapi}"
- [[ -z ${2} || ( -z ${3} && ( ${2} == ifunset || ${2} == '--if-unset' ) ) ]] || \
- die -q "Usage error"
- if [[ (${2} == ifunset || ${2} == '--if-unset') && -n $(get_sapi_active_target "${sapi}") ]];
- then
- return
+ # Older versions listed the flag as "ifunset" insted of "--if-unset".
+ if [[ "${ifunset}" == "ifunset" || "${ifunset}" == "--if-unset" ]] ; then
+ if [[ -n $(get_sapi_active_target "${sapi}") ]] ; then
+ # There's already an active target for this SAPI, and the
+ # user asked us to leave it alone. So we leave it alone.
+ return
+ fi
fi
update_sapi "${sapi}" || echo "Nothing to update"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 19:42 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 19:42 UTC (permalink / raw
To: gentoo-commits
commit: 1ec7766a328e2ff7f35086f71a4307d188d29b50
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 19:16:35 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 19:16:35 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=1ec7766a
Don't inherit config or multilib.
These two inherit commands are no longer needed. We don't use
list_libdirs() anymore thanks to autotools, and I don't think the
config functions were ever needed recently.
src/php.eselect.in.in | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 8f241ce..603dced 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -1,11 +1,8 @@
# Copyright 2010-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-inherit config multilib
-
DESCRIPTION="Manage php installations"
MAINTAINER="php-bugs@gentoo.org"
-
MODULES="cli apache2 fpm cgi phpdbg"
#
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2016-01-22 20:53 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2016-01-22 20:53 UTC (permalink / raw
To: gentoo-commits
commit: 0c235fbacfaf5e741ea6d613eb531541e7e66368
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 20:51:08 2016 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 20:51:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=0c235fba
Move the apache conf file writing into set_sapi().
When the apache conf file was being written in do_set(), it was
avoidable by e.g. update_sapi(). That could prevent apache2 from
restarting. Since do_set() calls set_sapi() anyway, we just move
the conf file writing to the end of set_sapi().
src/php.eselect.in.in | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 603dced..8e25f96 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -461,6 +461,17 @@ set_sapi() {
"${link_dir}/${link_name}" || \
die -q "failed to create active ${link_name} symlink"
done
+
+ # The call to write_mod_php_conf() in particular needs to take
+ # place here, in set_sapi(), since otherwise it can get skipped by
+ # e.g. the update_sapi() function.
+ if [[ "${sapi}" == "apache2" ]]; then
+ apache2_php5_config_check
+ write_mod_php_conf "${target_name}"
+ echo "Please restart apache for the changes to take effect."
+ elif [[ "${sapi}" == "fpm" ]]; then
+ echo "Please restart php-fpm for the changes to take effect."
+ fi
}
@@ -508,14 +519,6 @@ do_set() {
check_module "${sapi}"
set_sapi "${sapi}" "${target}"
-
- if [[ "${sapi}" == "apache2" ]]; then
- apache2_php5_config_check
- write_mod_php_conf "$(resolv_target apache2 "${target}")"
- echo "Please restart apache for the changes to take effect."
- elif [[ "${sapi}" == "fpm" ]]; then
- echo "Please restart php-fpm for the changes to take effect."
- fi
}
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2018-04-12 2:24 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2018-04-12 2:24 UTC (permalink / raw
To: gentoo-commits
commit: 6a99c6752efc2fb6180c3a453ae5b641b67f662e
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 12 02:15:03 2018 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Apr 12 02:22:46 2018 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=6a99c675
src/php.eselect.in.in: use "-f" option to "ln" for POSIX compatibility.
On FreeBSD, we're getting an error:
ln: illegal option -- -
usage: ln [-s [-F] | -L | -P] [-f | -i] [-hnv] source_file [target_file]
...
!!! Error: failed to create active php symlink
This is due to our use of the "--force" flag, which is not POSIX. In
the latest standard (IEEE Std 1003.1-2017), only the short "-f" flag
is guaranteed to exist, and FreeBSD's "ln" seems to mostly support the
flag as specified there. So, I've changed "--force" to "-f", and left
a warning to future generations in a nearby comment.
Bug: https://bugs.gentoo.org/649270
src/php.eselect.in.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 8e25f96..889f541 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -457,7 +457,8 @@ set_sapi() {
for link_name in $(sapi_active_link_names "${sapi}"); do
local link_target=$(sapi_link_name_target "${sapi}" "${target_name}" "${link_name}")
- @LN_S@ --force "${link_tgt_dir}/${link_target}" \
+ # Use the short "-f" option for POSIX compatibility.
+ @LN_S@ -f "${link_tgt_dir}/${link_target}" \
"${link_dir}/${link_name}" || \
die -q "failed to create active ${link_name} symlink"
done
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2020-02-12 22:30 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2020-02-12 22:30 UTC (permalink / raw
To: gentoo-commits
commit: 5c56663ce61eba748ab0f6dce1588593d531fe5b
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 12 22:28:28 2020 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Feb 12 22:30:10 2020 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=5c56663c
src/php.eselect.in.in: remove old pre-php-7.x compatibility code.
The comments told me to remove this code after a while. I trust myself.
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
src/php.eselect.in.in | 34 ----------------------------------
1 file changed, 34 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 889f541..290d2ff 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -467,7 +467,6 @@ set_sapi() {
# place here, in set_sapi(), since otherwise it can get skipped by
# e.g. the update_sapi() function.
if [[ "${sapi}" == "apache2" ]]; then
- apache2_php5_config_check
write_mod_php_conf "${target_name}"
echo "Please restart apache for the changes to take effect."
elif [[ "${sapi}" == "fpm" ]]; then
@@ -476,28 +475,6 @@ set_sapi() {
}
-# Check to see if the user is still using the old-style apache
-# configuration with -DPHP5 and 70_mod_php5.conf. If he is, warn him
-# that it is outdated, and that his eselect choices will not have any
-# effect until the configuration is updated.
-#
-# This can be removed after around a year.
-#
-apache2_php5_config_check() {
- if [ -f "${EROOT}/etc/apache2/modules.d/70_mod_php5.conf" ] ; then
- local msg
- write_warning_msg "The apache2 configuration has changed in this"
- write_warning_msg "version of eselect-php. You should define \"-D PHP\""
- write_warning_msg "and not \"-D PHP5\" for apache. The module is now"
- write_warning_msg "loaded by 70_mod_php.conf (was 70_mod_php5.conf)."
- write_warning_msg "After you have changed \"-D PHP5\" to \"-D PHP\", "
- write_warning_msg "you should remove 70_mod_php5.conf to eliminate"
- write_warning_msg "this warning. Until you have done so, your eselect"
- write_warning_msg "choices for apache2 will have no effect."
- echo
- fi
-}
-
## set action
describe_set() {
@@ -608,17 +585,6 @@ do_cleanup() {
for sapi in $MODULES ; do
cleanup_sapi "${sapi}"
done
-
- # Remove older (and dead) apache2 symlinks. These days the symlink
- # is called mod_php.so. This cleanup code can be removed after a
- # while, after we think most people will have switched to the new
- # symlink and removed the old one.
- for link in "@LIBDIR@"/apache2/modules/libphp[57].so; do
- if [[ -L "${link}" && ! -e "${link}" ]] ; then
- rm -f "${link}" || die "failed to remove old libphp.so symlink"
- echo "Removed broken symlink ${link}."
- fi
- done
}
## list-modules action
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2020-02-29 22:16 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2020-02-29 22:16 UTC (permalink / raw
To: gentoo-commits
commit: 3c19c8620a6e7aef01496d0d0f72162f1964f3d9
Author: Stefan Langenmaier <stefan.langenmaier <AT> gmail <DOT> com>
AuthorDate: Wed Feb 12 16:24:53 2020 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Feb 29 00:31:29 2020 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=3c19c862
respect ROOT env variable
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
src/php.eselect.in.in | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 290d2ff..a047c62 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -113,11 +113,11 @@ sapi_active_link_dir() {
local sapi="${1}"
case "${sapi}" in
- apache2) echo "@LIBDIR@/apache2/modules" ;;
- cli) echo "@BINDIR@" ;;
- fpm) echo "@BINDIR@" ;;
- cgi) echo "@BINDIR@" ;;
- phpdbg) echo "@BINDIR@" ;;
+ apache2) echo "${ROOT%/}@LIBDIR@/apache2/modules" ;;
+ cli) echo "${ROOT%/}@BINDIR@" ;;
+ fpm) echo "${ROOT%/}@BINDIR@" ;;
+ cgi) echo "${ROOT%/}@BINDIR@" ;;
+ phpdbg) echo "${ROOT%/}@BINDIR@" ;;
*) die "invalid SAPI name: ${sapi}" ;;
esac
}
@@ -249,7 +249,7 @@ find_targets() {
# TODO: when there aren't any phpX.Y directories, this returns
# "php*.*". This doesn't seem to bother our consumers, but it
# would probably be more polite to return nothing in that case.
- cd "@LIBDIR@" && echo php*.*
+ cd "${ROOT%/}@LIBDIR@" && echo php*.*
}
# List all valid targets for the given SAPI. The list is obtained by
@@ -283,7 +283,7 @@ find_sapi_targets() {
esac
for target in $(find_targets); do
- local pattern="@LIBDIR@/${target}/${pattern_suffix}"
+ local pattern="${ROOT%/}@LIBDIR@/${target}/${pattern_suffix}"
for file in $pattern; do
[[ -f "${file}" ]] && echo "${target}"
@@ -338,7 +338,7 @@ get_sapi_active_target() {
#
write_mod_php_conf() {
local target="${1}"
- local conf_dir="@LOCALSTATEDIR@/lib/eselect-php"
+ local conf_dir="${ROOT%/}@LOCALSTATEDIR@/lib/eselect-php"
local conf_path="${conf_dir}/mod_php.conf"
@MKDIR_P@ "${conf_dir}" || die "failed to create ${conf_dir}"
@@ -516,6 +516,11 @@ describe_list_options() {
}
do_list() {
+ if [ "${ROOT%/}" != "" ] ; then
+ local msg
+ write_warning_msg "ROOT only supported in setting the configuration"
+ echo
+ fi
local sapi="${1}"
check_module "${sapi}"
list_sapi "${sapi}"
@@ -536,6 +541,11 @@ describe_show_options() {
}
do_show() {
+ if [ "${ROOT%/}" != "" ] ; then
+ local msg
+ write_warning_msg "ROOT only supported in setting the configuration"
+ echo
+ fi
local sapi="${1}"
check_module "${sapi}"
get_sapi_active_target "${sapi}"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2020-02-29 22:16 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2020-02-29 22:16 UTC (permalink / raw
To: gentoo-commits
commit: a4c6e0989d1233ba475b0b890d9d084b113682be
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 29 00:46:24 2020 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Feb 29 22:00:00 2020 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=a4c6e098
src/php.eselect.in.in: enable nullglob during find_targets().
While it didn't appear to hurt anything, the find_targets() function
could output a literal "php*.*" when there were no valid PHP targets.
Now the "nullglob" shell option is enabled during that function.
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
src/php.eselect.in.in | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index a047c62..12ef1e1 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -246,10 +246,12 @@ update_sapi() {
# A space-separated list of target names, for example, "php5.6 php7.0".
#
find_targets() {
- # TODO: when there aren't any phpX.Y directories, this returns
- # "php*.*". This doesn't seem to bother our consumers, but it
- # would probably be more polite to return nothing in that case.
+ # Temporarily enable the "nullglob" shell option to ensure that we
+ # don't return a literal "php*.*" when there are no valid targets.
+ local shopt_nullglob_saved=$(shopt -p nullglob)
+ shopt -s nullglob
cd "${ROOT%/}@LIBDIR@" && echo php*.*
+ ${shopt_nullglob_saved}
}
# List all valid targets for the given SAPI. The list is obtained by
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2020-02-29 22:16 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2020-02-29 22:16 UTC (permalink / raw
To: gentoo-commits
commit: 9f957137544df01e20e5ae49f5bf8d7ee6a352f5
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 29 22:10:29 2020 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Feb 29 22:10:29 2020 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=9f957137
src/php.eselect.in.in: add support for the "phar" executable.
PHP supports installing a "phar" executable that can archive/extract
the phar file format without the user having to learn the API and
write a little script. This commit allows "eselect php ... cli" to
manage a symlink to the "phar" command, so that when dev-lang/php
starts installing them, we can switch between the various versions.
Bug: https://bugs.gentoo.org/707876
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
src/php.eselect.in.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index f78bf3d..2a7e5a8 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -25,7 +25,7 @@ sapi_active_link_names() {
case "${sapi}" in
apache2) echo "mod_php.so" ;;
- cli) echo "php phpize php-config" ;;
+ cli) echo "php phpize php-config phar" ;;
fpm) echo "php-fpm" ;;
cgi) echo "php-cgi" ;;
phpdbg) echo "phpdbg" ;;
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2020-02-29 22:16 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2020-02-29 22:16 UTC (permalink / raw
To: gentoo-commits
commit: eccdef0c3d501060838c803ffa81ed79ca614dc0
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 29 21:53:38 2020 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Feb 29 22:00:28 2020 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=eccdef0c
src/php.eselect.in.in: create symlinks relatively.
As part of our $ROOT support, we need symlinks within $ROOT to point
to stuff within $ROOT. The problem with that is that, if we create
those symlinks with absolute paths, then you can't later chroot() into
$ROOT and use them, because they'll point to the wrong place -- an
absolute path that was only correct before you chrooted.
Using relative symlinks seems to fix the problem, and shouldn't hurt
anything in the common case where ROOT is unset or contains only a
trailing slash.
Thanks are due to Stefan Langenmaier for reporting the problem and
helping us test the solution.
Bug: https://bugs.gentoo.org/709422
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
src/php.eselect.in.in | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 12ef1e1..f78bf3d 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -85,7 +85,7 @@ sapi_active_link_target_dir() {
local sapi="${1}"
local target="${2}"
- local link_target_dir="@LIBDIR@/${target}/bin"
+ local link_target_dir="${ROOT%/}@LIBDIR@/${target}/bin"
if [[ "${sapi}" == "apache2" ]] ; then
link_target_dir+="/../apache2"
fi
@@ -459,9 +459,16 @@ set_sapi() {
for link_name in $(sapi_active_link_names "${sapi}"); do
local link_target=$(sapi_link_name_target "${sapi}" "${target_name}" "${link_name}")
+ # We need these links to be relative: when setting a target
+ # with ROOT nonempty, the symlink needs to point within
+ # ROOT. But if you later chroot() into ROOT, that link will
+ # point... nowhere, most likely. We need it to still point
+ # at the right target in that case!
+ local relative_target=$(relative_name \
+ "${link_tgt_dir}/${link_target}" \
+ "${link_dir}" )
# Use the short "-f" option for POSIX compatibility.
- @LN_S@ -f "${link_tgt_dir}/${link_target}" \
- "${link_dir}/${link_name}" || \
+ @LN_S@ -f "${relative_target}" "${link_dir}/${link_name}" || \
die -q "failed to create active ${link_name} symlink"
done
@@ -518,11 +525,6 @@ describe_list_options() {
}
do_list() {
- if [ "${ROOT%/}" != "" ] ; then
- local msg
- write_warning_msg "ROOT only supported in setting the configuration"
- echo
- fi
local sapi="${1}"
check_module "${sapi}"
list_sapi "${sapi}"
@@ -543,11 +545,6 @@ describe_show_options() {
}
do_show() {
- if [ "${ROOT%/}" != "" ] ; then
- local msg
- write_warning_msg "ROOT only supported in setting the configuration"
- echo
- fi
local sapi="${1}"
check_module "${sapi}"
get_sapi_active_target "${sapi}"
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2020-03-01 12:59 Michael Orlitzky
0 siblings, 0 replies; 60+ messages in thread
From: Michael Orlitzky @ 2020-03-01 12:59 UTC (permalink / raw
To: gentoo-commits
commit: d5ad69d12994e69882830faae26ba565d8980a25
Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 1 12:53:47 2020 +0000
Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sun Mar 1 12:59:07 2020 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=d5ad69d1
src/php.eselect.in.in: only create links to targets that exist.
To avoid replacing a working /usr/bin/phar with a broken symlink,
let's check to make sure that the targets of our symlinks exist before
creating them. This can leave "phar" pointing to an unexpected version
of that executable, but that's better than nothing if some working
version is installed.
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
src/php.eselect.in.in | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 2a7e5a8..d243c64 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -180,10 +180,9 @@ parse_target_major_version() {
# working.
#
# There is one potential caveat to that approach, for SAPIs with more
-# than one active symlink. What if "phpize" is broken but "php" is OK?
-# (Forget for the moment how that might happen...). Do we want to
-# update() the entire SAPI because one of the symlinks is dead?
-# Answer: I guess.
+# than one active symlink. What if "phar" is broken (after a rebuild)
+# but "php" is OK? Do we want to update() the entire SAPI because one
+# of the symlinks is dead? Answer: I guess.
#
# INPUT:
#
@@ -467,9 +466,19 @@ set_sapi() {
local relative_target=$(relative_name \
"${link_tgt_dir}/${link_target}" \
"${link_dir}" )
- # Use the short "-f" option for POSIX compatibility.
- @LN_S@ -f "${relative_target}" "${link_dir}/${link_name}" || \
- die -q "failed to create active ${link_name} symlink"
+
+ # Since the phar extension is optional, we check here to
+ # ensure that the target of our symlink exists before we
+ # create it. Otherwise, we could wind up with a /usr/bin/phar
+ # symlink that points nowhere. This might leave /usr/bin/phar
+ # pointing to a different version than you'd expect (wherever
+ # it pointed before you just tried to change it), but I guess
+ # leaving some working version is not a terrible thing to do.
+ if [[ -e "${link_tgt_dir}/${link_target}" ]]; then
+ # Use the short "-f" option for POSIX compatibility.
+ @LN_S@ -f "${relative_target}" "${link_dir}/${link_name}" || \
+ die -q "failed to create active ${link_name} symlink"
+ fi
done
# The call to write_mod_php_conf() in particular needs to take
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [gentoo-commits] proj/eselect-php:master commit in: src/
@ 2020-12-08 2:24 Brian Evans
0 siblings, 0 replies; 60+ messages in thread
From: Brian Evans @ 2020-12-08 2:24 UTC (permalink / raw
To: gentoo-commits
commit: ebb669221f6e8d0c871431a78aa90be2eacde112
Author: Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 8 02:21:45 2020 +0000
Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Tue Dec 8 02:21:45 2020 +0000
URL: https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=ebb66922
Add support for PHP 8
Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
src/php.eselect.in.in | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index d243c64..77f1635 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -165,7 +165,7 @@ parse_target_major_version() {
local target="${1}"
local major="${target:3:1}"
case "${major}" in
- 5|7) echo "${major}" ;;
+ 5|7|8) echo "${major}" ;;
*) die "invalid PHP target name: ${target}" ;;
esac
}
@@ -275,7 +275,7 @@ find_sapi_targets() {
local pattern_suffix
case "${sapi}" in
- apache2) pattern_suffix="apache2/libphp[57].so" ;;
+ apache2) pattern_suffix="apache2/libphp[578].so" ;;
cli) pattern_suffix="bin/php" ;;
fpm) pattern_suffix="bin/php-fpm" ;;
cgi) pattern_suffix="bin/php-cgi" ;;
@@ -345,6 +345,9 @@ write_mod_php_conf() {
@MKDIR_P@ "${conf_dir}" || die "failed to create ${conf_dir}"
local major=$(parse_target_major_version "${target}")
+ if [[ $major -gt 7 ]] ; then
+ major=''
+ fi
cat <<-EOF > "${conf_path}" || die "failed to write mod_php.conf"
<IfModule !php${major}_module>
LoadModule php${major}_module modules/mod_php.so
^ permalink raw reply related [flat|nested] 60+ messages in thread
end of thread, other threads:[~2020-12-08 2:25 UTC | newest]
Thread overview: 60+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-11 0:40 [gentoo-commits] proj/eselect-php:master commit in: src/ Michael Orlitzky
-- strict thread matches above, loose matches on Subject: below --
2020-12-08 2:24 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-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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox