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