public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] depend.apache.eclass rework, try 2
@ 2016-12-08 20:36 Andreas K. Hüttel
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version Andreas K. Hüttel
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Andreas K. Hüttel @ 2016-12-08 20:36 UTC (permalink / raw
  To: gentoo-dev

Here's a fresh attempt to improve depend.apache.eclass; this time
some of the ideas from dwfreed's patch are implemented. 
The initialization of two variables is shifted from global scope
to pkg_setup.

We still remain with one eclass though (and what I haven't used
is the new dependency/useflag code there, since it changes the
interface).

Impact... right now only 4 ebuilds in the tree use depend.apache.eclass
with EAPI=6. Two of them use depend.apache.eclass directly, and 
none of the variables is present in the ebuild. Two use it via 
apache-module.eclass, but that eclass only uses the affected
variables in phase functions.



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

* [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version
  2016-12-08 20:36 [gentoo-dev] depend.apache.eclass rework, try 2 Andreas K. Hüttel
@ 2016-12-08 20:36 ` Andreas K. Hüttel
  2016-12-09  6:09   ` Michał Górny
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 2/5] depend.apache.eclass: Disallow EAPI=1 Andreas K. Hüttel
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Andreas K. Hüttel @ 2016-12-08 20:36 UTC (permalink / raw
  To: gentoo-dev; +Cc: Doug Freed

From: Doug Freed <dwfreed@mtu.edu>

---
 eclass/depend.apache.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
index b69c2ec..a7d206f 100644
--- a/eclass/depend.apache.eclass
+++ b/eclass/depend.apache.eclass
@@ -290,7 +290,7 @@ has_apache() {
 has_apache_threads() {
 	debug-print-function $FUNCNAME $*
 
-	if ! built_with_use www-servers/apache threads; then
+	if ! has_version 'www-servers/apache[threads]'; then
 		return
 	fi
 
@@ -313,14 +313,14 @@ has_apache_threads() {
 has_apache_threads_in() {
 	debug-print-function $FUNCNAME $*
 
-	if ! built_with_use www-servers/apache threads; then
+	if ! has_version 'www-servers/apache[threads]'; then
 		return
 	fi
 
 	local myforeign="$1"
 	local myflag="${2:-threads}"
 
-	if ! built_with_use ${myforeign} ${myflag}; then
+	if ! has_version "${myforeign}[${myflag}]"; then
 		echo
 		eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
 		eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
-- 
2.11.0.rc2



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

* [gentoo-dev] [PATCH 2/5] depend.apache.eclass: Disallow EAPI=1
  2016-12-08 20:36 [gentoo-dev] depend.apache.eclass rework, try 2 Andreas K. Hüttel
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version Andreas K. Hüttel
@ 2016-12-08 20:36 ` Andreas K. Hüttel
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 3/5] depend.apache.eclass: Add missing function want_apache2_4 Andreas K. Hüttel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Andreas K. Hüttel @ 2016-12-08 20:36 UTC (permalink / raw
  To: gentoo-dev; +Cc: Andreas K. Hüttel

---
 eclass/depend.apache.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
index a7d206f..e858a85 100644
--- a/eclass/depend.apache.eclass
+++ b/eclass/depend.apache.eclass
@@ -43,7 +43,7 @@
 inherit multilib
 
 case ${EAPI:-0} in
-	0|1|2|3|4|5)
+	0|2|3|4|5)
 		;;
 	6)
 		ewarn
-- 
2.11.0.rc2



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

* [gentoo-dev] [PATCH 3/5] depend.apache.eclass: Add missing function want_apache2_4
  2016-12-08 20:36 [gentoo-dev] depend.apache.eclass rework, try 2 Andreas K. Hüttel
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version Andreas K. Hüttel
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 2/5] depend.apache.eclass: Disallow EAPI=1 Andreas K. Hüttel
@ 2016-12-08 20:36 ` Andreas K. Hüttel
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 4/5] depend.apache.eclass: For EAPI=6, move initialization of APACHE_BASEDIR and APACHE_MODULESDIR into pkg_setup Andreas K. Hüttel
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 5/5] depend.apache.eclass: Restructure pkg_setup so in_iuse is used from EAPI=6 on Andreas K. Hüttel
  4 siblings, 0 replies; 8+ messages in thread
From: Andreas K. Hüttel @ 2016-12-08 20:36 UTC (permalink / raw
  To: gentoo-dev; +Cc: Andreas K. Hüttel

---
 eclass/depend.apache.eclass | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
index e858a85..a51ec55 100644
--- a/eclass/depend.apache.eclass
+++ b/eclass/depend.apache.eclass
@@ -225,6 +225,23 @@ want_apache2_2() {
 	RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_2_DEPEND} )"
 }
 
+# @FUNCTION: want_apache2_4
+# @USAGE: [myiuse]
+# @DESCRIPTION:
+# An ebuild calls this to get the dependency information for optional
+# apache-2.4.x support. If the myiuse parameter is not given it defaults to
+# apache2.
+# An ebuild should additionally call depend.apache_pkg_setup() in pkg_setup()
+# with the same myiuse parameter.
+want_apache2_4() {
+	debug-print-function $FUNCNAME $*
+
+	local myiuse=${1:-apache2}
+	IUSE="${IUSE} ${myiuse}"
+	DEPEND="${DEPEND} ${myiuse}? ( ${APACHE2_4_DEPEND} )"
+	RDEPEND="${RDEPEND} ${myiuse}? ( ${APACHE2_4_DEPEND} )"
+}
+
 # @FUNCTION: need_apache
 # @DESCRIPTION:
 # An ebuild calls this to get the dependency information for apache.
-- 
2.11.0.rc2



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

* [gentoo-dev] [PATCH 4/5] depend.apache.eclass: For EAPI=6, move initialization of APACHE_BASEDIR and APACHE_MODULESDIR into pkg_setup
  2016-12-08 20:36 [gentoo-dev] depend.apache.eclass rework, try 2 Andreas K. Hüttel
                   ` (2 preceding siblings ...)
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 3/5] depend.apache.eclass: Add missing function want_apache2_4 Andreas K. Hüttel
@ 2016-12-08 20:36 ` Andreas K. Hüttel
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 5/5] depend.apache.eclass: Restructure pkg_setup so in_iuse is used from EAPI=6 on Andreas K. Hüttel
  4 siblings, 0 replies; 8+ messages in thread
From: Andreas K. Hüttel @ 2016-12-08 20:36 UTC (permalink / raw
  To: gentoo-dev; +Cc: Andreas K. Hüttel

---
 eclass/depend.apache.eclass | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
index a51ec55..8582396 100644
--- a/eclass/depend.apache.eclass
+++ b/eclass/depend.apache.eclass
@@ -40,17 +40,11 @@
 # }
 # @CODE
 
-inherit multilib
-
 case ${EAPI:-0} in
 	0|2|3|4|5)
+		inherit multilib
 		;;
 	6)
-		ewarn
-		ewarn "EAPI=${EAPI} is not supported by depend.apache.eclass."
-		ewarn "This means that ${CATEGORY}/${PF} is most likely buggy."
-		ewarn "Please file a report on https://bugs.gentoo.org/"
-		ewarn
 		;;
 	*)
 		die "EAPI=${EAPI} is not supported by depend.apache.eclass"
@@ -84,7 +78,8 @@ esac
 # @ECLASS-VARIABLE: APACHE_BASEDIR
 # @DESCRIPTION:
 # Path to the server root directory.
-# This variable is set by the want/need_apache functions.
+# This variable is set by the want/need_apache functions (EAPI=0 through 5)
+# or depend.apache_pkg_setup (EAPI=6 and later).
 
 # @ECLASS-VARIABLE: APACHE_CONFDIR
 # @DESCRIPTION:
@@ -104,7 +99,8 @@ esac
 # @ECLASS-VARIABLE: APACHE_MODULESDIR
 # @DESCRIPTION:
 # Path where we install modules.
-# This variable is set by the want/need_apache functions.
+# This variable is set by the want/need_apache functions (EAPI=0 through 5)
+# or depend.apache_pkg_setup (EAPI=6 and later).
 
 # @ECLASS-VARIABLE: APACHE_DEPEND
 # @DESCRIPTION:
@@ -141,10 +137,19 @@ _init_apache2() {
 	APACHE_BIN="/usr/sbin/apache2"
 	APACHE_CTL="/usr/sbin/apache2ctl"
 	APACHE_INCLUDEDIR="/usr/include/apache2"
-	APACHE_BASEDIR="/usr/$(get_libdir)/apache2"
 	APACHE_CONFDIR="/etc/apache2"
 	APACHE_MODULES_CONFDIR="${APACHE_CONFDIR}/modules.d"
 	APACHE_VHOSTS_CONFDIR="${APACHE_CONFDIR}/vhosts.d"
+
+	case ${EAPI:-0} in
+		0|2|3|4|5)
+			_init_apache2_late
+			;;
+	esac
+}
+
+_init_apache2_late() {
+	APACHE_BASEDIR="/usr/$(get_libdir)/apache2"
 	APACHE_MODULESDIR="${APACHE_BASEDIR}/modules"
 }
 
@@ -173,7 +178,15 @@ depend.apache_pkg_setup() {
 	local myiuse=${1:-apache2}
 	if has ${myiuse} ${IUSE}; then
 		if use ${myiuse}; then
-			_init_apache2
+			case ${EAPI:-0} in
+				0|2|3|4|5)
+					_init_apache2
+					;;
+				*)
+					_init_apache2
+					_init_apache2_late
+					;;
+			esac
 		else
 			_init_no_apache
 		fi
-- 
2.11.0.rc2



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

* [gentoo-dev] [PATCH 5/5] depend.apache.eclass: Restructure pkg_setup so in_iuse is used from EAPI=6 on
  2016-12-08 20:36 [gentoo-dev] depend.apache.eclass rework, try 2 Andreas K. Hüttel
                   ` (3 preceding siblings ...)
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 4/5] depend.apache.eclass: For EAPI=6, move initialization of APACHE_BASEDIR and APACHE_MODULESDIR into pkg_setup Andreas K. Hüttel
@ 2016-12-08 20:36 ` Andreas K. Hüttel
  4 siblings, 0 replies; 8+ messages in thread
From: Andreas K. Hüttel @ 2016-12-08 20:36 UTC (permalink / raw
  To: gentoo-dev; +Cc: Andreas K. Hüttel

---
 eclass/depend.apache.eclass | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
index 8582396..2d7b062 100644
--- a/eclass/depend.apache.eclass
+++ b/eclass/depend.apache.eclass
@@ -176,21 +176,28 @@ depend.apache_pkg_setup() {
 	fi
 
 	local myiuse=${1:-apache2}
-	if has ${myiuse} ${IUSE}; then
-		if use ${myiuse}; then
-			case ${EAPI:-0} in
-				0|2|3|4|5)
+
+	case ${EAPI:-0} in
+		0|2|3|4|5)
+			if has ${myiuse} ${IUSE}; then
+				if use ${myiuse}; then
 					_init_apache2
-					;;
-				*)
+				else
+					_init_no_apache
+				fi
+			fi
+			;;
+		*)
+			if in_iuse ${myiuse}; then
+				if use ${myiuse}; then
 					_init_apache2
 					_init_apache2_late
-					;;
-			esac
-		else
-			_init_no_apache
-		fi
-	fi
+				else
+					_init_no_apache
+				fi
+			fi
+			;;
+	esac
 }
 
 # @FUNCTION: want_apache
-- 
2.11.0.rc2



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

* Re: [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version
  2016-12-08 20:36 ` [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version Andreas K. Hüttel
@ 2016-12-09  6:09   ` Michał Górny
  2016-12-09  7:04     ` Doug Freed
  0 siblings, 1 reply; 8+ messages in thread
From: Michał Górny @ 2016-12-09  6:09 UTC (permalink / raw
  To: Andreas K. Hüttel; +Cc: gentoo-dev, Doug Freed

[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]

On Thu,  8 Dec 2016 21:36:28 +0100
Andreas K. Hüttel <dilfridge@gentoo.org> wrote:

> From: Doug Freed <dwfreed@mtu.edu>
> 
> ---
>  eclass/depend.apache.eclass | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
> index b69c2ec..a7d206f 100644
> --- a/eclass/depend.apache.eclass
> +++ b/eclass/depend.apache.eclass
> @@ -290,7 +290,7 @@ has_apache() {
>  has_apache_threads() {
>  	debug-print-function $FUNCNAME $*
>  
> -	if ! built_with_use www-servers/apache threads; then
> +	if ! has_version 'www-servers/apache[threads]'; then
>  		return
>  	fi
>  
> @@ -313,14 +313,14 @@ has_apache_threads() {
>  has_apache_threads_in() {
>  	debug-print-function $FUNCNAME $*
>  
> -	if ! built_with_use www-servers/apache threads; then
> +	if ! has_version 'www-servers/apache[threads]'; then
>  		return
>  	fi
>  
>  	local myforeign="$1"
>  	local myflag="${2:-threads}"
>  
> -	if ! built_with_use ${myforeign} ${myflag}; then
> +	if ! has_version "${myforeign}[${myflag}]"; then
>  		echo
>  		eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
>  		eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"

I don't think it's valid for EAPI 0/1. You should probably move the
EAPI 1 ban first, to avoid keeping half-broken state between commits,
and add an explicit die call here for EAPI 0. It's better if ebuild
dies with explanation rather than unreliably fails with invalid
has_version syntax.

-- 
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>

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

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

* Re: [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version
  2016-12-09  6:09   ` Michał Górny
@ 2016-12-09  7:04     ` Doug Freed
  0 siblings, 0 replies; 8+ messages in thread
From: Doug Freed @ 2016-12-09  7:04 UTC (permalink / raw
  To: gentoo-dev

On Fri, Dec 9, 2016 at 1:09 AM, Michał Górny <mgorny@gentoo.org> wrote:
> On Thu,  8 Dec 2016 21:36:28 +0100
> Andreas K. Hüttel <dilfridge@gentoo.org> wrote:
>
>> From: Doug Freed <dwfreed@mtu.edu>
>>
>> ---
>>  eclass/depend.apache.eclass | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
>> index b69c2ec..a7d206f 100644
>> --- a/eclass/depend.apache.eclass
>> +++ b/eclass/depend.apache.eclass
>> @@ -290,7 +290,7 @@ has_apache() {
>>  has_apache_threads() {
>>       debug-print-function $FUNCNAME $*
>>
>> -     if ! built_with_use www-servers/apache threads; then
>> +     if ! has_version 'www-servers/apache[threads]'; then
>>               return
>>       fi
>>
>> @@ -313,14 +313,14 @@ has_apache_threads() {
>>  has_apache_threads_in() {
>>       debug-print-function $FUNCNAME $*
>>
>> -     if ! built_with_use www-servers/apache threads; then
>> +     if ! has_version 'www-servers/apache[threads]'; then
>>               return
>>       fi
>>
>>       local myforeign="$1"
>>       local myflag="${2:-threads}"
>>
>> -     if ! built_with_use ${myforeign} ${myflag}; then
>> +     if ! has_version "${myforeign}[${myflag}]"; then
>>               echo
>>               eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
>>               eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
>
> I don't think it's valid for EAPI 0/1. You should probably move the
> EAPI 1 ban first, to avoid keeping half-broken state between commits,
> and add an explicit die call here for EAPI 0. It's better if ebuild
> dies with explanation rather than unreliably fails with invalid
> has_version syntax.

Correct, USE dependencies don't exist until EAPI 2 (which is why
people used built_with_use instead of has_version).  This is why I
banned both EAPI 0 and 1 in my version of the patch.  There are
presently 19 EAPI 0 consumers of this eclass, though.

-Doug


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

end of thread, other threads:[~2016-12-09  7:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08 20:36 [gentoo-dev] depend.apache.eclass rework, try 2 Andreas K. Hüttel
2016-12-08 20:36 ` [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version Andreas K. Hüttel
2016-12-09  6:09   ` Michał Górny
2016-12-09  7:04     ` Doug Freed
2016-12-08 20:36 ` [gentoo-dev] [PATCH 2/5] depend.apache.eclass: Disallow EAPI=1 Andreas K. Hüttel
2016-12-08 20:36 ` [gentoo-dev] [PATCH 3/5] depend.apache.eclass: Add missing function want_apache2_4 Andreas K. Hüttel
2016-12-08 20:36 ` [gentoo-dev] [PATCH 4/5] depend.apache.eclass: For EAPI=6, move initialization of APACHE_BASEDIR and APACHE_MODULESDIR into pkg_setup Andreas K. Hüttel
2016-12-08 20:36 ` [gentoo-dev] [PATCH 5/5] depend.apache.eclass: Restructure pkg_setup so in_iuse is used from EAPI=6 on Andreas K. Hüttel

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