public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support
@ 2021-07-15 11:19 Florian Schmaus
  2021-07-15 12:03 ` Ulrich Mueller
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Florian Schmaus @ 2021-07-15 11:19 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
 eclass/xdg.eclass | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 219be712e84d..a1545e113ff8 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: xdg.eclass
@@ -6,7 +6,7 @@
 # freedesktop-bugs@gentoo.org
 # @AUTHOR:
 # Original author: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7
+# @SUPPORTED_EAPIS: 4 5 6 7 8
 # @BLURB: Provides phases for XDG compliant packages.
 # @DESCRIPTION:
 # Utility eclass to update the desktop, icon and shared mime info as laid
@@ -15,7 +15,7 @@
 inherit xdg-utils
 
 case "${EAPI:-0}" in
-	4|5|6|7)
+	4|5|6|7|8)
 		EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
 		;;
 	*) die "EAPI=${EAPI} is not supported" ;;
@@ -23,10 +23,19 @@ esac
 
 # Avoid dependency loop as both depend on glib-2
 if [[ ${CATEGORY}/${P} != dev-libs/glib-2.* ]] ; then
-DEPEND="
+_XDG_DEPEND="
 	dev-util/desktop-file-utils
 	x11-misc/shared-mime-info
 "
+
+case "${EAPI:-0}" in
+	4|5|6|7)
+		DEPEND="${_XDG_DEPEND}"
+		;;
+	*)
+		IDEPEND="${_XDG_DEPEND}"
+		;;
+esac
 fi
 
 # @FUNCTION: xdg_src_prepare
-- 
2.31.1



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

* Re: [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support
  2021-07-15 11:19 [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support Florian Schmaus
@ 2021-07-15 12:03 ` Ulrich Mueller
  2021-07-15 13:22   ` Mart Raudsepp
  2021-07-15 13:00 ` Ionen Wolkens
  2021-07-21 15:08 ` [gentoo-dev] [PATCH v2] " Florian Schmaus
  2 siblings, 1 reply; 16+ messages in thread
From: Ulrich Mueller @ 2021-07-15 12:03 UTC (permalink / raw
  To: Florian Schmaus; +Cc: gentoo-dev

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

>>>>> On Thu, 15 Jul 2021, Florian Schmaus wrote:
 
> -DEPEND="
> +_XDG_DEPEND="
>  	dev-util/desktop-file-utils
>  	x11-misc/shared-mime-info
>  "
> +
> +case "${EAPI:-0}" in
> +	4|5|6|7)
> +		DEPEND="${_XDG_DEPEND}"
> +		;;
> +	*)
> +		IDEPEND="${_XDG_DEPEND}"
> +		;;
> +esac

If it is IDEPEND in EAPI 8 (i.e. an install-time dependency which
applies to pkg_postinst etc.), then presumably the best approximation
in other EAPIs would be RDEPEND:
https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-720008.1

Think about installion of a binpkg where DEPEND won't be pulled in.

Ulrich

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

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

* Re: [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support
  2021-07-15 11:19 [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support Florian Schmaus
  2021-07-15 12:03 ` Ulrich Mueller
@ 2021-07-15 13:00 ` Ionen Wolkens
  2021-07-15 13:23   ` Ulrich Mueller
  2021-07-21 15:08 ` [gentoo-dev] [PATCH v2] " Florian Schmaus
  2 siblings, 1 reply; 16+ messages in thread
From: Ionen Wolkens @ 2021-07-15 13:00 UTC (permalink / raw
  To: gentoo-dev

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

It'd probably need more discussion but there's two things I'd like
to see if EAPI-8 bump this:

1. remove src_prepare export in EAPI-8
While "some" packages need xdg_environment_reset, most don't because
the eclass is often only inherited to handle icons/.desktop and this
just needlessly overwrite the src_prepare of other eclasses requiring
more careful inherit ordering (e.g. inherit xdg cmake).

I'd prefer it was clear when a package need this by calling
xdg_environment_reset directly. Unless there is a non-trivial amount
of packages that need it (e.g. for tests) that I'm not aware of.

2. no *DEPEND in EAPI-8 rather than IDEPEND
xdg-utils is designed to not fail if these tools are missing and
cache updates are done "all at once" catching anything missing.
Then this cache shouldn't be needed until these tools are emerged,
preferably as a dep of a library using this cache + do 1st generation.

Many ebuilds already lack these deps by using xdg-utils directly,
so impact should be minimal.

Lack of *DEPEND is also useful for packages with optional gui support
that don't always install icons/.desktop, without falling back to
xdg-utils.

Old DEPEND should be kept as-is not to risk breaking packages with odd
checks that need it present at build time. I'd rather no RDEPEND switch
either as it'll just complicate things with revbumps and tools don't
really need to be in RDEPEND given the above.

-- 
ionen

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

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

* Re: [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support
  2021-07-15 12:03 ` Ulrich Mueller
