Mailing List Archive

[PATCH] xdg.eclass: add EAPI 8 support
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
Re: [PATCH] xdg.eclass: add EAPI 8 support [ In reply to ]
>>>>> 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
Re: [PATCH] xdg.eclass: add EAPI 8 support [ In reply to ]
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
Re: [PATCH] xdg.eclass: add EAPI 8 support [ In reply to ]
Ü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
Re: [PATCH] xdg.eclass: add EAPI 8 support [ In reply to ]
>>>>> 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. :)
Re: [PATCH] xdg.eclass: add EAPI 8 support [ In reply to ]
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
Re: [PATCH] xdg.eclass: add EAPI 8 support [ In reply to ]
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.