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