Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] new eclass: golang.eclass for compiling go packages
Date: Wed, 17 Jun 2015 00:18:23
Message-Id: 20150617001810.GA29883@linux1.gaikai.biz
In Reply to: Re: [gentoo-dev] new eclass: golang.eclass for compiling go packages by Zac Medico
1 On Thu, Jun 11, 2015 at 04:39:05PM -0700, Zac Medico wrote:
2 > On 06/11/2015 11:43 AM, William Hubbs wrote:
3 > > On Thu, Jun 11, 2015 at 08:58:37AM -0700, Andrew Udvare wrote:
4 > >>
5 > >>> On 2015-06-11, at 08:38, William Hubbs <williamh@g.o> wrote:
6 > >>>
7 > >>> this eclass is meant to provide a common src_compile function for
8 > >>> packages written in the Go programming language.
9 > >>>
10 > >>> Let me know what you think.
11 > >>>
12 > >>
13 > >> I am wondering about bug 503324 and the issue of needing to create a GOROOT with everything except the package to be compiled. Is your way solving this issue?
14 > >
15 > > I looked at an example in the tree (specifically go-fuse) and the
16 > > src_compile I wrote is the same as the one there.
17 > >
18 > > In the testing I've done here, GOPATH must be set or "go get" doesn't
19 > > work. The newest code for packages will always be stored in the first
20 > > directory listed in GOPATH, not in GOROOT.
21 > >
22 > > Given how GOPATH works in relation to GOROOT, I don't know yet why the
23 > > ebuilds in the tree are copying goroot; I'm not quite sure what they are
24 > > working around yet.
25 >
26 > For example, dev-go/go-net needs this workaround. Otherwise, if
27 > dev-go/go-net is already installed, it triggers a sandbox violation as
28 > follows:
29 >
30 > >>> Compiling source in
31 > /var/tmp/portage/dev-go/go-net-1.4.2_p20150604/work/src/golang.org/x/net ...
32 > WORK=/var/tmp/portage/dev-go/go-net-1.4.2_p20150604/temp/go-build862715022
33 > golang.org/x/net/html/charset
34 > mkdir -p $WORK/golang.org/x/net/html/charset/_obj/
35 > mkdir -p $WORK/golang.org/x/net/html/
36 > cd /usr/lib/go/src/golang.org/x/net/html/charset
37 > /usr/lib/go/pkg/tool/linux_amd64/6g -o
38 > $WORK/golang.org/x/net/html/charset.a -trimpath $WORK -p
39 > golang.org/x/net/html/charset -complete -D
40 > _/usr/lib/go/src/golang.org/x/net/html/charset -I $WORK -pack
41 > ./charset.go ./table.go
42 > mkdir -p /usr/lib/go/pkg/linux_amd64/golang.org/x/net/html/
43 > cp $WORK/golang.org/x/net/html/charset.a
44 > /usr/lib/go/pkg/linux_amd64/golang.org/x/net/html/charset.a
45 > go install golang.org/x/net/html/charset: open
46 > /usr/lib/go/pkg/linux_amd64/golang.org/x/net/html/charset.a: permission
47 > denied
48
49 Part of the problem is that golang.org/x/foo repositories try to install
50 in $GOROOT directly when you try to use "go install"; no other
51 repositories do this that I'm aware of.
52
53 I recommend using "go build" in src_compile to build the things you need
54 to install, then using manual methods to install the things you want to
55 install where they need to go.
56
57 Also, you can use "go env GOROOT" to get the value of goroot.
58
59 Now that i have golang-vcs.eclass in the tree,, I will take a look at
60 the go-net live ebuild. I will still take a look at reworking this
61 eclass. When I post it again it will be called golang-build.eclass and
62 be at the end of this thread.
63
64 Thanks,
65
66 William

Attachments

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