Gentoo Archives: gentoo-dev

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass
Date: Wed, 06 Nov 2019 01:19:59
Message-Id: 4949294.KT39OxLedd@tuxbrain
In Reply to: Re: [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass by "Michał Górny"
1 On Tuesday, 5 November 2019 22:20:46 CET Michał Górny wrote:
2 > On Tue, 2019-11-05 at 00:30 +0100, Andreas Sturmlechner wrote:
3 > > --- /dev/null
4 > > +++ b/eclass/ecm-utils.eclass
5 >
6 > I know we historically screwed this up repeatedly but please don't use
7 > '-utils' for eclasses that export phases.
8
9 Fine, I would then choose ecm.eclass instead.
10
11 > > +# @ECLASS-VARIABLE: ECM_NONGUI
12 > > +# @DESCRIPTION:
13 > > +# If set to "false", add dependency on kde-frameworks/breeze-icons
14 > > +# or kde-frameworks/oxygen-icons and run the xdg.eclass routines for
15 > > +# pkg_preinst, pkg_postinst and pkg_postrm.
16 > > +# For any other value, do nothing.
17 > > +if [[ ${CATEGORY} = kde-frameworks ]]; then
18 > > + : ${ECM_NONGUI:=true}
19 > > +fi
20 > > +: ${ECM_NONGUI:=false}
21 >
22 > I don't think eclassdoc is going to parse this correctly.
23
24 Can we do something about that? I need to be able to set (overrideable)
25 defaults for a category without being limited by eclassdoc. @DEFAULT_UNSET
26 would not be precise. Same as ECM_QTHELP, this is what we do in kde5.eclass
27 already.
28
29 > > +# @ECLASS-VARIABLE: ECM_DEBUG
30 > > +# @DESCRIPTION:
31 > > +# If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and
32 > > +# -DQT_NO_DEBUG to CPPFLAGS.
33 > > +# Otherwise, add debug to IUSE.
34 > > +: ${ECM_DEBUG:=true}
35 >
36 > To be honest, I don't really like this 'anything-or-false' logic. It's
37 > rather confusing and error-prone. For example, if I misspell 'false'
38 > the eclass is going to silently assume true.
39
40 Making all options explicit then and erroring out on unknown input.
41
42 > > +# @FUNCTION: ecm_punt_bogus_dep
43 > > +# @USAGE: <prefix> <dependency>
44 > > +# @DESCRIPTION:
45 > > +# Removes a specified dependency from a find_package call with multiple
46 > > components.
47 > > +ecm_punt_bogus_dep() {
48 > > + local prefix=${1}
49 > > + local dep=${2}
50 > > +
51 > > + if [[ ! -e "CMakeLists.txt" ]]; then
52 >
53 > Can this really ever happen in a valid use case? Maybe it should be
54 > an error instead.
55
56 Even cmake-utils.eclass makes that check in cmake_comment_add_subdirectory and
57 leaves the erroring out if the file's missing central to src_prepare(), I
58 guess is why it was done that way.
59
60
61 Thanks for looking over it!
62
63 Regards,
64 Andreas

Replies

Subject Author
Re: [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass "Michał Górny" <mgorny@g.o>