Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Cc: sam@g.o, William Hubbs <williamh@g.o>
Subject: [gentoo-dev] [PATCH v4] go-module.eclass: deprecate EGO_SUM
Date: Sat, 05 Mar 2022 16:54:12
Message-Id: 20220305165138.11538-1-williamh@gentoo.org
1 EGO_SUM can be thousands of lines long in ebuilds, and it leads to
2 creating Manifest files that are thousands of lines long.
3 It has been determined that dependency tarballs are a better solution if
4 upstream doesn't vendor their dependencies.
5
6 Signed-off-by: William Hubbs <williamh@g.o>
7 ---
8 eclass/go-module.eclass | 46 ++++++++++++++++++++++++++++++-----------
9 1 file changed, 34 insertions(+), 12 deletions(-)
10
11 diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
12 index 635d2b5161a..427a61a1b84 100644
13 --- a/eclass/go-module.eclass
14 +++ b/eclass/go-module.eclass
15 @@ -25,8 +25,21 @@
16 #
17 # If the software has a directory named vendor in its
18 # top level directory, the only thing you need to do is inherit the
19 -# eclass. Otherwise, you need to also populate
20 -# EGO_SUM and call go-module_set_globals as discussed below.
21 +# eclass. If it doesn't, you need to also create a dependency tarball and
22 +# host it somewhere, for example in your dev space.
23 +#
24 +# Here is an example of how to create a dependency tarball.
25 +# The base directory in the GOMODCACHE setting must be go-mod in order
26 +# to match the settings in this eclass.
27 +#
28 +# @CODE
29 +#
30 +# $ cd /path/to/project
31 +# $ GOMODCACHE=/path/to/go-mod go mod download -modcacherw
32 +# $ tar -acf project-1.0-deps.tar.xz /path/to/go-mod \
33 +# --xform 's,.*go-mod/,go-mod/'
34 +#
35 +# @CODE
36 #
37 # Since Go programs are statically linked, it is important that your ebuild's
38 # LICENSE= setting includes the licenses of all statically linked
39 @@ -40,15 +53,9 @@
40 #
41 # inherit go-module
42 #
43 -# EGO_SUM=(
44 -# "github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod"
45 -# "github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59"
46 -# )
47 -#
48 -# go-module_set_globals
49 -#
50 -# SRC_URI="https://github.com/example/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
51 -# ${EGO_SUM_SRC_URI}"
52 +# SRC_URI="https://github.com/example/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
53 +# Add this line if you have a dependency tarball.
54 +# SRC_URI+=" ${P}-dep.tar.xz"
55 #
56 # @CODE
57
58 @@ -99,7 +106,11 @@ QA_FLAGS_IGNORED='.*'
59 RESTRICT+=" strip"
60
61 # @ECLASS-VARIABLE: EGO_SUM
62 +# @DEPRECATED:
63 # @DESCRIPTION:
64 +# This is replaced by a dependency tarball, see above for how to create
65 +# one.
66 +#
67 # This array is based on the contents of the go.sum file from the top
68 # level directory of the software you are packaging. Each entry must be
69 # quoted and contain the first two fields of a line from go.sum.
70 @@ -143,6 +154,7 @@ RESTRICT+=" strip"
71 # go.sum copy of the Hash1 values during building of the package.
72
73 # @ECLASS-VARIABLE: _GOMODULE_GOPROXY_BASEURI
74 +# @DEPRECATED:
75 # @DESCRIPTION:
76 # Golang module proxy service to fetch module files from. Note that the module
77 # proxy generally verifies modules via the Hash1 code.
78 @@ -165,6 +177,7 @@ RESTRICT+=" strip"
79 : "${_GOMODULE_GOPROXY_BASEURI:=mirror://goproxy/}"
80
81 # @ECLASS-VARIABLE: _GOMODULE_GOSUM_REVERSE_MAP
82 +# @DEPRECATED:
83 # @DESCRIPTION:
84 # Mapping back from Gentoo distfile name to upstream distfile path.
85 # Associative array to avoid O(N*M) performance when populating the GOPROXY
86 @@ -194,6 +207,7 @@ ego() {
87 }
88
89 # @FUNCTION: go-module_set_globals
90 +# @DEPRECATED:
91 # @DESCRIPTION:
92 # Convert the information in EGO_SUM for other usage in the ebuild.
93 # - Populates EGO_SUM_SRC_URI that can be added to SRC_URI
94 @@ -284,6 +298,7 @@ go-module_set_globals() {
95 }
96
97 # @FUNCTION: go-module_setup_proxy
98 +# @DEPRECATED:
99 # @DESCRIPTION:
100 # If your ebuild redefines src_unpack and uses EGO_SUM you need to call
101 # this function in src_unpack.
102 @@ -327,11 +342,14 @@ go-module_setup_proxy() {
103 # @FUNCTION: go-module_src_unpack
104 # @DESCRIPTION:
105 # If EGO_SUM is set, unpack the base tarball(s) and set up the
106 -# local go proxy.
107 +# local go proxy. Also warn that this usage is deprecated.
108 # - Otherwise, if EGO_VENDOR is set, bail out.
109 # - Otherwise do a normal unpack.
110 go-module_src_unpack() {
111 if [[ "${#EGO_SUM[@]}" -gt 0 ]]; then
112 + eqawarn "This ebuild uses EGO_SUM which is deprecated"
113 + eqawarn "Please migrate to a dependency tarball"
114 + eqawarn "This will become a fatal error in the future"
115 _go-module_src_unpack_gosum
116 elif [[ "${#EGO_VENDOR[@]}" -gt 0 ]]; then
117 eerror "${EBUILD} is using EGO_VENDOR which is no longer supported"
118 @@ -342,6 +360,7 @@ go-module_src_unpack() {
119 }
120
121 # @FUNCTION: _go-module_src_unpack_gosum
122 +# @DEPRECATED:
123 # @DESCRIPTION:
124 # Populate a GOPROXY directory hierarchy with distfiles from EGO_SUM and
125 # unpack the base distfiles.
126 @@ -387,6 +406,7 @@ _go-module_src_unpack_gosum() {
127 }
128
129 # @FUNCTION: _go-module_gosum_synthesize_files
130 +# @DEPRECATED:
131 # @DESCRIPTION:
132 # Given a path & version, populate all Goproxy metadata files which aren't
133 # needed to be downloaded directly.
134 @@ -414,6 +434,7 @@ _go-module_gosum_synthesize_files() {
135 }
136
137 # @FUNCTION: _go-module_src_unpack_verify_gosum
138 +# @DEPRECATED:
139 # @DESCRIPTION:
140 # Validate the Go modules declared by EGO_SUM are sufficient to cover building
141 # the package, without actually building it yet.
142 @@ -462,6 +483,7 @@ go-module_live_vendor() {
143 }
144
145 # @FUNCTION: _go-module_gomod_encode
146 +# @DEPRECATED:
147 # @DESCRIPTION:
148 # Encode the name(path) of a Golang module in the format expected by Goproxy.
149 #
150 --
151 2.34.1