android-tools icon indicating copy to clipboard operation
android-tools copied to clipboard

Starting with 31.0.0 release golang needs Internet to build the project

Open vanaf opened this issue 3 years ago • 6 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/[email protected]: 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

vanaf avatar Aug 02 '21 22:08 vanaf

As a workaround we use

GO111MODULE=off

to let go search for modules in GOPATH.

vanaf avatar Aug 02 '21 23:08 vanaf

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?

nmeum avatar Oct 17 '21 09:10 nmeum

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

Biswa96 avatar Feb 27 '23 09:02 Biswa96

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

munix9 avatar Feb 27 '23 09:02 munix9

I have now added the go mod vendor to the Google Action and it seems to work, see https://github.com/nmeum/android-tools/compare/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.

munix9 avatar Feb 27 '23 12:02 munix9

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

JamiKettunen avatar Apr 18 '23 10:04 JamiKettunen