Gentoo Archives: gentoo-dev

From: Brian Evans <grknight@g.o>
To: gentoo-dev@l.g.o
Cc: Brian Evans <grknight@g.o>
Subject: [gentoo-dev] [PATCH 1/2] php-ext-source-r3.eclass: Introduce PHP_INI_NAME variable
Date: Fri, 26 Jan 2018 15:39:52
Message-Id: 20180126153857.30315-2-grknight@gentoo.org
In Reply to: [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements by Brian Evans
1 Currently php-ext-source-r3 saves the enabling ini file as
2 "${PHP_EXT_NAME}.ini". This is problematic when foo module needs to be
3 loaded before bar module as things are read in directory order.
4
5 This patch introduces PHP_INI_NAME which defaults to PHP_EXT_NAME for
6 backwards-compatibility.
7 ---
8 eclass/php-ext-source-r3.eclass | 17 ++++++++++++++---
9 1 file changed, 14 insertions(+), 3 deletions(-)
10
11 diff --git a/eclass/php-ext-source-r3.eclass b/eclass/php-ext-source-r3.eclass
12 index bc6751562a5..315ce32887f 100644
13 --- a/eclass/php-ext-source-r3.eclass
14 +++ b/eclass/php-ext-source-r3.eclass
15 @@ -1,4 +1,4 @@
16 -# Copyright 1999-2016 Gentoo Foundation
17 +# Copyright 1999-2018 Gentoo Foundation
18 # Distributed under the terms of the GNU General Public License v2
19
20 # @ECLASS: php-ext-source-r3.eclass
21 @@ -73,6 +73,17 @@ esac
22 # the tree.
23 [[ -z "${PHP_EXT_SAPIS}" ]] && PHP_EXT_SAPIS="apache2 cli cgi fpm embed phpdbg"
24
25 +# @ECLASS-VARIABLE: PHP_INI_NAME
26 +# @DESCRIPTION
27 +# An optional file name of the saved ini file minis the ini extension
28 +# This allows ordering of extensions such that one is loaded before
29 +# or after another. Defaults to the PHP_EXT_NAME.
30 +# Example (produces 40-foo.ini file):
31 +# @CODE@
32 +# PHP_INI_NAME="40-foo"
33 +# @CODE@
34 +: ${PHP_INI_NAME:=${PHP_EXT_NAME}}
35 +
36
37 # Make sure at least one target is installed. First, start a USE
38 # conditional like "php?", but only when PHP_EXT_OPTIONAL_USE is
39 @@ -295,7 +306,7 @@ php_slot_ini_files() {
40 local x
41 for x in ${PHP_EXT_SAPIS} ; do
42 if [[ -f "${EPREFIX}/etc/php/${x}-${1}/php.ini" ]] ; then
43 - slot_ini_files+=" etc/php/${x}-${1}/ext/${PHP_EXT_NAME}.ini"
44 + slot_ini_files+=" etc/php/${x}-${1}/ext/${PHP_INI_NAME}.ini"
45 fi
46 done
47
48 @@ -324,7 +335,7 @@ php-ext-source-r3_createinifiles() {
49 einfo "Added contents of ${FILESDIR}/${PHP_EXT_INIFILE}" \
50 "to ${file}"
51 fi
52 - inidir="${file/${PHP_EXT_NAME}.ini/}"
53 + inidir="${file/${PHP_INI_NAME}.ini/}"
54 inidir="${inidir/ext/ext-active}"
55 dodir "/${inidir}"
56 dosym "/${file}" "/${file/ext/ext-active}"
57 --
58 2.16.1