Starting with 31.0.0 release golang needs Internet to build the project
vanaf opened this issue · 7 comments
We ship go.sum file since 31.0.0 release, which comes with following boringssl commit: https://boringssl-review.googlesource.com/c/boringssl/+/42044
Without Internet build now fails with
[ 50%] Generating err_data.c
cd /builddir/build/BUILD/android-tools-31.0.2/vendor/boringssl/crypto/err && /usr/bin/go run err_data_generate.go > /builddir/build/BUILD/android-tools-31.0.2/x86_64-redhat-linux-gnu/vendor/boringssl/crypto/err_data.c
go: golang.org/x/crypto@v0.0.0-20200622213623-75b288015ac9: unrecognized import path "golang.org/x/crypto": https fetch: Get "https://golang.org/x/crypto?go-get=1": dial tcp: lookup golang.org: Temporary failure in name resolution
See full log: https://koji.fedoraproject.org/koji/taskinfo?taskID=73169944
As a workaround we use
GO111MODULE=off
to let go search for modules in GOPATH.
How does boringssl obtain the Go dependencies then? Does the boringssl build system set GOPATH
and vendor the dependency or how does it work with GO111MODULE=off
?
Does this issue need to be fixed in this repository? Fedora spec file mentions the go modules explicitly, link https://src.fedoraproject.org/rpms/android-tools/blob/rawhide/f/android-tools.spec
This is also necessary in openSUSE on OBS, so the preliminary work of creating a vendor.tar.gz
locally, since the OBS does not allow network access even during package building.
If possible, the appropriate vendor packages needed could be created in advance and then included in the finished package.
gocryptfs
does it this way, see e.g. https://github.com/rfjakob/gocryptfs/releases - the package there is currently called gocryptfs_v2.3_src-deps.tar.gz
.
For openSUSE I create the required vendor.tar.gz
locally in advance and then refer in the spec file (after unpacking at the appropriate place) with export GOFLAGS="-mod=vendor"
that no download is necessary.
See also https://github.com/rfjakob/gocryptfs/blob/master/package-release-tarballs.bash
I have now added the go mod vendor
to the Google Action and it seems to work, see master...munix9:android-tools:vendor
The corresponding package_source for testing is available in https://github.com/munix9/android-tools/actions/runs/4282460513
When compiling, at least an export GOFLAGS="-mod=vendor"
must be done before.
I also hit this when packaging for Chimera Linux, there I could workaround with:
env = {"GOFLAGS": "-mod=vendor"}
def do_prepare(self):
with self.pushd("vendor/boringssl"):
self.do("go", "mod", "vendor", allow_network = True)
I'll try the proposed PR deps archive and report there in a bit