Re: rpmbuilding golang applications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 28, 2015 at 01:26:03AM +0100, Dennis Jacobfeuerborn wrote:
> Hi,
> I'm currently looking into creating an RPM for influxdb 0.9 but have run
> into a problem when it comes to the %install step in the spec file.
> 
> I created RPMs for all dependencies which are installed at
> /usr/share/gocode/src and these are found and influxdb builds fine
> however once the "go install ./..." line is reached in the spec file I
> get permission denied errors.
> 
> /home/dennis/rpmbuild/BUILD/influxdb-0.9.4.2
> ++ pwd
> + export
> GOPATH=/home/dennis/rpmbuild/BUILD/influxdb-0.9.4.2/_build:/usr/share/gocode
> +
> GOPATH=/home/dennis/rpmbuild/BUILD/influxdb-0.9.4.2/_build:/usr/share/gocode
> + pushd ./_build/src/github.com/influxdb/influxdb
> ~/rpmbuild/BUILD/influxdb-0.9.4.2/_build/src/github.com/influxdb/influxdb ~/rpmbuild/BUILD/influxdb-0.9.4.2
> + go install ./...
> go install golang.org/x/crypto/blowfish: mkdir /usr/share/gocode/pkg:
> permission denied
> go install gopkg.in/fatih/pool.v2: mkdir /usr/share/gocode/pkg:
> permission denied
> go install github.com/peterh/liner: mkdir /usr/share/gocode/pkg:
> permission denied
> go install github.com/armon/go-metrics: mkdir /usr/share/gocode/pkg:
> permission denied
> go install github.com/boltdb/bolt: mkdir /usr/share/gocode/pkg:
> permission denied
> go install github.com/rakyll/statik/fs: mkdir /usr/share/gocode/pkg:
> permission denied
> go install github.com/kimor79/gollectd: mkdir /usr/share/gocode/pkg:
> permission denied
> go install collectd.org/cdtime: mkdir /usr/share/gocode/pkg: permission
> denied
> go install github.com/golang/snappy: mkdir /usr/share/gocode/pkg:
> permission denied
> go install github.com/bmizerany/pat: mkdir /usr/share/gocode/pkg:
> permission denied
> go install github.com/BurntSushi/toml: mkdir /usr/share/gocode/pkg:
> permission denied
> go install github.com/hashicorp/go-msgpack/codec: mkdir
> /usr/share/gocode/pkg: permission denied
> go install github.com/gogo/protobuf/proto: mkdir /usr/share/gocode/pkg:
> permission denied
> error: Bad exit status from /var/tmp/rpm-tmp.YSKjXF (%install)
> 
> Notice how I set a special GOPATH with the intention that "go install"
> then installs the binaries into that hierachy. As you can see though
> that doesn't work and instead go tries to install the binaries for the
> dependencies (!) to /usr/share/gocode/pkg instead of the first path in
> GOPATH.
> 
> My theory is that since the sources for these dependencies are located
> in /usr/share/gocode/src go ignores the GOPATH completely and simply
> assumes that the corresponding binaries should be generated basically in
> ../pkg relative to the src directory.
> 
> My question is how am I to handle this?
> 
> At first I thought maybe I need to do a "go install" for each dependency
> and ship the binaries in /usr/share/gocode/pkg for each RPM  but
> https://fedoraproject.org/wiki/PackagingDrafts/Go has this to say:
> 
> "The standard golang compiler only produces static libraries. There is
> little value in shipping these prebuilt, especially since these
> libraries are very specifically tied to the exact minor release of the
> golang compiler. Instead, each library package should consist of a
> -devel subpackage which installs .go source code to
> /usr/share/gocode/src, under the appropriate import path.
> 
> Binary packages which build against this source will set $GOPATH to
> '%{_datadir}/gocode' ( or '%{gopath}' in golang > 1.2.1-1)"
> 
> So apparently I'm not supposed to ship these binaries but also
> apparently go insists installing binaries into a system path which is
> obviously a no-go for rpm builds.
> 
> What is the proper way to deal with this?

If you find a way to fix this, do let us know by following up on
the mailing list.

I would like to package up the golang bindings for libguestfs, but I
came to the conclusion that golang [upstream] is fundamentally broken
when it comes to proper packaging practices (maybe deliberately).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux