Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] new eclass: go-live.eclass for handling go live ebuilds
Date: Fri, 05 Jun 2015 14:34:54
Message-Id: 20150605143442.GA20852@linux1
In Reply to: Re: [gentoo-dev] new eclass: go-live.eclass for handling go live ebuilds by Mike Frysinger
1 On Fri, Jun 05, 2015 at 12:54:45AM -0400, Mike Frysinger wrote:
2 > On 04 Jun 2015 14:10, William Hubbs wrote:
3 > > # @ECLASS: go-live.eclass
4 >
5 > since we're going to have a common go eclass, and i don't think we'll want to
6 > call it "go.eclass", this too probably should not be go-xxx. if we assume the
7 > base one will be "golang.eclass", then this should be golang-xxx.eclass. i'd
8 > prefer golang-vcs.eclass myself as that's the naming we've been moving towards.
9
10 I'm not convinced yet that we are going to have a base eclass for all
11 go ebuilds, but I can rename this one easily enough to
12 golang-vcs.eclass.
13
14 > > # @MAINTAINER:
15 > > # William Hubbs <williamh@g.o>
16 > > # @BLURB: Eclass for fetching and unpacking go repositories.
17 > > # @DESCRIPTION:
18 > > # This eclass is written to ease the maintenance of live ebuilds
19 > > # of software written in the Go programming language.
20 >
21 > this should note the ebuild is responsible for depending on the right vcs
22 > packages. e.g. if you use git, then you need to depend on git.
23
24 Since "go get" fetches $EGO_PN and its dependencies, there is no way an
25 ebuild author could get this right without reading all of the import
26 statements in the source for their package and all of its dependencies.
27 I don't really want to ask ebuild authors to keep up with all of that.
28
29 > although ...
30 >
31 > > # @ECLASS-VARIABLE: EGO_PN
32 > > # @REQUIRED
33 > > # @DESCRIPTION:
34 > > # This is the import path for the go package. Please emerge dev-lang/go
35 > > # and read "go help importpath" for syntax.
36 > > #
37 > > # Example:
38 > > # @CODE
39 > > # EGO_PN="github.com/user/project"
40 > > # @CODE
41 >
42 > can't we automate some of the common hosts ? if it says github, we know it's
43 > going to be using at least git.
44
45 I'm seeing two options. I can either let users emerge the vcs's they
46 need if something breaks or pull in all vcs's go supports.
47
48 Which way is best?
49
50 ...
51
52 > > if [[ ${EVCS_OFFLINE} ]]; then
53 > > export GOPATH="${S}:${GOPATH}"
54 >
55 > what if GOPATH isn't set ? should this always be appending a colon ?
56
57 I thought it would always be set at this point because it was initially
58 set to ${EGO_STORE_DIR} in the env_setup function. What I can do, if it
59 makes things more clear, is to replace the value of GOPATH instead of
60 prepending it.
61
62 ...
63
64 > > go get -d -t -u -v -x "$EGO_PN"
65 >
66 > needs braces around ${EGO_PN}, and shouldn't this be calling `die` ?
67 >
68 > would also be useful to show the command you're running:
69 > set -- go get -d -t -u -v -x "${EGO_PN}"
70 > echo "$@"
71 > "$@" || die
72
73 You are correct; we should be calling die here. However, I suspect an
74 upstream bug because the following returns an error:
75
76 $ cd /home/william/go
77 $ export GOPATH=/home/william/go
78 $ go get -d -t -u -v -x golang.org/x/tools
79
80 go downloads everything, then errors out with a message about "no
81 buildable source files in /home/william/go/src/golang.org/x/tools"
82
83 This isn't an error because you build the tools from the subdirectories
84 of the project.
85
86 ...
87
88 > > export GOPATH="${S}:${GOPATH}"
89 >
90 > same questions here
91
92 See my comment above about GOPATH; the same thing applies here.
93
94 The eclass with your changes is attached.
95
96 William

Attachments

File name MIME type
golang-vcs.eclass text/plain
signature.asc application/pgp-signature

Replies