@ 2021-07-15 13:22   ` Mart Raudsepp
  0 siblings, 0 replies; 16+ messages in thread
From: Mart Raudsepp @ 2021-07-15 13:22 UTC (permalink / raw
  To: gentoo-dev, Florian Schmaus

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

Ühel kenal päeval, N, 15.07.2021 kell 14:03, kirjutas Ulrich Mueller:
> > > > > > On Thu, 15 Jul 2021, Florian Schmaus wrote:
>  
> > -DEPEND="
> > +_XDG_DEPEND="
> >         dev-util/desktop-file-utils
> >         x11-misc/shared-mime-info
> >  "
> > +
> > +case "${EAPI:-0}" in
> > +       4|5|6|7)
> > +               DEPEND="${_XDG_DEPEND}"
> > +               ;;
> > +       *)
> > +               IDEPEND="${_XDG_DEPEND}"
> > +               ;;
> > +esac
> 
> If it is IDEPEND in EAPI 8 (i.e. an install-time dependency which
> applies to pkg_postinst etc.), then presumably the best approximation
> in other EAPIs would be RDEPEND:
> https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-720008.1
> 
> Think about installion of a binpkg where DEPEND won't be pulled in.

Changing where it is for old EAPIs is presumably not the subject of
this patchset. DEPEND is where it was before, and DEPEND is where it
should remain after. I'm aware of the incorrectness, but RDEPEND has
its other problems for these deps - this is why IDEPEND exists now.
As this is not the purpose of this patch, we shouldn't dwelve into this
subject further - EAPI-8 is here now to fix this.


Mart

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

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

* Re: [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support
  2021-07-15 13:00 ` Ionen Wolkens
@ 2021-07-15 13:23   ` Ulrich Mueller
  2021-07-15 13:29     ` Ionen Wolkens
  0 siblings, 1 reply; 16+ messages in thread
From: Ulrich Mueller @ 2021-07-15 13:23 UTC (permalink / raw
  To: gentoo-dev

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

>>>>> On Thu, 15 Jul 2021, Ionen Wolkens wrote:

> Old DEPEND should be kept as-is not to risk breaking packages with odd
> checks that need it present at build time. I'd rather no RDEPEND switch
> either as it'll just complicate things with revbumps and tools don't
> really need to be in RDEPEND given the above.

Well, if the challenge was to pick the _worst_ match out of
{,B,R,I}DEPEND then DEPEND would be the correct answer. :)

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

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

