How to handle go dependencies

Dmitri Goutnik dg at syrec.org
Sun Jun 23 21:40:59 UTC 2019


On 19-06-23 22:21:44, Matthias Fechner wrote:
> Am 23.06.2019 um 11:57 schrieb Tobias Kortkamp:
> > Please do not use it.  It is broken in many ways.  Use Dimtri's
> > devel/modules2tuple instead.  Change to WRKSRC of your port and run
> > `go mod vendor` then `modules2tuple vendor/modules.txt` and it will
> > spit out an appropriate GH_TUPLE etc.
> 
> thanks that looks fine now. I added also a target `gomod-deps` to get
> that more easily generated.
> It currently seems to only support GH and not GL, this could maybe
> improved later.
> 
> > Probably you need
> > USE_GITHUB=	nodefault
> >
> > and it should work.
> 
> seems ok, I have now the following:
> https://gitlab.fechner.net/mfechner/Gitlab/commit/e83876fb9de9c79c39ba85801ebb242a08f5412c
> 
> But now I get the error message:
> =======================<phase: check-sanity   >============================
> The
> https://gitlab.com/gitlab-org/gitaly-proto/repository/f4db5d05d437abe1154d7308ca044d3577b5ccba/archive.tar.gz?dummy=/:gitaly-proto
> MASTER_SITES line has
> a group with invalid characters, only use [a-zA-Z0-9_]
> *** Error code 1
> 
> This seems to be a bug in the ports?
> Why is a `-` an invalid character, it exists in:
> https://gitlab.com/gitlab-org/gitaly/
> 
> Is there a way out?
> 
> Gruß
> Matthias
> 

Hi Matthias,

Gitaly seems to be using gmake for build so USES=go won't work here because 
go.mk would add a "do-build" target (as port's Makefile doesn't define one 
explicitly) and it will break the build,

-USES=		gmake go go:modules
+USES=		gmake
-MAKE_ENV+=	GOPATH=${WRKSRC}

The group error is coming from this GL_TUPLE line:

gitlab-org:gitaly-proto:f4db5d05d437abe1154d7308ca044d3577b5ccba:gitaly-proto/vendor/gitlab.com/gitlab-org/gitaly-proto

"gitaly-proto" is not a valid group name (contains "-"); can be fixed by 
changing the group name to e.g. "gitaly_proto"

Upstream's Makefile is disabling Go modules support by setting 
GO111MODULES=off so "rm go.mod" can be removed from post-patch (go.mod is 
ignored with GO111MODULES=off):

 post-patch:
 	${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" ${WRKSRC}/config.toml.example
 	${MV} ${WRKSRC}/config.toml.example ${WRKSRC}/config.toml.sample
-	${RM} ${WRKSRC}/go.mod

-- Dmitri Goutnik
dg at syrec.org


More information about the freebsd-ports mailing list