Gentoo Archives: gentoo-dev

From: Florian Schmaus <flow@g.o>
To: gentoo-dev@l.g.o
Cc: Florian Schmaus <flow@g.o>
Subject: [gentoo-dev] [PATCH v2] xdg.eclass: add EAPI 8 support
Date: Wed, 21 Jul 2021 15:09:00
Message-Id: 20210721150849.175482-1-flow@gentoo.org
In Reply to: [gentoo-dev] [PATCH] xdg.eclass: add EAPI 8 support by Florian Schmaus
1 Note that this removes the export of src_prepare in EPAI 8 as
2 requested by ionen:
3
4 1. remove src_prepare export in EAPI-8
5
6 While "some" packages need xdg_environment_reset, most don't because
7 the eclass is often only inherited to handle icons/.desktop and this
8 just needlessly overwrite the src_prepare of other eclasses requiring
9 more careful inherit ordering (e.g. inherit xdg cmake).
10
11 I'd prefer it was clear when a package need this by calling
12 xdg_environment_reset directly. Unless there is a non-trivial amount
13 of packages that need it (e.g. for tests) that I'm not aware of.
14
15 Signed-off-by: Florian Schmaus <flow@g.o>
16 ---
17
18 Notes:
19 - Do not longer export src_prepare in EAPI 8 (as requested by ionen)
20
21 eclass/xdg.eclass | 22 ++++++++++++++++++----
22 1 file changed, 18 insertions(+), 4 deletions(-)
23
24 diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
25 index 219be712e84d..ce2d337bff5c 100644
26 --- a/eclass/xdg.eclass
27 +++ b/eclass/xdg.eclass
28 @@ -1,4 +1,4 @@
29 -# Copyright 1999-2019 Gentoo Authors
30 +# Copyright 1999-2021 Gentoo Authors
31 # Distributed under the terms of the GNU General Public License v2
32
33 # @ECLASS: xdg.eclass
34 @@ -6,7 +6,7 @@
35 # freedesktop-bugs@g.o
36 # @AUTHOR:
37 # Original author: Gilles Dartiguelongue <eva@g.o>
38 -# @SUPPORTED_EAPIS: 4 5 6 7
39 +# @SUPPORTED_EAPIS: 4 5 6 7 8
40 # @BLURB: Provides phases for XDG compliant packages.
41 # @DESCRIPTION:
42 # Utility eclass to update the desktop, icon and shared mime info as laid
43 @@ -16,22 +16,36 @@ inherit xdg-utils
44
45 case "${EAPI:-0}" in
46 4|5|6|7)
47 - EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
48 + # src_prepare is only exported in EAPI < 8.
49 + EXPORT_FUNCTIONS src_prepare
50 + ;&
51 + 8)
52 + EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
53 ;;
54 *) die "EAPI=${EAPI} is not supported" ;;
55 esac
56
57 # Avoid dependency loop as both depend on glib-2
58 if [[ ${CATEGORY}/${P} != dev-libs/glib-2.* ]] ; then
59 -DEPEND="
60 +_XDG_DEPEND="
61 dev-util/desktop-file-utils
62 x11-misc/shared-mime-info
63 "
64 +
65 +case "${EAPI}" in
66 + 4|5|6|7)
67 + DEPEND="${_XDG_DEPEND}"
68 + ;;
69 + *)
70 + IDEPEND="${_XDG_DEPEND}"
71 + ;;
72 +esac
73 fi
74
75 # @FUNCTION: xdg_src_prepare
76 # @DESCRIPTION:
77 # Prepare sources to work with XDG standards.
78 +# Note that this function is only exported in EAPIs < 8.
79 xdg_src_prepare() {
80 xdg_environment_reset
81
82 --
83 2.31.1

Replies