Gentoo Archives: gentoo-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-dev@l.g.o, Florian Schmaus <flow@g.o>, williamh@g.o
Subject: Re: [gentoo-dev] [PATCH] go-module.eclass: Add GO_OPTIONAL flag
Date: Sun, 28 Nov 2021 19:23:25
Message-Id: 766db4fd-ce97-fa24-7abd-d19c4eb50a69@gentoo.org
In Reply to: [gentoo-dev] [PATCH] go-module.eclass: Add GO_OPTIONAL flag by Florian Schmaus
1 On 11/21/21 02:57, Florian Schmaus wrote:
2 > Following the pattern found in other eclasses, add GO_OPTIONAL to the
3 > go-module eclass. This allows to inherit the eclass without pulling
4 > its dependencies. See, e.g., bug #775779 for the motivation.
5 >
6 > Signed-off-by: Florian Schmaus <flow@g.o>
7 > ---
8 > eclass/go-module.eclass | 31 ++++++++++++++++++++++---------
9 > 1 file changed, 22 insertions(+), 9 deletions(-)
10 >
11 > diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
12 > index 3ad8542a28ae..c9eb90ac62ea 100644
13 > --- a/eclass/go-module.eclass
14 > +++ b/eclass/go-module.eclass
15 > @@ -1,4 +1,4 @@
16 > -# Copyright 2019-2020 Gentoo Authors
17 > +# Copyright 2019-2021 Gentoo Authors
18 > # Distributed under the terms of the GNU General Public License v2
19 >
20 > # @ECLASS: go-module.eclass
21 > @@ -55,13 +55,17 @@ if [[ -z ${_GO_MODULE} ]]; then
22 >
23 > _GO_MODULE=1
24 >
25 > -BDEPEND=">=dev-lang/go-1.12"
26 > +if [[ ! ${GO_OPTIONAL} ]]; then
27 > + BDEPEND=">=dev-lang/go-1.12"
28 >
29 > -# Workaround for pkgcheck false positive: https://github.com/pkgcore/pkgcheck/issues/214
30 > -# MissingUnpackerDep: version ...: missing BDEPEND="app-arch/unzip"
31 > -# Added here rather than to each affected package, so it can be cleaned up just
32 > -# once when pkgcheck is improved.
33 > -BDEPEND+=" app-arch/unzip"
34 > + # Workaround for pkgcheck false positive: https://github.com/pkgcore/pkgcheck/issues/214
35 > + # MissingUnpackerDep: version ...: missing BDEPEND="app-arch/unzip"
36 > + # Added here rather than to each affected package, so it can be cleaned up just
37 > + # once when pkgcheck is improved.
38 > + BDEPEND+=" app-arch/unzip"
39 > +
40 > + EXPORT_FUNCTIONS src_unpack
41 > +fi
42 >
43 > # Force go to build in module mode.
44 > # In this mode the GOPATH environment variable is ignored.
45 > @@ -83,8 +87,6 @@ QA_FLAGS_IGNORED='.*'
46 > # Go packages should not be stripped with strip(1).
47 > RESTRICT+=" strip"
48 >
49 > -EXPORT_FUNCTIONS src_unpack
50 > -
51 > # @ECLASS-VARIABLE: EGO_SUM
52 > # @DESCRIPTION:
53 > # This is an array based on the go.sum content from inside the target package.
54 > @@ -147,6 +149,17 @@ EXPORT_FUNCTIONS src_unpack
55 > # directory structure.
56 > declare -A -g _GOMODULE_GOSUM_REVERSE_MAP
57 >
58 > +# @ECLASS-VARIABLE: GO_OPTIONAL
59 > +# @DEFAULT_UNSET
60 > +# @PRE_INHERIT
61 > +# @DESCRIPTION:
62 > +# If set to a non-null value before inherit, then the Go part of the
63 > +# ebuild will be considered optional. No dependencies will be added and
64 > +# no phase functions will be exported.
65 > +#
66 > +# If you enable GO_OPTIONAL, you have to set BDEPEND on >=dev-lang/go-1.12
67 > +# for your package and call go-module_src_unpack manually.
68 > +
69 > # @FUNCTION: go-module_set_globals
70 > # @DESCRIPTION:
71 > # Convert the information in EGO_SUM for other usage in the ebuild.
72 >
73
74 How about if we also add a GO_DEPEND variable, so that eclasshi
75 consumers can do something like BDEPEND="go? ( ${GO_DEPEND} )" ?
76 --
77 Thanks,
78 Zac

Attachments

File name MIME type
OpenPGP_signature.asc application/pgp-signature

Replies