Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2019 07:22:03 +0200
From:      Matthias Fechner <idefix@fechner.net>
To:        freebsd-ports@freebsd.org
Subject:   Re: How to handle go dependencies
Message-ID:  <15e9b821-bf51-0eee-6000-3032bf4067d1@fechner.net>
In-Reply-To: <d7b321e9-3258-45b1-7c65-5797908167b0@fechner.net>
References:  <d7b321e9-3258-45b1-7c65-5797908167b0@fechner.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--QgrE7WfFmYksNbqRMArWjURLYOQZcLp9U
Content-Type: multipart/mixed; boundary="nlbJrcVBW1wcRbBifGWCHJK62okrYeet8";
 protected-headers="v1"
From: Matthias Fechner <idefix@fechner.net>
To: freebsd-ports@freebsd.org
Message-ID: <15e9b821-bf51-0eee-6000-3032bf4067d1@fechner.net>
Subject: Re: How to handle go dependencies
References: <d7b321e9-3258-45b1-7c65-5797908167b0@fechner.net>
In-Reply-To: <d7b321e9-3258-45b1-7c65-5797908167b0@fechner.net>

--nlbJrcVBW1wcRbBifGWCHJK62okrYeet8
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Language: en-US

Am 22.06.2019 um 11:58 schrieb Matthias Fechner:
> What is the correct way to getting these dependencies fetched and
> correctly included into the work-source in the fetch step using go?


Here a short summary what I had to do to build the port successfully
with go deps.
Thanks a lot for all that helped here!

Add:
USES=3D=C2=A0=C2=A0=C2=A0 go:modules

I had to use this USES as the port is using gmake to build everything:
USES=3D=C2=A0=C2=A0=C2=A0 gmake go:modules,no_targets

As gmake is used, the GOFLAGS must be passed to gmake with:

MAKE_ENV=3D=C2=A0=C2=A0=C2=A0 GOFLAGS=3D"${GO_BUILDFLAGS}"

The port uses gitlab to fetch the distfiles, so I had to tell the ports
that github is not the default:
USE_GITHUB=3D=C2=A0=C2=A0=C2=A0 nodefault

The next step is then to create the GH_TUPLE and GL_TUPLE (depending
where the go libs are hosted, for they were on github and gitlab).
For this a very handy tool from Dmitri is existing: ports-mgmt/modules2tu=
ple

To simplify it, I create a new target:
gomod-deps: patch
=C2=A0=C2=A0=C2=A0 (cd ${WRKSRC} && go mod vendor)
=C2=A0=C2=A0=C2=A0 (cd ${WRKSRC} && modules2tuple vendor/modules.txt)

Just execute `make gomod-deps` and you should see the required
GH/GL_TUPLE lines.

For the GL_TUPLE lines I had to put in the full length for the commit
hash, as the short one does not work.
I'm not sure if this is a port problem or a gitlab limitation, a task
for later to look into it.

The last section of the TUPLE line must not contain the character `-` if
this is the case, replace it by a `_`.
I think the script from Dmitri is doing this already for the GH_TUPLE lin=
es.

Put the TUPLE lines into the Makefile, run `make makesum` and your port
should be prepare to be able to build.

If you need a full example, please have a look into devel/gitaly.

Have fun and thanks again to all that helped me!

=C2=A0=C2=A0=C2=A0

Gru=C3=9F
Matthias

--=20

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook



--nlbJrcVBW1wcRbBifGWCHJK62okrYeet8--

--QgrE7WfFmYksNbqRMArWjURLYOQZcLp9U
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJdJXYCAAoJELaLddyf10fhBaAP/iSfPPe68JRZxWq0G2uZy4GH
3kmx7WbbZjIqVCOSRZFTTU9zh9isZ7GrbywMjD0eF07tMbpx2+c0c1tchR4ptjA+
rzILUfe/XICPX/8KEKPbJlBSBracQm9JbYAp4ZY30AAlc+MAE2hP8TeTbP19mEDq
TD1bO4A0WlVRWwc4xxRl4dn0AvD5W4brY/2sHgXFtMv20fERaQWe6x7tK+CF0AL3
4iHV5DKEy3nZlQpyNaNnlihOZ12NS/4pPjGriJOS6DR29/VZiz9WK0N8F10DmbAL
u+5fnNquWxNO2KeUXqC0bH9nm0Y01ADZzMKmtNAevCzeA7mGYVhcat6nZ4SZ8frE
ucKlHPJ0E0sb+75QMVRxNSG26Vb86A9NU15jsX8UALNHVGhincQ3pXfXu51NwtFE
+pD43mPQe++hQQXb8FjCutrlST/6Z8ms5zlHlw3mbTxhNQkQ0DWJ0es9UFCZ74I1
fxaCS07/4c0fwpWUi23BH8aLHoQh4sGjmKN5EuCpiSQfg1hgiqNzYSWZBkD9i6sG
4KiG/eBWVp+5RwMxyWD6RQ7GuehFlUrKM+wPnj1p/nQo/q1hXXTu/9oMC0NtMgjs
LZ2TzJR5noKCv+CVRa5A1cpxEHWmRp4ViQ6f24lQ8eindgKamNxWNYelhjGG+5zS
542zHFmQe0/FWjsRudUT
=6HBW
-----END PGP SIGNATURE-----

--QgrE7WfFmYksNbqRMArWjURLYOQZcLp9U--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15e9b821-bf51-0eee-6000-3032bf4067d1>