gofed / go-macros

Rpm mechanics for Go packaging
4 stars 7 forks source link

Use GO_BUILD_PATH in install #13

Closed nim-nim closed 6 years ago

nim-nim commented 6 years ago

right now goinstall.sh goes out of its way to create a $PWD/_build directory and golist uses it as GOPATH

However:

  1. that's not the same GOPATH as in other golist invocations, so it is inconsistent
  2. $PWD/_build is already created by %gobuildroot rpm macros, and exported as GO_BUILD_PATH

→ golist should use GO_BUILD_PATH as source of installation files in --to-install mode, to be consistent with the rest and avoid duplicated code

ingvagabund commented 6 years ago

The golist is built on top of go list actually so it needs GOPATH to be set properly.

E.g. golang-github-go-ini-ini currently provides 3 import path prefixes:

In the %install section I call:

%goinstall
%goinstall -i gopkg.in/v1/ini
%goinstall -i gopkg.in/ini.v1

Each time the %goinstall is invoked, it needs to create different GOPATH so all the resources are installed to correct locations. In the first case it defaults to %{gobaseipath}, so it creates $PWD/_build/src/github.com/go-ini/ini. The second time $PWD/_build/src/gopkg.in/v1/ini. And so on.

Given the %gobuildroot is called in %build section which is invoked before the %install, it does not matter the symlink changes. Or is there something I don't see?