* Re: [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support
  2021-07-15 13:23   ` Ulrich Mueller
@ 2021-07-15 13:29     ` Ionen Wolkens
  2021-07-15 18:17       ` Mike Gilbert
  0 siblings, 1 reply; 16+ messages in thread
From: Ionen Wolkens @ 2021-07-15 13:29 UTC (permalink / raw
  To: gentoo-dev

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

On Thu, Jul 15, 2021 at 03:23:04PM +0200, Ulrich Mueller wrote:
> >>>>> On Thu, 15 Jul 2021, Ionen Wolkens wrote:
> 
> > Old DEPEND should be kept as-is not to risk breaking packages with odd
> > checks that need it present at build time. I'd rather no RDEPEND switch
> > either as it'll just complicate things with revbumps and tools don't
> > really need to be in RDEPEND given the above.
> 
> Well, if the challenge was to pick the _worst_ match out of
> {,B,R,I}DEPEND then DEPEND would be the correct answer. :)

Well, if really must improve it, I think BDEPEND is the better choice.

Some packages use desktop-file-validate for their tests and the like.

-- 
ionen

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

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

* Re: [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support
  2021-07-15 13:29     ` Ionen Wolkens
@ 2021-07-15 18:17       ` Mike Gilbert
  0 siblings, 0 replies; 16+ messages in thread
From: Mike Gilbert @ 2021-07-15 18:17 UTC (permalink / raw
  To: Gentoo Dev

On Thu, Jul 15, 2021 at 9:29 AM Ionen Wolkens <ionen@gentoo.org> wrote:
>
> On Thu, Jul 15, 2021 at 03:23:04PM +0200, Ulrich Mueller wrote:
> > >>>>> On Thu, 15 Jul 2021, Ionen Wolkens wrote:
> >
> > > Old DEPEND should be kept as-is not to risk breaking packages with odd
> > > checks that need it present at build time. I'd rather no RDEPEND switch
> > > either as it'll just complicate things with revbumps and tools don't
> > > really need to be in RDEPEND given the above.
> >
> > Well, if the challenge was to pick the _worst_ match out of
> > {,B,R,I}DEPEND then DEPEND would be the correct answer. :)
>
> Well, if really must improve it, I think BDEPEND is the better choice.
>
> Some packages use desktop-file-validate for their tests and the like.

If ebuilds are using these programs directly (like for testing), they
should really declare the dependency explicitly instead of relying on
an implicit dependency in xdg.eclass. The eclass deps should be
limited to functionality utilized by its exported phase functions.

However, I realize older ebuilds were not written with that reasoning
in mind, so I understand the "don't mess with older EAPIs" request
from leio.

Regarding BDEPEND/RDEPEND/IDEPEND, here's what we did with fcaps.eclass:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=789ec15b80a0ad2902d59be5bdb7c5fa6fcd0092

Quoting the commit message:

    This defines the native install-time libcap dependency as:

      - EAPI < 7: RDEPEND
            Only regular ROOT=/ builds can be expected to work.

      - EAPI = 7: RDEPEND + BDEPEND
            Also install the native setcap at built time, so cross-
            compiling will work, but not installing binpkgs in ROOTs.

      - EAPI > 7: IDEPEND
            Install native setcap at install-time; it works everywhere.


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

* [gentoo-dev] [PATCH v2] xdg.eclass: add EAPI 8 support
  2021-07-15 11:19 [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support Florian Schmaus
  2021-07-15 12:03 ` Ulrich Mueller
  2021-07-15 13:00 ` Ionen Wolkens
@ 2021-07-21 15:08 ` Florian Schmaus
  2021-07-21 16:37   ` Ulrich Mueller
                     ` (2 more replies)
  2 siblings, 3 replies; 16+ messages in thread
From: Florian Schmaus @ 2021-07-21 15:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

Note that this removes the export of src_prepare in EPAI 8 as
requested by ionen:

  1. remove src_prepare export in EAPI-8

  While "some" packages need xdg_environment_reset, most don't because
  the eclass is often only inherited to handle icons/.desktop and this
  just needlessly overwrite the src_prepare of other eclasses requiring
  more careful inherit ordering (e.g. inherit xdg cmake).

  I'd prefer it was clear when a package need this by calling
  xdg_environment_reset directly. Unless there is a non-trivial amount
  of packages that need it (e.g. for tests) that I'm not aware of.

Signed-off-by: Florian Schmaus <flow@gentoo.org>
---

Notes:
    - Do not longer export src_prepare in EAPI 8 (as requested by ionen)

 eclass/xdg.eclass | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 219be712e84d..ce2d337bff5c 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: xdg.eclass
@@ -6,7 +6,7 @@
 # freedesktop-bugs@gentoo.org
 # @AUTHOR:
 # Original author: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7
+# @SUPPORTED_EAPIS: 4 5 6 7 8
 # @BLURB: Provides phases for XDG compliant packages.
 # @DESCRIPTION:
 # Utility eclass to update the desktop, icon and shared mime info as laid
@@ -16,22 +16,36 @@ inherit xdg-utils
 
 case "${EAPI:-0}" in
 	4|5|6|7)
