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 |
Thanks to ulm and others for providing feedback. |
16 |
|
17 |
Signed-off-by: Florian Schmaus <flow@g.o> |
18 |
--- |
19 |
eclass/xdg.eclass | 30 ++++++++++++++++++++++++------ |
20 |
1 file changed, 24 insertions(+), 6 deletions(-) |
21 |
|
22 |
diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass |
23 |
index 219be712e84d..d973a09c29d9 100644 |
24 |
--- a/eclass/xdg.eclass |
25 |
+++ b/eclass/xdg.eclass |
26 |
@@ -1,4 +1,4 @@ |
27 |
-# Copyright 1999-2019 Gentoo Authors |
28 |
+# Copyright 1999-2021 Gentoo Authors |
29 |
# Distributed under the terms of the GNU General Public License v2 |
30 |
|
31 |
# @ECLASS: xdg.eclass |
32 |
@@ -6,7 +6,7 @@ |
33 |
# freedesktop-bugs@g.o |
34 |
# @AUTHOR: |
35 |
# Original author: Gilles Dartiguelongue <eva@g.o> |
36 |
-# @SUPPORTED_EAPIS: 4 5 6 7 |
37 |
+# @SUPPORTED_EAPIS: 4 5 6 7 8 |
38 |
# @BLURB: Provides phases for XDG compliant packages. |
39 |
# @DESCRIPTION: |
40 |
# Utility eclass to update the desktop, icon and shared mime info as laid |
41 |
@@ -14,29 +14,47 @@ |
42 |
|
43 |
inherit xdg-utils |
44 |
|
45 |
-case "${EAPI:-0}" in |
46 |
+_DEFINE_XDG_SRC_PREPARE=false |
47 |
+case "${EAPI}" in |
48 |
4|5|6|7) |
49 |
- EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm |
50 |
+ # src_prepare is only exported in EAPI < 8. |
51 |
+ EXPORT_FUNCTIONS src_prepare |
52 |
+ _DEFINE_XDG_SRC_PREPARE=true |
53 |
;; |
54 |
- *) die "EAPI=${EAPI} is not supported" ;; |
55 |
+ 8) |
56 |
+ ;; |
57 |
+ *) die "${ECLASS}: EAPI=${EAPI} is not supported" ;; |
58 |
esac |
59 |
+EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm |
60 |
|
61 |
# Avoid dependency loop as both depend on glib-2 |
62 |
if [[ ${CATEGORY}/${P} != dev-libs/glib-2.* ]] ; then |
63 |
-DEPEND=" |
64 |
+_XDG_DEPEND=" |
65 |
dev-util/desktop-file-utils |
66 |
x11-misc/shared-mime-info |
67 |
" |
68 |
+ |
69 |
+case "${EAPI}" in |
70 |
+ 4|5|6|7) |
71 |
+ DEPEND="${_XDG_DEPEND}" |
72 |
+ ;; |
73 |
+ *) |
74 |
+ IDEPEND="${_XDG_DEPEND}" |
75 |
+ ;; |
76 |
+esac |
77 |
fi |
78 |
|
79 |
+if ${_DEFINE_XDG_SRC_PREPARE}; then |
80 |
# @FUNCTION: xdg_src_prepare |
81 |
# @DESCRIPTION: |
82 |
# Prepare sources to work with XDG standards. |
83 |
+# Note that this function is only defined and exported in EAPIs < 8. |
84 |
xdg_src_prepare() { |
85 |
xdg_environment_reset |
86 |
|
87 |
[[ ${EAPI:-0} != [45] ]] && default |
88 |
} |
89 |
+fi |
90 |
|
91 |
# @FUNCTION: xdg_pkg_preinst |
92 |
# @DESCRIPTION: |
93 |
-- |
94 |
2.31.1 |