public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements
@ 2018-01-26 15:38 Brian Evans
  2018-01-26 15:38 ` [gentoo-dev] [PATCH 1/2] php-ext-source-r3.eclass: Introduce PHP_INI_NAME variable Brian Evans
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Brian Evans @ 2018-01-26 15:38 UTC (permalink / raw
  To: gentoo-dev

The following patches improve the php-ext-source-r3 eclass by introducing
two new variables.

The first allows the configration INI name to vary from a hard-coded default
of the module name.

The second allows USE dependencies to be added to each implementation
similar to python team's PYTHON_REQ_USE.

Comments are welcome

Brian



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-dev] [PATCH 1/2] php-ext-source-r3.eclass: Introduce PHP_INI_NAME variable
  2018-01-26 15:38 [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements Brian Evans
@ 2018-01-26 15:38 ` Brian Evans
  2018-01-26 15:38 ` [gentoo-dev] [PATCH 2/2] php-ext-source-r3.eclass: Introduce PHP_EXT_NEEDED_USE Brian Evans
  2018-01-29 13:50 ` [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements Brian Evans
  2 siblings, 0 replies; 4+ messages in thread
From: Brian Evans @ 2018-01-26 15:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: Brian Evans

Currently php-ext-source-r3 saves the enabling ini file as
"${PHP_EXT_NAME}.ini".  This is problematic when foo module needs to be
loaded before bar module as things are read in directory order.

This patch introduces PHP_INI_NAME which defaults to PHP_EXT_NAME for
backwards-compatibility.
---
 eclass/php-ext-source-r3.eclass | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/eclass/php-ext-source-r3.eclass b/eclass/php-ext-source-r3.eclass
index bc6751562a5..315ce32887f 100644
--- a/eclass/php-ext-source-r3.eclass
+++ b/eclass/php-ext-source-r3.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: php-ext-source-r3.eclass
@@ -73,6 +73,17 @@ esac
 # the tree.
 [[ -z "${PHP_EXT_SAPIS}" ]] && PHP_EXT_SAPIS="apache2 cli cgi fpm embed phpdbg"
 
+# @ECLASS-VARIABLE: PHP_INI_NAME
+# @DESCRIPTION
+# An optional file name of the saved ini file minis the ini extension
+# This allows ordering of extensions such that one is loaded before
+# or after another.  Defaults to the PHP_EXT_NAME.
+# Example (produces 40-foo.ini file):
+# @CODE@
+# PHP_INI_NAME="40-foo"
+# @CODE@
+: ${PHP_INI_NAME:=${PHP_EXT_NAME}}
+
 
 # Make sure at least one target is installed. First, start a USE
 # conditional like "php?", but only when PHP_EXT_OPTIONAL_USE is
@@ -295,7 +306,7 @@ php_slot_ini_files() {
 	local x
 	for x in ${PHP_EXT_SAPIS} ; do
 		if [[ -f "${EPREFIX}/etc/php/${x}-${1}/php.ini" ]] ; then
-			slot_ini_files+=" etc/php/${x}-${1}/ext/${PHP_EXT_NAME}.ini"
+			slot_ini_files+=" etc/php/${x}-${1}/ext/${PHP_INI_NAME}.ini"
 		fi
 	done
 
@@ -324,7 +335,7 @@ php-ext-source-r3_createinifiles() {
 				einfo "Added contents of ${FILESDIR}/${PHP_EXT_INIFILE}" \
 					  "to ${file}"
 			fi
-			inidir="${file/${PHP_EXT_NAME}.ini/}"
+			inidir="${file/${PHP_INI_NAME}.ini/}"
 			inidir="${inidir/ext/ext-active}"
 			dodir "/${inidir}"
 			dosym "/${file}" "/${file/ext/ext-active}"
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-dev] [PATCH 2/2] php-ext-source-r3.eclass: Introduce PHP_EXT_NEEDED_USE
  2018-01-26 15:38 [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements Brian Evans
  2018-01-26 15:38 ` [gentoo-dev] [PATCH 1/2] php-ext-source-r3.eclass: Introduce PHP_INI_NAME variable Brian Evans
@ 2018-01-26 15:38 ` Brian Evans
  2018-01-29 13:50 ` [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements Brian Evans
  2 siblings, 0 replies; 4+ messages in thread
From: Brian Evans @ 2018-01-26 15:38 UTC (permalink / raw
  To: gentoo-dev; +Cc: Brian Evans

This simplifies the dependencies in an ebuild

@DESCRIPTION:
A list of USE flags to append to each PHP target selected
as a valid USE-dependency string.  The value should be valid
for all targets so USE defaults may be necessary.
Example:
PHP_EXT_NEEDED_USE="mysql?,pdo,pcre(+)"

The PHP dependencies will result in:
php_targets_php7-0? ( dev-lang/php:7.0[mysql?,pdo,pcre(+)] )
---
 eclass/php-ext-source-r3.eclass | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/eclass/php-ext-source-r3.eclass b/eclass/php-ext-source-r3.eclass
index 315ce32887f..96d55f97a55 100644
--- a/eclass/php-ext-source-r3.eclass
+++ b/eclass/php-ext-source-r3.eclass
@@ -84,6 +84,22 @@ esac
 # @CODE@
 : ${PHP_INI_NAME:=${PHP_EXT_NAME}}
 
+# @ECLASS-VARIABLE: PHP_EXT_NEEDED_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# A list of USE flags to append to each PHP target selected
+# as a valid USE-dependency string.  The value should be valid
+# for all targets so USE defaults may be necessary.
+# Example:
+# @CODE
+# PHP_EXT_NEEDED_USE="mysql?,pdo,pcre(+)"
+# @CODE
+#
+# The PHP dependencies will result in:
+# @CODE
+# php_targets_php7-0? ( dev-lang/php:7.0[mysql?,pdo,pcre(+)] )
+# @CODE
+
 
 # Make sure at least one target is installed. First, start a USE
 # conditional like "php?", but only when PHP_EXT_OPTIONAL_USE is
@@ -96,6 +112,9 @@ for _php_target in ${USE_PHP}; do
 	REQUIRED_USE+="php_targets_${_php_target} "
 	_php_slot=${_php_target/php}
 	_php_slot=${_php_slot/-/.}
+	if [[ ${PHP_EXT_NEEDED_USE} ]] ; then
+		_php_slot+=[${PHP_EXT_NEEDED_USE}]
+	fi
 	PHPDEPEND+=" php_targets_${_php_target}? ( dev-lang/php:${_php_slot} )"
 done
 
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements
  2018-01-26 15:38 [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements Brian Evans
  2018-01-26 15:38 ` [gentoo-dev] [PATCH 1/2] php-ext-source-r3.eclass: Introduce PHP_INI_NAME variable Brian Evans
  2018-01-26 15:38 ` [gentoo-dev] [PATCH 2/2] php-ext-source-r3.eclass: Introduce PHP_EXT_NEEDED_USE Brian Evans
@ 2018-01-29 13:50 ` Brian Evans
  2 siblings, 0 replies; 4+ messages in thread
From: Brian Evans @ 2018-01-29 13:50 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 458 bytes --]

On 1/26/2018 10:38 AM, Brian Evans wrote:
> The following patches improve the php-ext-source-r3 eclass by introducing
> two new variables.
> 
> The first allows the configration INI name to vary from a hard-coded default
> of the module name.
> 
> The second allows USE dependencies to be added to each implementation
> similar to python team's PYTHON_REQ_USE.
> 
> Comments are welcome
> 
> Brian
> 
> 

These are now committed.

Brian


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-29 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-26 15:38 [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements Brian Evans
2018-01-26 15:38 ` [gentoo-dev] [PATCH 1/2] php-ext-source-r3.eclass: Introduce PHP_INI_NAME variable Brian Evans
2018-01-26 15:38 ` [gentoo-dev] [PATCH 2/2] php-ext-source-r3.eclass: Introduce PHP_EXT_NEEDED_USE Brian Evans
2018-01-29 13:50 ` [gentoo-dev] [RFC] php-ext-source-r3 eclass improvements Brian Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox