public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils
@ 2020-09-06 15:47 David Seifert
  2020-09-06 15:47 ` [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass David Seifert
  2020-09-06 15:51 ` [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils Joonas Niilola
  0 siblings, 2 replies; 7+ messages in thread
From: David Seifert @ 2020-09-06 15:47 UTC (permalink / raw
  To: gentoo-dev; +Cc: David Seifert

Signed-off-by: David Seifert <soap@gentoo.org>
---
 eclass/optfeature.eclass | 63 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 eclass/optfeature.eclass

diff --git a/eclass/optfeature.eclass b/eclass/optfeature.eclass
new file mode 100644
index 00000000000..b0082606cd6
--- /dev/null
+++ b/eclass/optfeature.eclass
@@ -0,0 +1,63 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: optfeature.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: Advertise optional functionality that might be useful to users
+
+case "${EAPI:-0}" in
+	[0-7]) ;;
+	*)     die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
+esac
+
+if [[ -z ${_OPTFEATURE_ECLASS} ]]; then
+_OPTFEATURE_ECLASS=1
+
+# @FUNCTION: optfeature
+# @USAGE: <short description> <package atom to match> [other atoms]
+# @DESCRIPTION:
+# Print out a message suggesting an optional package (or packages)
+# not currently installed which provides the described functionality.
+#
+# The following snippet would suggest app-misc/foo for optional foo support,
+# app-misc/bar or app-misc/baz[bar] for optional bar support
+# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.
+# @CODE
+#	optfeature "foo support" app-misc/foo
+#	optfeature "bar support" app-misc/bar app-misc/baz[bar]
+#	optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c
+# @CODE
+optfeature() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	local i j msg
+	local desc=$1
+	local flag=0
+	shift
+	for i; do
+		for j in ${i}; do
+			if has_version "${j}"; then
+				flag=1
+			else
+				flag=0
+				break
+			fi
+		done
+		if [[ ${flag} -eq 1 ]]; then
+			break
+		fi
+	done
+	if [[ ${flag} -eq 0 ]]; then
+		for i; do
+			msg=" "
+			for j in ${i}; do
+				msg+=" ${j} and"
+			done
+			msg="${msg:0: -4} for ${desc}"
+			elog "${msg}"
+		done
+	fi
+}
+
+fi
-- 
2.28.0



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

