Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo development <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] more golang updates
Date: Mon, 27 Jul 2015 20:30:01
Message-Id: 20150727202950.GA29626@linux1.gaikai.biz
In Reply to: [gentoo-dev] more golang updates by William Hubbs
1 On Thu, Jul 23, 2015 at 05:53:50PM -0500, William Hubbs wrote:
2 > All,
3 >
4 > Here is the improvement I mentioned in the earlier thread.
5 >
6 > golang-base.eclass contains the base functions that were in golang-build
7 > but can be used separately from either golang-vcs or golang-build.
8 >
9 > golang-vcs and golang-build are also being updated to inherit
10 > golang-base.
11 >
12 > Let me know what you think.
13 >
14 > William
15 >
16
17 All of this was committed just before the council meeting today.
18
19 Thanks,
20
21 William
22
23 > # Copyright 1999-2015 Gentoo Foundation
24 > # Distributed under the terms of the GNU General Public License v2
25 > # $Header: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v 1.4 2015/07/06 16:48:21 williamh Exp $
26 >
27 > # @ECLASS: golang-build.eclass
28 > # @MAINTAINER:
29 > # William Hubbs <williamh@g.o>
30 > # @BLURB: Eclass that provides base functions for Go packages.
31 > # @DESCRIPTION:
32 > # This eclass provides base functions for software written in the Go
33 > # programming language; it also provides the build-time dependency on
34 > # dev-lang/go.
35 >
36 > case "${EAPI:-0}" in
37 > 5)
38 > ;;
39 > *)
40 > die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})"
41 > ;;
42 > esac
43 >
44 > if [[ -z ${_GOLANG_BASE} ]]; then
45 >
46 > _GOLANG_BASE=1
47 >
48 > DEPEND=">=dev-lang/go-1.4.2:="
49 > STRIP_MASK="*.a"
50 >
51 > # @ECLASS-VARIABLE: EGO_PN
52 > # @REQUIRED
53 > # @DESCRIPTION:
54 > # This is the import path for the go package to build. Please emerge
55 > # dev-lang/go and read "go help importpath" for syntax.
56 > #
57 > # Example:
58 > # @CODE
59 > # EGO_PN=github.com/user/package
60 > # @CODE
61 >
62 > # @FUNCTION: ego_pn_check
63 > # @DESCRIPTION:
64 > # Make sure EGO_PN has a value.
65 > ego_pn_check() {
66 > [[ -z "${EGO_PN}" ]] &&
67 > die "${ECLASS}.eclass: EGO_PN is not set"
68 > return 0
69 > }
70 >
71 > # @FUNCTION: get_golibdir
72 > # @DESCRIPTION:
73 > # Return the non-prefixed library directory where Go packages
74 > # should be installed
75 > get_golibdir() {
76 > echo /usr/lib/go-gentoo
77 > }
78 >
79 > # @FUNCTION: get_golibdir_gopath
80 > # @DESCRIPTION:
81 > # Return the library directory where Go packages should be installed
82 > # This is the prefixed version which should be included in GOPATH
83 > get_golibdir_gopath() {
84 > echo "${EPREFIX}$(get_golibdir)"
85 > }
86 >
87 > # @FUNCTION: golang_install_pkgs
88 > # @DESCRIPTION:
89 > # Install Go packages.
90 > # This function assumes that $cwd is a Go workspace.
91 > golang_install_pkgs() {
92 > debug-print-function ${FUNCNAME} "$@"
93 >
94 > ego_pn_check
95 > insinto "$(get_golibdir)"
96 > insopts -m0644 -p # preserve timestamps for bug 551486
97 > doins -r pkg src
98 > }
99 >
100 > fi
101
102 > Index: golang-build.eclass
103 > ===================================================================
104 > RCS file: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v
105 > retrieving revision 1.5
106 > diff -u -B -r1.5 golang-build.eclass
107 > --- golang-build.eclass 23 Jul 2015 15:42:26 -0000 1.5
108 > +++ golang-build.eclass 23 Jul 2015 22:41:13 -0000
109 > @@ -10,6 +10,8 @@
110 > # This eclass provides default src_compile, src_test and src_install
111 > # functions for software written in the Go programming language.
112 >
113 > +inherit golang-base
114 > +
115 > case "${EAPI:-0}" in
116 > 5)
117 > ;;
118 > @@ -24,9 +26,6 @@
119 >
120 > _GOLANG_BUILD=1
121 >
122 > -DEPEND=">=dev-lang/go-1.4.2:="
123 > -STRIP_MASK="*.a"
124 > -
125 > # @ECLASS-VARIABLE: EGO_PN
126 > # @REQUIRED
127 > # @DESCRIPTION:
128 > @@ -38,49 +37,10 @@
129 > # EGO_PN=github.com/user/package
130 > # @CODE
131 >
132 > -# @FUNCTION: _golang-build_setup
133 > -# @INTERNAL
134 > -# @DESCRIPTION:
135 > -# Make sure EGO_PN has a value.
136 > -_golang-build_setup() {
137 > - [[ -z "${EGO_PN}" ]] &&
138 > - die "${ECLASS}.eclass: EGO_PN is not set"
139 > - return 0
140 > -}
141 > -
142 > -# @FUNCTION: get_golibdir
143 > -# @DESCRIPTION:
144 > -# Return the non-prefixed library directory where Go packages
145 > -# should be installed
146 > -get_golibdir() {
147 > - echo /usr/lib/go-gentoo
148 > -}
149 > -
150 > -# @FUNCTION: get_golibdir
151 > -# @DESCRIPTION:
152 > -# Return the library directory where Go packages should be installed
153 > -# This is the prefixed version which should be included in GOPATH
154 > -get_golibdir_gopath() {
155 > - echo "${EPREFIX}$(get_golibdir)"
156 > -}
157 > -
158 > -# @FUNCTION: golang_install_pkgs
159 > -# @DESCRIPTION:
160 > -# Install Go packages.
161 > -# This function assumes that $cwd is a Go workspace.
162 > -golang_install_pkgs() {
163 > - debug-print-function ${FUNCNAME} "$@"
164 > -
165 > - _golang-build_setup
166 > - insinto "$(get_golibdir)"
167 > - insopts -m0644 -p # preserve timestamps for bug 551486
168 > - doins -r pkg src
169 > -}
170 > -
171 > golang-build_src_compile() {
172 > debug-print-function ${FUNCNAME} "$@"
173 >
174 > - _golang-build_setup
175 > + ego_pn_check
176 > set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
177 > go build -v -work -x "${EGO_PN}"
178 > echo "$@"
179 > @@ -90,7 +50,7 @@
180 > golang-build_src_install() {
181 > debug-print-function ${FUNCNAME} "$@"
182 >
183 > - _golang-build_setup
184 > + ego_pn_check
185 > set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
186 > go install -v -work -x "${EGO_PN}"
187 > echo "$@"
188 > @@ -101,7 +61,7 @@
189 > golang-build_src_test() {
190 > debug-print-function ${FUNCNAME} "$@"
191 >
192 > - _golang-build_setup
193 > + ego_pn_check
194 > set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
195 > go test -v -work -x "${EGO_PN}"
196 > echo "$@"
197
198 > Index: golang-vcs.eclass
199 > ===================================================================
200 > RCS file: /var/cvsroot/gentoo-x86/eclass/golang-vcs.eclass,v
201 > retrieving revision 1.3
202 > diff -u -B -r1.3 golang-vcs.eclass
203 > --- golang-vcs.eclass 23 Jun 2015 18:59:43 -0000 1.3
204 > +++ golang-vcs.eclass 23 Jul 2015 22:41:34 -0000
205 > @@ -10,7 +10,7 @@
206 > # This eclass is written to ease the maintenance of live ebuilds
207 > # of software written in the Go programming language.
208 >
209 > -inherit eutils
210 > +inherit eutils golang-base
211 >
212 > case "${EAPI:-0}" in
213 > 5)
214 > @@ -26,8 +26,6 @@
215 >
216 > _GOLANG_VCS=1
217 >
218 > -DEPEND=">=dev-lang/go-1.4.2"
219 > -
220 > # @ECLASS-VARIABLE: EGO_PN
221 > # @REQUIRED
222 > # @DESCRIPTION:
223 > @@ -114,8 +112,7 @@
224 > _golang-vcs_fetch() {
225 > debug-print-function ${FUNCNAME} "$@"
226 >
227 > - [[ -z ${EGO_PN} ]] &&
228 > - die "${ECLASS}: EGO_PN is not set"
229 > + ego_pn_check
230 >
231 > if [[ -z ${EVCS_OFFLINE} ]]; then
232 > [[ -n ${EVCS_UMASK} ]] && eumask_push ${EVCS_UMASK}

Attachments

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