-		EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
+		# src_prepare is only exported in EAPI < 8.
+		EXPORT_FUNCTIONS src_prepare
+		;&
+	8)
+		EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
 		;;
 	*) die "EAPI=${EAPI} is not supported" ;;
 esac
 
 # Avoid dependency loop as both depend on glib-2
 if [[ ${CATEGORY}/${P} != dev-libs/glib-2.* ]] ; then
-DEPEND="
+_XDG_DEPEND="
 	dev-util/desktop-file-utils
 	x11-misc/shared-mime-info
 "
+
+case "${EAPI}" in
+	4|5|6|7)
+		DEPEND="${_XDG_DEPEND}"
+		;;
+	*)
+		IDEPEND="${_XDG_DEPEND}"
+		;;
+esac
 fi
 
 # @FUNCTION: xdg_src_prepare
 # @DESCRIPTION:
 # Prepare sources to work with XDG standards.
+# Note that this function is only exported in EAPIs < 8.
 xdg_src_prepare() {
 	xdg_environment_reset
 
-- 
2.31.1



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

* Re: [gentoo-dev] [PATCH v2] xdg.eclass: add EAPI 8 support
  2021-07-21 15:08 ` [gentoo-dev] [PATCH v2] " Florian Schmaus
@ 2021-07-21 16:37   ` Ulrich Mueller
  2021-08-03 11:40   ` Mart Raudsepp
  2021-08-09 18:32   ` [gentoo-dev] [PATCH v3 1/2] " Florian Schmaus
  2 siblings, 0 replies; 16+ messages in thread
From: Ulrich Mueller @ 2021-07-21 16:37 UTC (permalink / raw
  To: Florian Schmaus; +Cc: gentoo-dev

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

>>>>> On Wed, 21 Jul 2021, Florian Schmaus wrote:
 
>  case "${EAPI:-0}" in

This could be simplified to ${EAPI} (and no quotation marks).

>  	4|5|6|7)
> -		EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
> +		# src_prepare is only exported in EAPI < 8.
> +		EXPORT_FUNCTIONS src_prepare
> +		;&

The ;& terminator is a new Bash feature and cannot be used in EAPIs
older than 6. (Easy to fix: Simply move the following EXPORT_FUNCTIONS
below the case block.)

> +	8)
> +		EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
>  		;;
>  	*) die "EAPI=${EAPI} is not supported" ;;

Please prepend "${ECLASS}: " to the die message.

>  esac
 
>  # @FUNCTION: xdg_src_prepare
>  # @DESCRIPTION:
>  # Prepare sources to work with XDG standards.
> +# Note that this function is only exported in EAPIs < 8.
>  xdg_src_prepare() {
>  	xdg_environment_reset

I wonder, should the function be defined in EAPI 8 then? It calls
default, so presumably ebuilds would rather call xdg_environment_reset
directly?

Ulrich

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

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

* Re: [gentoo-dev] [PATCH v2] xdg.eclass: add EAPI 8 support
  2021-07-21 15:08 ` [gentoo-dev] [PATCH v2] " Florian Schmaus
  2021-07-21 16:37   ` Ulrich Mueller
@ 2021-08-03 11:40   ` Mart Raudsepp
  2021-08-09 18:32   ` [gentoo-dev] [PATCH v3 1/2] " Florian Schmaus
  2 siblings, 0 replies; 16+ messages in thread
From: Mart Raudsepp @ 2021-08-03 11:40 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

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

Ühel kenal päeval, K, 21.07.2021 kell 17:08, kirjutas Florian Schmaus:
> Note that this removes the export of src_prepare in EPAI 8 as
> requested by ionen:
> 
>   1. remove src_prepare export in EAPI-8
> 
>   While "some" packages need xdg_environment_reset, most don't
> because
>   the eclass is often only inherited to handle icons/.desktop and
> this
>   just needlessly overwrite the src_prepare of other eclasses
> requiring
>   more careful inherit ordering (e.g. inherit xdg cmake).
> 
>   I'd prefer it was clear when a package need this by calling
>   xdg_environment_reset directly. Unless there is a non-trivial
> amount
>   of packages that need it (e.g. for tests) that I'm not aware of.

asturm asked me to reply here if I think the changes are in the spirit
of xdg.eclass, so..

I'm not sure about the spirit, but I personally am fine with the
changes, after the technical nitpicks are figured out in the thread
here.

I do not like at all that we'll need to remember about calling
xdg_environment_reset sometimes, but the status quo of clashing with
other eclasses src_prepare export is probably worse.
And you needing this reset call or not is not at all immediately
obvious - it causing trouble may only happen during test suite run, for
example, when XDG_RUNTIME_DIR is written to, or something else ends up
causing writes to it. Basically ENV_UNSET was a great start, but does
not completely address our XDG env reset needs and it'd be great if
someone championed a full solution for EAPI-9 or something.

I'm starting to think the easiest is to just make the
xdg_environment_reset call unconditionally in meson.eclass
src_configure like cmake.eclass does, and forget all about this for
almost all possible cases.

That rant aside, I'm happy in spirit with the changes as proposed here.


Mart

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

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

* [gentoo-dev] [PATCH v3 1/2] xdg.eclass: add EAPI 8 support
  2021-07-21 15:08 ` [gentoo-dev] [PATCH v2] " Florian Schmaus
  2021-07-21 16:37   ` Ulrich Mueller
  2021-08-03 11:40   ` Mart Raudsepp
@ 2021-08-09 18:32   ` Florian Schmaus
  2021-08-09 18:32     ` [gentoo-dev] [PATCH v3 2/2] xdg.eclass: drop support for EAPI 4 Florian Schmaus
  2021-08-10  8:31     ` [gentoo-dev] [PATCH v3 1/2] xdg.eclass: add EAPI 8 support Andreas Sturmlechner
  2 siblings, 2 replies; 16+ messages in thread
From: Florian Schmaus @ 2021-08-09 18:32 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

Note that this removes the export of src_prepare in EPAI 8 as
requested by ionen:

  1. remove src_prepare export in EAPI-8

  While "some" packages need xdg_environment_reset, most don't because
  the eclass is often only inherited to handle icons/.desktop and this
  just needlessly overwrite the src_prepare of other eclasses requiring
  more careful inherit ordering (e.g. inherit xdg cmake).

  I'd prefer it was clear when a package need this by calling
  xdg_environment_reset directly. Unless there is a non-trivial amount
  of packages that need it (e.g. for tests) that I'm not aware of.

Thanks to ulm and others for providing feedback.

Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
 eclass/xdg.eclass | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 219be712e84d..d973a09c29d9 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: xdg.eclass
@@ -6,7 +6,7 @@
 # freedesktop-bugs@gentoo.org
 # @AUTHOR:
 # Original author: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7
+# @SUPPORTED_EAPIS: 4 5 6 7 8
 # @BLURB: Provides phases for XDG compliant packages.
 # @DESCRIPTION:
 # Utility eclass to update the desktop, icon and shared mime info as laid
@@ -14,29 +14,47 @@
 
 inherit xdg-utils
 
-case "${EAPI:-0}" in
+_DEFINE_XDG_SRC_PREPARE=false
+case "${EAPI}" in
 	4|5|6|7)
-		EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
+		# src_prepare is only exported in EAPI < 8.
+		EXPORT_FUNCTIONS src_prepare
+		_DEFINE_XDG_SRC_PREPARE=true
 		;;
-	*) die "EAPI=${EAPI} is not supported" ;;
+	8)
+		;;
+	*) die "${ECLASS}: EAPI=${EAPI} is not supported" ;;
 esac
+EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
 
 # Avoid dependency loop as both depend on glib-2
 if [[ ${CATEGORY}/${P} != dev-libs/glib-2.* ]] ; then
-DEPEND="
+_XDG_DEPEND="
 	dev-util/desktop-file-utils
 	x11-misc/shared-mime-info
 "
+
+case "${EAPI}" in
+	4|5|6|7)
+		DEPEND="${_XDG_DEPEND}"
+		;;
+	*)
+		IDEPEND="${_XDG_DEPEND}"
+		;;
+esac
 fi
 
