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

Replies