1 |
Sorry for replying to the commit but it's different than last full |
2 |
snippet on the list, so easier to review here. |
3 |
|
4 |
Dnia 2015-06-24, o godz. 15:38:34 |
5 |
"William Hubbs (williamh)" <williamh@g.o> napisał(a): |
6 |
|
7 |
> Index: golang-build.eclass |
8 |
> =================================================================== |
9 |
> # Copyright 1999-2015 Gentoo Foundation |
10 |
> # Distributed under the terms of the GNU General Public License v2 |
11 |
> # $Header: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v 1.1 2015/06/24 15:38:33 williamh Exp $ |
12 |
> |
13 |
> # @ECLASS: golang-build.eclass |
14 |
> # @MAINTAINER: |
15 |
> # William Hubbs <williamh@g.o> |
16 |
> # @BLURB: Eclass for compiling go packages. |
17 |
> # @DESCRIPTION: |
18 |
> # This eclass provides default src_compile, src_test and src_install |
19 |
> # functions for software written in the Go programming language. |
20 |
> |
21 |
> case "${EAPI:-0}" in |
22 |
> 5) |
23 |
> ;; |
24 |
> *) |
25 |
> die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})" |
26 |
> ;; |
27 |
> esac |
28 |
> |
29 |
> EXPORT_FUNCTIONS src_compile src_install src_test |
30 |
> |
31 |
> if [[ -z ${_GOLANG_BUILD} ]]; then |
32 |
> |
33 |
> _GOLANG_BUILD=1 |
34 |
> |
35 |
> DEPEND=">=dev-lang/go-1.4.2:=" |
36 |
> STRIP_MASK="*.a" |
37 |
> |
38 |
> # @ECLASS-VARIABLE: EGO_PN |
39 |
> # @REQUIRED |
40 |
> # @DESCRIPTION: |
41 |
> # This is the import path for the go package(s) to build. Please emerge |
42 |
> # dev-lang/go and read "go help importpath" for syntax. |
43 |
> # |
44 |
> # Example: |
45 |
> # @CODE |
46 |
> # EGO_PN=github.com/user/package |
47 |
> # @CODE |
48 |
> |
49 |
> # @FUNCTION: _golang-build_setup |
50 |
> # @INTERNAL |
51 |
> # @DESCRIPTION: |
52 |
> # Make sure EGO_PN has a value. |
53 |
> _golang-build_setup() { |
54 |
> [ -z "${EGO_PN}" ] && |
55 |
|
56 |
Please don't use 'unsafe' single brackets. Use bash's double brackets, |
57 |
i.e. [[ -z ${EGO_PN} ]]. |
58 |
|
59 |
> die "${ECLASS}.eclass: EGO_PN is not set" |
60 |
> return 0 |
61 |
> } |
62 |
> |
63 |
> golang-build_src_compile() { |
64 |
> debug-print-function ${FUNCNAME} "$@" |
65 |
> |
66 |
> _golang-build_setup |
67 |
> set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \ |
68 |
> go build -v -work -x "${EGO_PN}" |
69 |
> echo "$@" |
70 |
|
71 |
I suggest to push this to stderr, >&2. |
72 |
|
73 |
> "$@" || die |
74 |
|
75 |
And anyway, this looks to have a common, repeating part that sounds |
76 |
like a good candidate for separate emake-like function... ego? :D |
77 |
|
78 |
-- |
79 |
Best regards, |
80 |
Michał Górny |
81 |
<http://dev.gentoo.org/~mgorny/> |