* [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass
  2020-09-06 15:47 [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils David Seifert
@ 2020-09-06 15:47 ` David Seifert
  2020-09-06 19:49   ` Ulrich Mueller
  2020-09-06 15:51 ` [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils Joonas Niilola
  1 sibling, 1 reply; 7+ messages in thread
From: David Seifert @ 2020-09-06 15:47 UTC (permalink / raw
  To: gentoo-dev; +Cc: David Seifert

Signed-off-by: David Seifert <soap@gentoo.org>
---
 eclass/eutils.eclass | 49 ++------------------------------------------
 1 file changed, 2 insertions(+), 47 deletions(-)

diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 20dec774f2f..4255056f310 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: eutils.eclass
@@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
 # implicitly inherited (now split) eclasses
 case ${EAPI:-0} in
 0|1|2|3|4|5|6)
-	inherit desktop epatch estack ltprune multilib preserve-libs \
+	inherit desktop epatch estack ltprune multilib optfeature preserve-libs \
 		toolchain-funcs vcs-clean
 	;;
 esac
@@ -186,51 +186,6 @@ use_if_iuse() {
 	use $1
 }
 
-# @FUNCTION: optfeature
-# @USAGE: <short description> <package atom to match> [other atoms]
-# @DESCRIPTION:
-# Print out a message suggesting an optional package (or packages)
-# not currently installed which provides the described functionality.
-#
-# The following snippet would suggest app-misc/foo for optional foo support,
-# app-misc/bar or app-misc/baz[bar] for optional bar support
-# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.
-# @CODE
-#	optfeature "foo support" app-misc/foo
-#	optfeature "bar support" app-misc/bar app-misc/baz[bar]
-#	optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c
-# @CODE
-optfeature() {
-	debug-print-function ${FUNCNAME} "$@"
-	local i j msg
-	local desc=$1
-	local flag=0
-	shift
-	for i; do
-		for j in ${i}; do
-			if has_version "${j}"; then
-				flag=1
-			else
-				flag=0
-				break
-			fi
-		done
-		if [[ ${flag} -eq 1 ]]; then
-			break
-		fi
-	done
-	if [[ ${flag} -eq 0 ]]; then
-		for i; do
-			msg=" "
-			for j in ${i}; do
-				msg+=" ${j} and"
-			done
-			msg="${msg:0: -4} for ${desc}"
-			elog "${msg}"
-		done
-	fi
-}
-
 case ${EAPI:-0} in
 0|1|2|3|4)
 
-- 
2.28.0



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

* Re: [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils
  2020-09-06 15:47 [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils David Seifert
  2020-09-06 15:47 ` [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass David Seifert
@ 2020-09-06 15:51 ` Joonas Niilola
  2020-09-06 18:12   ` David Seifert
  1 sibling, 1 reply; 7+ messages in thread
From: Joonas Niilola @ 2020-09-06 15:51 UTC (permalink / raw
  To: gentoo-dev


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


On 9/6/20 6:47 PM, David Seifert wrote:
> ---
>  eclass/optfeature.eclass | 63 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100644 eclass/optfeature.eclass
>
Can we have the "why" answered? Wasn't this supposed to be part of
future EAPI?

-- juippis



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

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

* Re: [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils
  2020-09-06 15:51 ` [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils Joonas Niilola
@ 2020-09-06 18:12   ` David Seifert
  0 siblings, 0 replies; 7+ messages in thread
From: David Seifert @ 2020-09-06 18:12 UTC (permalink / raw
  To: gentoo-dev

On Sun, 2020-09-06 at 18:51 +0300, Joonas Niilola wrote:
> On 9/6/20 6:47 PM, David Seifert wrote:
> > ---
> >  eclass/optfeature.eclass | 63
> > ++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 63 insertions(+)
> >  create mode 100644 eclass/optfeature.eclass
> > 
> Can we have the "why" answered? Wasn't this supposed to be part of
> future EAPI?
> 
> -- juippis
> 
> 

It's one of those features that comes up once a year, everyone agrees
that it would be great to have, noone wants to provide a proof-of-
concept because portage, and then it gets deferred for another round of
EAPI. Unless I can be convinced that it will be in EAPI 8, this function
will likely stick around.



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

* Re: [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass
  2020-09-06 15:47 ` [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass David Seifert
@ 2020-09-06 19:49   ` Ulrich Mueller
  2020-09-06 21:11     ` David Seifert
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Mueller @ 2020-09-06 19:49 UTC (permalink / raw
  To: David Seifert; +Cc: gentoo-dev

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

>>>>> On Sun, 06 Sep 2020, David Seifert wrote:

> @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
>  # implicitly inherited (now split) eclasses
>  case ${EAPI:-0} in
>  0|1|2|3|4|5|6)
> -	inherit desktop epatch estack ltprune multilib preserve-libs \
> +	inherit desktop epatch estack ltprune multilib optfeature preserve-libs \
>  		toolchain-funcs vcs-clean
>  	;;
>  esac

I count 163 ebuilds calling optfeature in EAPI 7, but only 24 in older
EAPIs, which makes me wonder if the conditional inherit makes any sense.

Maybe just commit the new eclass, update ebuilds, then remove the
function from eutils?

Ulrich

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

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

* Re: [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass
  2020-09-06 19:49   ` Ulrich Mueller
@ 2020-09-06 21:11     ` David Seifert
  2020-09-07  7:37       ` Ulrich Mueller
  0 siblings, 1 reply; 7+ messages in thread
From: David Seifert @ 2020-09-06 21:11 UTC (permalink / raw
  To: gentoo-dev

On Sun, 2020-09-06 at 21:49 +0200, Ulrich Mueller wrote:
> > > > > > On Sun, 06 Sep 2020, David Seifert wrote:
> > @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
> >  # implicitly inherited (now split) eclasses
> >  case ${EAPI:-0} in
> >  0|1|2|3|4|5|6)
> > -	inherit desktop epatch estack ltprune multilib preserve-libs \
> > +	inherit desktop epatch estack ltprune multilib optfeature
> > preserve-libs \
> >  		toolchain-funcs vcs-clean
> >  	;;
> >  esac
> 
> I count 163 ebuilds calling optfeature in EAPI 7, but only 24 in older
> EAPIs, which makes me wonder if the conditional inherit makes any
> sense.
> 
> Maybe just commit the new eclass, update ebuilds, then remove the
> function from eutils?
> 
> Ulrich

I'll get a lot of heat for breaking EAPI 2 ebuilds in some random
abandoned overlay because we guarantee eclass API backwards
compatibility for 20 years!



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

* Re: [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass
  2020-09-06 21:11     ` David Seifert
@ 2020-09-07  7:37       ` Ulrich Mueller
  0 siblings, 0 replies; 7+ messages in thread
From: Ulrich Mueller @ 2020-09-07  7:37 UTC (permalink / raw
  To: David Seifert; +Cc: gentoo-dev

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

>>>>> On Sun, 06 Sep 2020, David Seifert wrote:

> On Sun, 2020-09-06 at 21:49 +0200, Ulrich Mueller wrote:
>> Maybe just commit the new eclass, update ebuilds, then remove the
>> function from eutils?

> I'll get a lot of heat for breaking EAPI 2 ebuilds in some random
> abandoned overlay because we guarantee eclass API backwards
> compatibility for 20 years!

optfeature affects only elog output, so there won't be any real
breakage.

And of course, there should be some grace period (I'd suggest 30 days)
between steps 2 and 3.

Ulrich

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

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

end of thread, other threads:[~2020-09-07  7:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-06 15:47 [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils David Seifert
2020-09-06 15:47 ` [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass David Seifert
2020-09-06 19:49   ` Ulrich Mueller
2020-09-06 21:11     ` David Seifert
2020-09-07  7:37       ` Ulrich Mueller
2020-09-06 15:51 ` [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils Joonas Niilola
2020-09-06 18:12   ` David Seifert

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