app-eselect/eselect-php: new revision fixing bugs 508712 and 545652.
authorMichael Orlitzky <mjo@gentoo.org>
Mon, 23 Nov 2015 18:13:21 +0000 (13:13 -0500)
committerMichael Orlitzky <mjo@gentoo.org>
Mon, 23 Nov 2015 18:13:39 +0000 (13:13 -0500)
Both the ebuild and the init script have been revisioned. The ebuild
was modified to depend on the apache2 mod_dir module (bug 545652), and
a configtest() command was added to the init script (bug 508712).

Thanks to Sebastian Pipping and Igor Filakhtov for the reports and fixes.

Gentoo-Bug: 508712
Gentoo-bug: 545652

Package-Manager: portage-2.2.20.1

app-eselect/eselect-php/eselect-php-0.7.1-r6.ebuild [moved from app-eselect/eselect-php/eselect-php-0.7.1-r5.ebuild with 79% similarity]
app-eselect/eselect-php/files/php-fpm.init-r3 [moved from app-eselect/eselect-php/files/php-fpm.init-r2 with 78% similarity]

similarity index 79%
rename from app-eselect/eselect-php/eselect-php-0.7.1-r5.ebuild
rename to app-eselect/eselect-php/eselect-php-0.7.1-r6.ebuild
index dc2fadc72ba85c46517236d96389e312d0765638..cd210279e6b8b2cdde8dd61b95f16bfcaf49245e 100644 (file)
@@ -15,15 +15,16 @@ SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
 IUSE="fpm apache2"
 
-RDEPEND="app-admin/eselect"
+# The "DirectoryIndex" line in 70_mod_php5.conf requires mod_dir.
+RDEPEND="app-admin/eselect
+       apache2? ( www-servers/apache[apache2_modules_dir] )"
 S="${WORKDIR}"
 
 want_apache
 
 src_install() {
-       mv eselect-php-${PV} php.eselect
        insinto /usr/share/eselect/modules/
-       doins php.eselect
+       newins "eselect-php-${PV}" php.eselect
 
        if use apache2 ; then
                insinto "${APACHE_MODULES_CONFDIR#${EPREFIX}}"
@@ -32,7 +33,7 @@ src_install() {
        fi
 
        if use fpm ; then
-               newinitd "${FILESDIR}/php-fpm.init-r2" "php-fpm"
+               newinitd "${FILESDIR}/php-fpm.init-r3" "php-fpm"
                systemd_dotmpfilesd "${FILESDIR}/php-fpm.conf"
                exeinto /usr/libexec
                doexe "${FILESDIR}/php-fpm-launcher"
similarity index 78%
rename from app-eselect/eselect-php/files/php-fpm.init-r2
rename to app-eselect/eselect-php/files/php-fpm.init-r3
index 8ce81b984bc4dc643f65835f2aad78eeb00b884f..a1b956ea78e48b5331d0f4f24cca302a80f86d62 100644 (file)
@@ -1,6 +1,7 @@
 #!/sbin/openrc-run
 
 extra_started_commands="reload"
+extra_commands="configtest"
 
 set_phpvars() {
        PHPSLOT="${SVCNAME#php-fpm-}"
@@ -11,13 +12,14 @@ set_phpvars() {
        fi
 
        PHP_FPM_CONF="/etc/php/fpm-${PHPSLOT}/php-fpm.conf"
+       PHP_FPM_BIN="/usr/lib/${PHPSLOT}/bin/php-fpm"
 }
 
 start() {
         ebegin "Starting PHP FastCGI Process Manager"
        set_phpvars
         start-stop-daemon --start --pidfile "${PHP_FPM_PID}" \
-                         --exec "/usr/lib/${PHPSLOT}/bin/php-fpm" \
+                         --exec "${PHP_FPM_BIN}" \
                          -- \
                          --fpm-config "${PHP_FPM_CONF}" \
                          --pid "${PHP_FPM_PID}"
@@ -37,7 +39,7 @@ stop() {
        set_phpvars
         start-stop-daemon --signal QUIT \
                          --stop \
-                         --exec "/usr/lib/${PHPSLOT}/bin/php-fpm" \
+                         --exec "${PHP_FPM_BIN}" \
                          --pidfile "${PHP_FPM_PID}"
         eend $?
 }
@@ -48,3 +50,10 @@ reload() {
     [ -f "${PHP_FPM_PID}" ] && kill -USR2 $(cat "${PHP_FPM_PID}")
     eend $?
 }
+
+configtest() {
+    ebegin "Testing PHP FastCGI Process Manager configuration"
+    set_phpvars
+    "${PHP_FPM_BIN}" --fpm-config "${PHP_FPM_CONF}" --test
+    eend $?
+}