+if ${_DEFINE_XDG_SRC_PREPARE}; then
 # @FUNCTION: xdg_src_prepare
 # @DESCRIPTION:
 # Prepare sources to work with XDG standards.
+# Note that this function is only defined and exported in EAPIs < 8.
 xdg_src_prepare() {
 	xdg_environment_reset
 
 	[[ ${EAPI:-0} != [45] ]] && default
 }
+fi
 
 # @FUNCTION: xdg_pkg_preinst
 # @DESCRIPTION:
-- 
2.31.1



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

* [gentoo-dev] [PATCH v3 2/2] xdg.eclass: drop support for EAPI 4
  2021-08-09 18:32   ` [gentoo-dev] [PATCH v3 1/2] " Florian Schmaus
@ 2021-08-09 18:32     ` Florian Schmaus
  2021-08-10 18:21       ` Andreas Sturmlechner
  2021-08-10  8:31     ` [gentoo-dev] [PATCH v3 1/2] xdg.eclass: add EAPI 8 support Andreas Sturmlechner
  1 sibling, 1 reply; 16+ messages in thread
From: Florian Schmaus @ 2021-08-09 18:32 UTC (permalink / raw
  To: gentoo-dev; +Cc: Florian Schmaus

Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
 eclass/xdg.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index d973a09c29d9..80d291a7de5b 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -6,7 +6,7 @@
 # freedesktop-bugs@gentoo.org
 # @AUTHOR:
 # Original author: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6 7 8
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: Provides phases for XDG compliant packages.
 # @DESCRIPTION:
 # Utility eclass to update the desktop, icon and shared mime info as laid
@@ -16,7 +16,7 @@ inherit xdg-utils
 
 _DEFINE_XDG_SRC_PREPARE=false
 case "${EAPI}" in
-	4|5|6|7)
+	5|6|7)
 		# src_prepare is only exported in EAPI < 8.
 		EXPORT_FUNCTIONS src_prepare
 		_DEFINE_XDG_SRC_PREPARE=true
@@ -35,7 +35,7 @@ _XDG_DEPEND="
 "
 
 case "${EAPI}" in
-	4|5|6|7)
+	5|6|7)
 		DEPEND="${_XDG_DEPEND}"
 		;;
 	*)
-- 
2.31.1



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

* Re: [gentoo-dev] [PATCH v3 1/2] xdg.eclass: add EAPI 8 support
  2021-08-09 18:32   ` [gentoo-dev] [PATCH v3 1/2] " Florian Schmaus
  2021-08-09 18:32     ` [gentoo-dev] [PATCH v3 2/2] xdg.eclass: drop support for EAPI 4 Florian Schmaus
@ 2021-08-10  8:31     ` Andreas Sturmlechner
  2021-08-11 11:54       ` Florian Schmaus
  1 sibling, 1 reply; 16+ messages in thread
