Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Cc: William Hubbs <williamh@g.o>
Subject: [gentoo-dev] [PATCH 1/1] eclass/go-module.eclass: remove EGO_VENDOR support
Date: Sun, 10 May 2020 21:18:01
Message-Id: 20200510211645.19097-2-williamh@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/1] remove EGO_VENDOR support from go-module.eclass by William Hubbs
1 Signed-off-by: William Hubbs <williamh@g.o>
2 ---
3 eclass/go-module.eclass | 81 +++--------------------------------------
4 1 file changed, 6 insertions(+), 75 deletions(-)
5
6 diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
7 index 17d37494f15..7b66c3e2b1e 100644
8 --- a/eclass/go-module.eclass
9 +++ b/eclass/go-module.eclass
10 @@ -120,29 +120,6 @@ EXPORT_FUNCTIONS src_unpack pkg_postinst
11 # This decision does NOT weaken Go module security, as Go will verify the
12 # go.sum copy of the Hash1 values during building of the package.
13
14 -# @ECLASS-VARIABLE: EGO_VENDOR
15 -# @DESCRIPTION:
16 -# This variable is deprecated and should no longer be used. Please
17 -# convert your ebuilds to use EGO_SUM.
18 -
19 -# @FUNCTION: go-module_vendor_uris
20 -# @DESCRIPTION:
21 -# This function is deprecated.
22 -go-module_vendor_uris() {
23 - local hash import line repo x
24 - for line in "${EGO_VENDOR[@]}"; do
25 - read -r import hash repo x <<< "${line}"
26 - if [[ -n ${x} ]]; then
27 - eerror "Trailing information in EGO_VENDOR in ${P}.ebuild"
28 - eerror "${line}"
29 - eerror "Trailing information is: \"${x}\""
30 - die "Invalid EGO_VENDOR format"
31 - fi
32 - : "${repo:=${import}}"
33 - echo "https://${repo}/archive/${hash}.tar.gz -> ${repo//\//-}-${hash}.tar.gz"
34 - done
35 -}
36 -
37 # @ECLASS-VARIABLE: _GOMODULE_GOPROXY_BASEURI
38 # @DESCRIPTION:
39 # Golang module proxy service to fetch module files from. Note that the module
40 @@ -261,17 +238,16 @@ go-module_set_globals() {
41
42 # @FUNCTION: go-module_src_unpack
43 # @DESCRIPTION:
44 -# - If EGO_VENDOR is set, use the deprecated function to unpack the base
45 -# tarballs and the tarballs indicated in EGO_VENDOR to the correct
46 -# locations.
47 -# - Otherwise, if EGO_SUM is set, unpack the base tarball(s) and set up the
48 +# If EGO_SUM is set, unpack the base tarball(s) and set up the
49 # local go proxy.
50 +# - Otherwise, if EGO_VENDOR is set, bail out.
51 # - Otherwise do a normal unpack.
52 go-module_src_unpack() {
53 - if [[ "${#EGO_VENDOR[@]}" -gt 0 ]]; then
54 - _go-module_src_unpack_vendor
55 - elif [[ "${#EGO_SUM[@]}" -gt 0 ]]; then
56 + if [[ "${#EGO_SUM[@]}" -gt 0 ]]; then
57 _go-module_src_unpack_gosum
58 + elif [[ "${#EGO_VENDOR[@]}" -gt 0 ]]; then
59 + eerror "${EBUILD} is using EGO_VENDOR which is no longer supported"
60 + die "Please update this ebuild"
61 else
62 default
63 fi
64 @@ -350,51 +326,6 @@ _go-module_gosum_synthesize_files() {
65 fi
66 }
67
68 -# @FUNCTION: _go-module_src_unpack_vendor
69 -# @DESCRIPTION:
70 -# Extract all archives in ${a} which are not nentioned in ${EGO_VENDOR}
71 -# to their usual locations then extract all archives mentioned in
72 -# ${EGO_VENDOR} to ${S}/vendor.
73 -_go-module_src_unpack_vendor() {
74 - # shellcheck disable=SC2120
75 - debug-print-function "${FUNCNAME}" "$@"
76 - local f hash import line repo tarball vendor_tarballs x
77 - vendor_tarballs=()
78 - for line in "${EGO_VENDOR[@]}"; do
79 - read -r import hash repo x <<< "${line}"
80 - if [[ -n ${x} ]]; then
81 - eerror "Trailing information in EGO_VENDOR in ${P}.ebuild"
82 - eerror "${line}"
83 - die "Invalid EGO_VENDOR format"
84 - fi
85 - : "${repo:=${import}}"
86 - vendor_tarballs+=("${repo//\//-}-${hash}.tar.gz")
87 - done
88 - for f in ${A}; do
89 - [[ -n ${vendor_tarballs[*]} ]] && has "${f}" "${vendor_tarballs[@]}" &&
90 - continue
91 - unpack "${f}"
92 - done
93 -
94 - [[ -z ${vendor_tarballs[*]} ]] && return
95 - for line in "${EGO_VENDOR[@]}"; do
96 - read -r import hash repo _ <<< "${line}"
97 - : "${repo:=${import}}"
98 - tarball=${repo//\//-}-${hash}.tar.gz
99 - ebegin "Vendoring ${import} ${tarball}"
100 - rm -fr "${S}/vendor/${import}" || die
101 - mkdir -p "${S}/vendor/${import}" || die
102 - tar -C "${S}/vendor/${import}" -x --strip-components 1 \
103 - -f "${DISTDIR}/${tarball}" || die
104 - eend
105 - done
106 - # replace GOFLAGS if EGO_VENDOR is being used
107 - [[ ${#EGO_VENDOR[@]} -gt 0 ]] &&
108 - GOFLAGS="-v -x -mod=vendor"
109 - eqawarn "${P}.ebuild: EGO_VENDOR will be removed in the future."
110 - eqawarn "Please request that the author migrate to EGO_SUM."
111 -}
112 -
113 # @FUNCTION: _go-module_src_unpack_verify_gosum
114 # @DESCRIPTION:
115 # Validate the Go modules declared by EGO_SUM are sufficient to cover building
116 --
117 2.26.2