Bug 258210 - USES=go:modules make extract failures after port was updated
Summary: USES=go:modules make extract failures after port was updated
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dmitri Goutnik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-02 13:19 UTC by Dirk Meyer
Modified: 2022-10-21 21:34 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Meyer freebsd_committer freebsd_triage 2021-09-02 13:19:51 UTC
Environment:
Building ports in clean jails.
Shared and static /usr/ports/distfiles/

Problem:
After a port with USES=go:modules was updated, build fails in make extract stage.

Logfiles:
[...]
go: finding module for package github.com/stretchr/testify/require
github.com/influxdata/influxdb/cmd/influx/cli imports
        github.com/influxdata/flux: cannot find module providing package github.com/influxdata/flux: module lookup disabled by GOPROXY=off
[...]
*** Failed target:  post-extract
*** Failed command: (cd /usr/obj/image/usr/ports/databases/influxdb/work/github.com/influxdata/influxdb@v1.8.6; /usr/bin/env CGO_ENABLED=1 CGO_CFLAGS="-I/usr/local/include" CGO_LDFLAGS="-L/usr/local/lib" GOARM= GOPATH="/usr/ports/distfiles/go/databases_influxdb" GOBIN="/usr/obj/image/usr/ports/databases/influxdb/work/bin" GO111MODULE=on GOFLAGS=-modcacherw GOSUMDB=sum.golang.org GOPROXY=off /usr/local/bin/go mod vendor)
*** Error code 1
[...]

[...]
go: finding module for package github.com/golang/protobuf/ptypes/empty
github.com/influxdata/telegraf/agent imports
        github.com/benbjohnson/clock: cannot find module providing package github.com/benbjohnson/clock: module lookup disabled by GOPROXY=off
[...]
*** Failed target:  post-extract
*** Failed command: (cd /usr/obj/image/usr/ports/net-mgmt/telegraf/work/github.com/influxdata/telegraf@v1.19.3; /usr/bin/env CGO_ENABLED=1 CGO_CFLAGS="-I/usr/local/include" CGO_LDFLAGS="-L/usr/local/lib" GOARM= GOPATH="/usr/ports/distfiles/go/net-mgmt_telegraf" GOBIN="/usr/obj/image/usr/ports/net-mgmt/telegraf/work/bin" GO111MODULE=on GOFLAGS=-modcacherw GOSUMDB=sum.golang.org GOPROXY=off /usr/local/bin/go mod vendor)
*** Error code 1
[...]


Finally I found a workaround by cleaning the old parts of distfiles:
# rm -rf /usr/ports/distfiles/go/net-mgmt_telegraf/telegraf-v1.19.2
# rm -rf /usr/ports/distfiles/go/databases_influxdb

The ports can be build sucessfully again.
Comment 1 Dmitri Goutnik freebsd_committer freebsd_triage 2022-05-06 00:34:02 UTC
Assigning to myself as I was the original author of the Go modules support in go.mk. Could you please attach the full log if/when this happens again?
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-05-09 11:16:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6e236e18965327f6100473770e4edb78c94fb1d4

commit 6e236e18965327f6100473770e4edb78c94fb1d4
Author:     Dmitri Goutnik <dmgk@FreeBSD.org>
AuthorDate: 2022-05-08 20:49:05 +0000
Commit:     Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2022-05-09 11:15:14 +0000

    Mk/Uses/go.mk: Try to tidy up go.sum after fetch, fix EXTRACT_ONLY

    Make a best effort attempt (without network access) to add missing
    go.sum entries using local module cache prepared by the fetch stage.

    Set EXTRACT_ONLY dynamically from DISTFILES, repair
    USE_{GITHUB,GITLAB}.

    PR:             258210
    PR:             262981
    PR:             263866

 Mk/Uses/go.mk | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
Comment 3 Dirk Meyer freebsd_committer freebsd_triage 2022-05-10 08:49:12 UTC
(In reply to Dmitri Goutnik from comment #1)

Sure, it happened a few weeks ago.
I will comment out my "rm -rf /usr/ports/disfiles/go" and wait for it.
Comment 4 Dirk Meyer freebsd_committer freebsd_triage 2022-05-16 14:36:55 UTC
(In reply to Dmitri Goutnik from comment #1)

More details:

The last error I recorded,
was the upgrade to influxdb-v1.8.10 around March 27th.

I had to remove the existing folder in "distfiles/go/databases_influxdb"

I will preserver the full log, when it happen again.
Comment 5 Dirk Meyer freebsd_committer freebsd_triage 2022-10-21 08:14:28 UTC
The last updates where all without distfile problems.
I think that the problem has been solved.
Thank you very much.
Comment 6 Dmitri Goutnik freebsd_committer freebsd_triage 2022-10-21 21:34:55 UTC
Good to hear, thanks for testing.