Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v2 2/4] dev-go/go-tour: convert to go-module go.sum
Date: Wed, 19 Feb 2020 06:00:29
Message-Id: 20200219060021.GB18470@linux1.home
In Reply to: [gentoo-dev] [PATCH v2 2/4] dev-go/go-tour: convert to go-module go.sum by "Robin H. Johnson"
1 This ebuild isn't fully convirted, so it probably isn't the best
2 example.
3
4 My comments are just a couple of aspects of it.
5
6
7 On Mon, Feb 17, 2020 at 01:22:30AM -0800, Robin H. Johnson wrote:
8 > Signed-off-by: Robin H. Johnson <robbat2@g.o>
9 > ---
10 > dev-go/go-tour/Manifest | 7 ++
11 > dev-go/go-tour/go-tour-0_p20190829-r2.ebuild | 68 ++++++++++++++++++++
12 > 2 files changed, 75 insertions(+)
13 > create mode 100644 dev-go/go-tour/go-tour-0_p20190829-r2.ebuild
14 >
15 > diff --git dev-go/go-tour/Manifest dev-go/go-tour/Manifest
16 > index 4790cfab02c5..89515578048c 100644
17 > --- dev-go/go-tour/Manifest
18 > +++ dev-go/go-tour/Manifest
19 > @@ -1,3 +1,10 @@
20 > DIST github.com-golang-net-3b0461eec859c4b73bb64fdc8285971fd33e3938.tar.gz 1099680 BLAKE2B 989a8d6c9166696bef1aff398acc8cd1e41e1240c5c113be030c80355cdf96eaa6d5f231c99f2c44d8eacf199579804c59fc45f999862bc4bf057b694841c8dc SHA512 5e42e26ac17f52d6408b63eebd740bedc5a78b8023b675688d7b39b20afa53b34ffde764b693828143483c8f5450180f6a00e9eb28b8f3f6e14303cc4cd7c62b
21 > DIST github.com-golang-tools-7b79afddac434519a8ca775cc575fddb0d162aab.tar.gz 2682003 BLAKE2B 60d9981b9fcc47077bc0dc1179e518ba2f2373595d5798eb6aa37a832ce72f475b0808b2030919f141cd978533792294fdd8528e1d52b4eeec6e9f1a3b6e772d SHA512 5b7af03d138567edaa70e1b3555b8a9c4822f33c3fb14e8ec435499d21f46d61f44b62fddcec3ecc6f75d4e9a6dfb6b2a7526ddf8785d933941d64e646dc1b9b
22 > DIST go-tour-0_p20190829.tar.gz 321179 BLAKE2B 56fad2c3608aec9653e31a59e8696aa445375de88f17e72a95620b4b375c88b8e45838360c09a1c53184e5a20c1a5ca044f6ad055de3736e675d3faf3fd52a91 SHA512 2701234788810a8fdb932faae666ec89796664e078b3170344b8c219a2247a510df66bff825bdc458ba062bd4b3f5dccd07dbf88a092053b1ea791c2f50248f4
23 > +DIST golang.org%2Fx%2Fcrypto%2F@v%2Fv0.0.0-20190308221718-c2843e01d9a2.mod 88 BLAKE2B aec7d0eea1278eb3d1568d5bfb4041267501ad14457ebfcbdbc5fe21473170b8616ca4028f52af2edbfd85922cbe04540b4b0df7f69f63197698143cc5557a7a SHA512 2df49895053b36fed7ea905aa73f86568fbafd79ff0a7976679d8c77cf15025129435d9dbfd89367b611b1aadbea4f4bd1835eb4efa9ea702466e443638d379e
24 > +DIST golang.org%2Fx%2Fnet%2F@v%2Fv0.0.0-20190311183353-d8887717615a.mod 119 BLAKE2B e042b2716739483252c3340451b2c3c7b421fdf8d6b3e0333e979802fca66159596982ea63a24b6a64457b2757a0ad24cbb9ea032bab4c5377edf84a3ea18b97 SHA512 26b6c92eecd2208967336d4d23f8a71f77f9a73643ad1e5cd84dee36b2f626fffc806e4dd33acc284831a0961e2b363d898a747903235945fbfb665c5b4d5ef2
25 > +DIST golang.org%2Fx%2Fnet%2F@v%2Fv0.0.0-20190311183353-d8887717615a.zip 1273340 BLAKE2B 7d42472afb905448b6ae6f66258dc805fa7c4b9c8dffb230ad6458b250fe5d564a3f6e2bf97b241ac9293c9f5885f28cc996ab7953a0ba9e97b8731911b982d5 SHA512 57852d3cd066a9eb279f909b464824041e138db1eb98c66ffbbc81259cb3f94da8ecd4d2b961646fbbe0c05156785ab2f44408b19d9f467001627d7b12fed4af
26 > +DIST golang.org%2Fx%2Fsys%2F@v%2Fv0.0.0-20190215142949-d0b11bdaac8a.mod 24 BLAKE2B 64a70c4594f5d3c37d962c1ed07630fba8abeaf534242f8f1509af271684499252af9a2320d5bac8e44064dba344b807535e4e9dd085fc0fb47bd9304120601a SHA512 ffe50fccf7f1d200f2ebc805b190e3f10c5a3184458a38f4590e520d7ce115e1520fbabe56651bbdc2e08da4a8db5ac86d0e88728efde3ab26c64ab4e0cd604c
27 > +DIST golang.org%2Fx%2Ftext%2F@v%2Fv0.3.0.mod 25 BLAKE2B 31009af0fdcd0f8730c9985287e6e364ec4e5183e57e92560dbc80a2010eced51b8a90f01a82b49384268c8a0adbf69d179c205d3f68e0eb459169d2ea9528f0 SHA512 ca081ef7cccd7bbedc6843fbe0c452352661a07e1298cd02ff338ed79d807c6401d613a3cf20011189d2f98a794ffa410547b3e352eb58a6f0a84822285d391d
28 > +DIST golang.org%2Fx%2Ftools%2F@v%2Fv0.0.0-20190312164927-7b79afddac43.mod 87 BLAKE2B 32cb406deea05323b1121386bf61f344f8eda0b5370e95bb73828ce0bea50bee375ae3e9b076b9d683a4d89561709c5e97e45e6b08344fbdf6b03b3ce4398dcd SHA512 18ae9b2f54109b4ec5cdea433ee0e3b7006e4d5ea57022d6e8151d4d364735a6b55cf7b5eb2f43b602ec786b2b6819ad78dfc33151ee1a63a0b1199f54ce34a1
29 > +DIST golang.org%2Fx%2Ftools%2F@v%2Fv0.0.0-20190312164927-7b79afddac43.zip 3200356 BLAKE2B 8ebbd9b772d54bfa39de2319a583c5d80cf6580456a4da5043a5b9a49450c3dcc5eba68ac7726dd7771c0855032294b2ee6a9df738780e87c312935fbc94e5a8 SHA512 5e56ee0659802472d5187c0fe65c6e2b93478cf968b95c2c79db3d458844c38b18a597ad032cfe3a712a5516215d6010f1efcf36db2aa2bb2d29bf337819969d
30 > diff --git dev-go/go-tour/go-tour-0_p20190829-r2.ebuild dev-go/go-tour/go-tour-0_p20190829-r2.ebuild
31 > new file mode 100644
32 > index 000000000000..256553da8002
33 > --- /dev/null
34 > +++ dev-go/go-tour/go-tour-0_p20190829-r2.ebuild
35 > @@ -0,0 +1,68 @@
36 > +# Copyright 1999-2019 Gentoo Authors
37 > +# Distributed under the terms of the GNU General Public License v2
38 > +
39 > +EAPI=7
40 > +MY_PN=tour
41 > +EGO_PN="golang.org/x/${MY_PN}"
42 +
43 You shouldn't need EGO_PN or MY_PN any longer.
44
45 > +EGO_SUM=(
46 > + # Minimal covering set
47 > + "golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod"
48 > + "golang.org/x/net v0.0.0-20190311183353-d8887717615a license:BSD"
49 > + "golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod"
50 > + "golang.org/x/text v0.3.0/go.mod"
51 > + "golang.org/x/tools v0.0.0-20190312164927-7b79afddac43 license:BSD"
52 > +)
53 > +
54 > +MY_P=${MY_PN}-${PV}
55
56 You shouldn't need MY_P.
57
58 > +EGIT_COMMIT="3c9f1af8b2da3b3661a39ee550190917c0cf5208"
59
60 You don't need to quote this.
61
62 > +ARCHIVE_URI="https://github.com/golang/tour/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
63
64 You don't need ARCHIVE_URI
65
66 > +SRC_URI="${ARCHIVE_URI}"
67 > +KEYWORDS="~amd64"
68 > +DESCRIPTION="A Tour of Go"
69 > +HOMEPAGE="https://tour.golang.org"
70 > +LICENSE="BSD Apache-2.0 MIT"
71 > +SLOT="0"
72 > +IUSE=""
73 > +S=${WORKDIR}/${P}/src/${EGO_PN}
74 > +UPSTREAM_S=${WORKDIR}/${MY_PN}-${EGIT_COMMIT}
75
76 You shouldn't need either UPSTREAM_S or the new S setting.
77
78 > +GO_MODULE_GOSUM_PATH="${S}/go.sum"
79 > +
80 > +inherit golang-build go-module
81
82 do not inherit these together. you only need go-module
83
84 > +go-module_set_globals
85 > +SRC_URI+=" ${EGO_SUM_SRC_URI}"
86 > +LICENSE+=" ${EGO_SUM_LICENSES}"
87 > +
88 > +src_unpack() {
89 > + unpack "${P}.tar.gz"
90 > + mkdir -p "$(dirname "${S}")"
91 > + mv "${UPSTREAM_S}" "${S}"
92 > + go-module_src_unpack
93 > +}
94 > +
95 > +src_compile() {
96 > + # Create a temporary GOROOT, since otherwise the executable is not
97 > + # built if it happens to be installed already.
98 > + cp -rs "$(go env GOROOT)" "${T}/goroot" || die
99 > + rm -rf "${T}/goroot/"{pkg/tool/$(go env GOOS)_$(go env GOARCH)/tour,src/${EGO_PN}} || die
100 > + export -n GOCACHE XDG_CACHE_HOME #567192
101
102 You shouldn't need this line or the first two exports below.
103
104 > + export GOPATH="${WORKDIR}/${P}" \
105 > + GO111MODULE=on \
106 > + GOFLAGS="-v -x" \
107 > + GOBIN="${WORKDIR}/${P}/bin"
108 > + GOROOT=${T}/goroot \
109 > + go install -work ${EGO_BUILD_FLAGS} "${EGO_PN}/..." || die
110 > +}
111 > +
112 > +src_install() {
113 > + exeinto "$(go env GOTOOLDIR)"
114 > + doexe "${GOBIN}/tour"
115 > +
116 > + rm -rf vendor || die
117 > + insinto "$(go env GOROOT)"
118 > + doins -r "${WORKDIR}/${P}/src"
119 > +}
120 > +
121 > +src_test() {
122 > + go test -work "${EGO_PN}/..." || die
123 > +}
124 > --
125 > 2.25.0
126 >
127 >

Attachments

File name MIME type
signature.asc application/pgp-signature