From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1CB49158086 for ; Sun, 28 Nov 2021 19:52:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2E6AD2BC033; Sun, 28 Nov 2021 19:52:42 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CFD602BC001 for ; Sun, 28 Nov 2021 19:52:41 +0000 (UTC) Received: (nullmailer pid 27718 invoked by uid 1000); Sun, 28 Nov 2021 19:52:38 -0000 Date: Sun, 28 Nov 2021 13:52:38 -0600 From: William Hubbs To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] go-module.eclass: Add GO_OPTIONAL flag Message-ID: Mail-Followup-To: gentoo-dev@lists.gentoo.org References: <20211121105749.178349-1-flow@gentoo.org> <766db4fd-ce97-fa24-7abd-d19c4eb50a69@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OwjGDAK0QUiioEpH" Content-Disposition: inline In-Reply-To: <766db4fd-ce97-fa24-7abd-d19c4eb50a69@gentoo.org> X-Archives-Salt: e819db60-e1b9-45a8-b66b-2fed50bccc6f X-Archives-Hash: aad22a95d2854405563b6ab5abf5f0b9 --OwjGDAK0QUiioEpH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 28, 2021 at 11:23:16AM -0800, Zac Medico wrote: > On 11/21/21 02:57, Florian Schmaus wrote: > > 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. > >=20 > > Signed-off-by: Florian Schmaus > > --- > > eclass/go-module.eclass | 31 ++++++++++++++++++++++--------- > > 1 file changed, 22 insertions(+), 9 deletions(-) > >=20 > > 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 > > =20 > > # @ECLASS: go-module.eclass > > @@ -55,13 +55,17 @@ if [[ -z ${_GO_MODULE} ]]; then > > =20 > > _GO_MODULE=3D1 > > =20 > > -BDEPEND=3D">=3Ddev-lang/go-1.12" > > +if [[ ! ${GO_OPTIONAL} ]]; then > > + BDEPEND=3D">=3Ddev-lang/go-1.12" > > =20 > > -# Workaround for pkgcheck false positive: https://github.com/pkgcore/p= kgcheck/issues/214 > > -# MissingUnpackerDep: version ...: missing BDEPEND=3D"app-arch/unzip" > > -# Added here rather than to each affected package, so it can be cleane= d up just > > -# once when pkgcheck is improved. > > -BDEPEND+=3D" app-arch/unzip" > > + # Workaround for pkgcheck false positive: https://github.com/pkgcore/= pkgcheck/issues/214 > > + # MissingUnpackerDep: version ...: missing BDEPEND=3D"app-arch/unzip" > > + # Added here rather than to each affected package, so it can be clean= ed up just > > + # once when pkgcheck is improved. > > + BDEPEND+=3D" app-arch/unzip" > > + > > + EXPORT_FUNCTIONS src_unpack > > +fi > > =20 > > # Force go to build in module mode. > > # In this mode the GOPATH environment variable is ignored. > > @@ -83,8 +87,6 @@ QA_FLAGS_IGNORED=3D'.*' > > # Go packages should not be stripped with strip(1). > > RESTRICT+=3D" strip" > > =20 > > -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 > > =20 > > +# @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 >=3Ddev-lang/g= o-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. > >=20 >=20 > How about if we also add a GO_DEPEND variable, so that eclasshi=20 > consumers can do something like BDEPEND=3D"go? ( ${GO_DEPEND} )" ? > --=20 > Thanks, > Zac this is on my radar. I haven't read the bug yet, but I'll look at it, if not today, sometime this week. Without looking at the bug, I'm not sure why you would want to use this eclass without depending on dev-lang/go. Also, if you have to write src_unpack you can call go-module_setup_proxy in src_unpack to set things up. William --OwjGDAK0QUiioEpH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQTVeuxEZo4uUHOkQAluVBb0MMRlOAUCYaPeAQAKCRBuVBb0MMRl OGdXAJ42JiLDxnFY/O606BIJdHZVOxStegCgmn+w1SL+GlmrCKFSiMqVPMGBGQo= =Xa2M -----END PGP SIGNATURE----- --OwjGDAK0QUiioEpH--