From: Florian Schmaus <flow@gentoo.org>
To: gentoo-dev@lists.gentoo.org, williamh@gentoo.org
Cc: Florian Schmaus <flow@gentoo.org>
Subject: [gentoo-dev] [PATCH] go-module.eclass: Add GO_OPTIONAL flag
Date: Sun, 21 Nov 2021 11:57:49 +0100 [thread overview]
Message-ID: <20211121105749.178349-1-flow@gentoo.org> (raw)
Following the pattern found in other eclasses, add GO_OPTIONAL to the
go-module eclass. This allows to inherit the eclass without pulling
its dependencies. See, e.g., bug #775779 for the motivation.
Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
eclass/go-module.eclass | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index 3ad8542a28ae..c9eb90ac62ea 100644
--- a/eclass/go-module.eclass
+++ b/eclass/go-module.eclass
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Gentoo Authors
+# Copyright 2019-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: go-module.eclass
@@ -55,13 +55,17 @@ if [[ -z ${_GO_MODULE} ]]; then
_GO_MODULE=1
-BDEPEND=">=dev-lang/go-1.12"
+if [[ ! ${GO_OPTIONAL} ]]; then
+ BDEPEND=">=dev-lang/go-1.12"
-# Workaround for pkgcheck false positive: https://github.com/pkgcore/pkgcheck/issues/214
-# MissingUnpackerDep: version ...: missing BDEPEND="app-arch/unzip"
-# Added here rather than to each affected package, so it can be cleaned up just
-# once when pkgcheck is improved.
-BDEPEND+=" app-arch/unzip"
+ # Workaround for pkgcheck false positive: https://github.com/pkgcore/pkgcheck/issues/214
+ # MissingUnpackerDep: version ...: missing BDEPEND="app-arch/unzip"
+ # Added here rather than to each affected package, so it can be cleaned up just
+ # once when pkgcheck is improved.
+ BDEPEND+=" app-arch/unzip"
+
+ EXPORT_FUNCTIONS src_unpack
+fi
# Force go to build in module mode.
# In this mode the GOPATH environment variable is ignored.
@@ -83,8 +87,6 @@ QA_FLAGS_IGNORED='.*'
# Go packages should not be stripped with strip(1).
RESTRICT+=" strip"
-EXPORT_FUNCTIONS src_unpack
-
# @ECLASS-VARIABLE: EGO_SUM
# @DESCRIPTION:
# This is an array based on the go.sum content from inside the target package.
@@ -147,6 +149,17 @@ EXPORT_FUNCTIONS src_unpack
# directory structure.
declare -A -g _GOMODULE_GOSUM_REVERSE_MAP
+# @ECLASS-VARIABLE: GO_OPTIONAL
+# @DEFAULT_UNSET
+# @PRE_INHERIT
+# @DESCRIPTION:
+# If set to a non-null value before inherit, then the Go part of the
+# ebuild will be considered optional. No dependencies will be added and
+# no phase functions will be exported.
+#
+# If you enable GO_OPTIONAL, you have to set BDEPEND on >=dev-lang/go-1.12
+# for your package and call go-module_src_unpack manually.
+
# @FUNCTION: go-module_set_globals
# @DESCRIPTION:
# Convert the information in EGO_SUM for other usage in the ebuild.
--
2.32.0
next reply other threads:[~2021-11-21 10:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-21 10:57 Florian Schmaus [this message]
2021-11-28 19:23 ` [gentoo-dev] [PATCH] go-module.eclass: Add GO_OPTIONAL flag Zac Medico
2021-11-28 19:52 ` William Hubbs
2021-11-29 4:17 ` Alec Warner
2021-12-07 20:21 ` Florian Schmaus
2021-11-29 4:54 ` Sam James
2021-12-11 21:45 ` William Hubbs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211121105749.178349-1-flow@gentoo.org \
--to=flow@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=williamh@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox