Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo development <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] new eclass: go-live.eclass for handling go live ebuilds
Date: Fri, 05 Jun 2015 04:54:55
Message-Id: 20150605045445.GC26696@vapier
In Reply to: [gentoo-dev] new eclass: go-live.eclass for handling go live ebuilds by William Hubbs
1 On 04 Jun 2015 14:10, William Hubbs wrote:
2 > # @ECLASS: go-live.eclass
3
4 since we're going to have a common go eclass, and i don't think we'll want to
5 call it "go.eclass", this too probably should not be go-xxx. if we assume the
6 base one will be "golang.eclass", then this should be golang-xxx.eclass. i'd
7 prefer golang-vcs.eclass myself as that's the naming we've been moving towards.
8
9 > # @MAINTAINER:
10 > # William Hubbs <williamh@g.o>
11 > # @BLURB: Eclass for fetching and unpacking go repositories.
12 > # @DESCRIPTION:
13 > # This eclass is written to ease the maintenance of live ebuilds
14 > # of software written in the Go programming language.
15
16 this should note the ebuild is responsible for depending on the right vcs
17 packages. e.g. if you use git, then you need to depend on git.
18
19 although ...
20
21 > # @ECLASS-VARIABLE: EGO_PN
22 > # @REQUIRED
23 > # @DESCRIPTION:
24 > # This is the import path for the go package. Please emerge dev-lang/go
25 > # and read "go help importpath" for syntax.
26 > #
27 > # Example:
28 > # @CODE
29 > # EGO_PN="github.com/user/project"
30 > # @CODE
31
32 can't we automate some of the common hosts ? if it says github, we know it's
33 going to be using at least git.
34
35 > local saved_umask
36 > if [[ ${EVCS_UMASK} ]]; then
37 > saved_umask=$(umask)
38 > umask "${EVCS_UMASK}" ||
39 > die "${ECLASS}: bad options to umask: ${EVCS_UMASK}"
40 > fi
41
42 use `eumask_push` instead
43
44 on a related note, i don't think we should encourage the implicit -n operator.
45 it adds no overhead and really no code maintenance to specify it. conversely,
46 i'm not sure it can be considered common usage. and even if it is, i still
47 don't see a good reason to not just use the explicit -n as it's clear to the
48 reader what it's doing.
49
50 > if [[ ! -d ${EGO_STORE_DIR} ]]; then
51 > (
52 > addwrite /
53 > mkdir -p "${EGO_STORE_DIR}" || die
54 > ) || die "${ECLASS}: unable to create ${EGO_STORE_DIR}"
55 > fi
56
57 the inner die is redundant
58
59 > if [[ ${saved_umask} ]]; then
60 > umask "${saved_umask}" ||
61 > die "${ECLASS}: unable to restore saved umask"
62 > fi
63
64 use `eumask_pop` instead
65
66 > [[ ${EGO_PN} ]] ||
67 > die "${ECLASS}: EGO_PN is not set"
68
69 prefer -z && myself
70 [[ -z ${EGO_PN} ]] && die ...
71
72 > if [[ ${EVCS_OFFLINE} ]]; then
73 > export GOPATH="${S}:${GOPATH}"
74
75 what if GOPATH isn't set ? should this always be appending a colon ?
76
77 > local saved_umask
78 > if [[ ${EVCS_UMASK} ]]; then
79 > saved_umask=$(umask)
80 > umask "${EVCS_UMASK}" ||
81 > die "${ECLASS}: Bad options to umask: ${EVCS_UMASK}"
82 > fi
83
84 use `eumask_push` instead
85
86 > go get -d -t -u -v -x "$EGO_PN"
87
88 needs braces around ${EGO_PN}, and shouldn't this be calling `die` ?
89
90 would also be useful to show the command you're running:
91 set -- go get -d -t -u -v -x "${EGO_PN}"
92 echo "$@"
93 "$@" || die
94
95 > if [[ ${saved_umask} ]]; then
96 > umask "${saved_umask}" ||
97 > die "${ECLASS}: unable to restore saved umask"
98 > fi
99
100 use `eumask_pop` instead
101
102 > export GOPATH="${S}:${GOPATH}"
103
104 same questions here
105 -mike

Attachments

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

Replies