From: Andreas Sturmlechner @ 2021-08-10  8:31 UTC (permalink / raw
  To: gentoo-dev

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

On Montag, 9. August 2021 20:32:07 CEST Florian Schmaus wrote:
> +if ${_DEFINE_XDG_SRC_PREPARE}; then

You don't need an extra variable for that:

if [[ ${EAPI} == [567] ]]; then

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

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

* Re: [gentoo-dev] [PATCH v3 2/2] xdg.eclass: drop support for EAPI 4
  2021-08-09 18:32     ` [gentoo-dev] [PATCH v3 2/2] xdg.eclass: drop support for EAPI 4 Florian Schmaus
@ 2021-08-10 18:21       ` Andreas Sturmlechner
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Sturmlechner @ 2021-08-10 18:21 UTC (permalink / raw
  To: gentoo-dev

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

On Montag, 9. August 2021 20:32:08 CEST Florian Schmaus wrote:
> --- a/eclass/xdg.eclass
> +++ b/eclass/xdg.eclass
> @@ -6,7 +6,7 @@
>  # freedesktop-bugs@gentoo.org
>  # @AUTHOR:
>  # Original author: Gilles Dartiguelongue <eva@gentoo.org>
> -# @SUPPORTED_EAPIS: 4 5 6 7 8
> +# @SUPPORTED_EAPIS: 5 6 7 8

Please also drop the occurrence in the EAPI check inside xdg_src_prepare().

Regards,
Andreas

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

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

* Re: [gentoo-dev] [PATCH v3 1/2] xdg.eclass: add EAPI 8 support
  2021-08-10  8:31     ` [gentoo-dev] [PATCH v3 1/2] xdg.eclass: add EAPI 8 support Andreas Sturmlechner
@ 2021-08-11 11:54       ` Florian Schmaus
  2021-08-11 12:40         ` Andreas Sturmlechner
  0 siblings, 1 reply; 16+ messages in thread
From: Florian Schmaus @ 2021-08-11 11:54 UTC (permalink / raw
  To: gentoo-dev

On 10/08/2021 10.31, Andreas Sturmlechner wrote:
> On Montag, 9. August 2021 20:32:07 CEST Florian Schmaus wrote:
>> +if ${_DEFINE_XDG_SRC_PREPARE}; then
> 
> You don't need an extra variable for that:
> 
> if [[ ${EAPI} == [567] ]]; then

Thanks for the suggestion, but I prefer the current approach.

It avoids that someone later drops support for EAPI 5 and forgets 
adjusting all the cases where it is mentioned. I think your other 
suggestion, that dropping EAPI 4 in xdg_src_prepare() when removing 
support for EAPI 4 was forgotten, somehow reinforces my point. :)

However, if someone feels strongly about this, then I am happy to drop 
the _DEFINE_XDG_SRC_PREPARE variable. That's definitely not a hill I 
want to die on.

- Flow




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

* Re: [gentoo-dev] [PATCH v3 1/2] xdg.eclass: add EAPI 8 support
  2021-08-11 11:54       ` Florian Schmaus
@ 2021-08-11 12:40         ` Andreas Sturmlechner
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Sturmlechner @ 2021-08-11 12:40 UTC (permalink / raw
  To: gentoo-dev

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

On Mittwoch, 11. August 2021 13:54:19 CEST Florian Schmaus wrote:
> On 10/08/2021 10.31, Andreas Sturmlechner wrote:
> > On Montag, 9. August 2021 20:32:07 CEST Florian Schmaus wrote:
> >> +if ${_DEFINE_XDG_SRC_PREPARE}; then
> > 
> > You don't need an extra variable for that:
> > 
> > if [[ ${EAPI} == [567] ]]; then
> 
> Thanks for the suggestion, but I prefer the current approach.
> 
> It avoids that someone later drops support for EAPI 5 and forgets
> adjusting all the cases where it is mentioned. I think your other
> suggestion, that dropping EAPI 4 in xdg_src_prepare() when removing
> support for EAPI 4 was forgotten, somehow reinforces my point. :)

Not really. Having to search for EAPI in the code is obvious when cleaning up 
EAPI, and is standard across many eclasses. If you miss that, you could just 
as well have _DEFINE_XDG_SRC_PREPARE linger on below after cleaning up the 
initialisation.

Regards

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

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

end of thread, other threads:[~2021-08-11 12:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-15 11:19 [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support Florian Schmaus
2021-07-15 12:03 ` Ulrich Mueller
2021-07-15 13:22   ` Mart Raudsepp
2021-07-15 13:00 ` Ionen Wolkens
2021-07-15 13:23   ` Ulrich Mueller
2021-07-15 13:29     ` Ionen Wolkens
2021-07-15 18:17       ` Mike Gilbert
2021-07-21 15:08 ` [gentoo-dev] [PATCH v2] " Florian Schmaus
2021-07-21 16:37   ` Ulrich Mueller
2021-08-03 11:40   ` Mart Raudsepp
2021-08-09 18:32   ` [gentoo-dev] [PATCH v3 1/2] " Florian Schmaus
2021-08-09 18:32     ` [gentoo-dev] [PATCH v3 2/2] xdg.eclass: drop support for EAPI 4 Florian Schmaus
2021-08-10 18:21       ` Andreas Sturmlechner
2021-08-10  8:31     ` [gentoo-dev] [PATCH v3 1/2] xdg.eclass: add EAPI 8 support Andreas Sturmlechner
2021-08-11 11:54       ` Florian Schmaus
2021-08-11 12:40         ` Andreas Sturmlechner

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