Re: How to handle go dependencies

2019-07-09 Thread Matthias Fechner
Am 22.06.2019 um 11:58 schrieb Matthias Fechner:
> What is the correct way to getting these dependencies fetched and
> correctly included into the work-source in the fetch step using go?


Here a short summary what I had to do to build the port successfully
with go deps.
Thanks a lot for all that helped here!

Add:
USES=    go:modules

I had to use this USES as the port is using gmake to build everything:
USES=    gmake go:modules,no_targets

As gmake is used, the GOFLAGS must be passed to gmake with:

MAKE_ENV=    GOFLAGS="${GO_BUILDFLAGS}"

The port uses gitlab to fetch the distfiles, so I had to tell the ports
that github is not the default:
USE_GITHUB=    nodefault

The next step is then to create the GH_TUPLE and GL_TUPLE (depending
where the go libs are hosted, for they were on github and gitlab).
For this a very handy tool from Dmitri is existing: ports-mgmt/modules2tuple

To simplify it, I create a new target:
gomod-deps: patch
    (cd ${WRKSRC} && go mod vendor)
    (cd ${WRKSRC} && modules2tuple vendor/modules.txt)

Just execute `make gomod-deps` and you should see the required
GH/GL_TUPLE lines.

For the GL_TUPLE lines I had to put in the full length for the commit
hash, as the short one does not work.
I'm not sure if this is a port problem or a gitlab limitation, a task
for later to look into it.

The last section of the TUPLE line must not contain the character `-` if
this is the case, replace it by a `_`.
I think the script from Dmitri is doing this already for the GH_TUPLE lines.

Put the TUPLE lines into the Makefile, run `make makesum` and your port
should be prepare to be able to build.

If you need a full example, please have a look into devel/gitaly.

Have fun and thanks again to all that helped me!

   

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook




signature.asc
Description: OpenPGP digital signature


Re: How to handle go dependencies

2019-07-07 Thread Eugene Grosbein
07.07.2019 5:10, Dmitri Goutnik via freebsd-ports wrote:

> Which can be fixed by just copying the linux version (this probably needs to 
> be upstreamed):
> 
> post-patch:
>   ${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" 
> ${WRKSRC}/config.toml.example
>   ${MV} ${WRKSRC}/config.toml.example ${WRKSRC}/config.toml.sample
> +   ${CP} ${WRKSRC}/internal/helper/fstype/detect_linux.go 
> ${WRKSRC}/internal/helper/fstype/detect_freebsd.go

Making a symlink instead of copy should be faster and produce less I/O.
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-07-07 Thread Matthias Fechner
Dear Dmitri,

Am 07.07.2019 um 00:10 schrieb Dmitri Goutnik via freebsd-ports:
> It appears that Go build flags need to be passed down to `go build` 
> invocation 
> with MAKE_ENV:
>
> +MAKE_ENV=   GOFLAGS="${GO_BUILDFLAGS}"
>
> With that change, the build then fails later due to missing 
> statFileSystemType 
> func definition for freebsd:
>
> # gitlab.com/gitlab-org/gitaly/internal/helper/fstype
> internal/helper/fstype/fstype.go:7:15: undefined: statFileSystemType
>
> Which can be fixed by just copying the linux version (this probably needs to 
> be upstreamed):
>
> post-patch:
>   ${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" 
> ${WRKSRC}/config.toml.example
>   ${MV} ${WRKSRC}/config.toml.example ${WRKSRC}/config.toml.sample
> +   ${CP} ${WRKSRC}/internal/helper/fstype/detect_linux.go 
> ${WRKSRC}/internal/helper/fstype/detect_freebsd.go

thanks a lot for your help!
Without your help the upgrade to www/gitlab-ce 12.0.3 would not have
been possible.
This go stuff is really not that simple.

I reported the upstream change here:
https://gitlab.com/gitlab-org/gitaly/issues/1768

Gitlab-ce 12.0.3 is now commited ;)

Thanks again.

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-07-06 Thread Dmitri Goutnik via freebsd-ports
Hi Matthias,

On 19-07-06 23:30:33, Matthias Fechner wrote:
> Am 06.07.2019 um 21:48 schrieb Dmitri Goutnik:
> > -USES= gmake go:no_targets
> > +USES= gmake go:modules,no_targets
> >
> > It adds -mod=vendor build flag that tells Go to not try to download
> > anything and assume that all dependencies are already in vendor directory.
> 
> hm, it does not seems to have any impact it does not stop to complain:
> # go install
> go: finding github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
> 

It appears that Go build flags need to be passed down to `go build` invocation 
with MAKE_ENV:

+MAKE_ENV=   GOFLAGS="${GO_BUILDFLAGS}"

With that change, the build then fails later due to missing statFileSystemType 
func definition for freebsd:

# gitlab.com/gitlab-org/gitaly/internal/helper/fstype
internal/helper/fstype/fstype.go:7:15: undefined: statFileSystemType

Which can be fixed by just copying the linux version (this probably needs to 
be upstreamed):

post-patch:
${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" 
${WRKSRC}/config.toml.example
${MV} ${WRKSRC}/config.toml.example ${WRKSRC}/config.toml.sample
+   ${CP} ${WRKSRC}/internal/helper/fstype/detect_linux.go 
${WRKSRC}/internal/helper/fstype/detect_freebsd.go

Best regards,

-- Dmitri Goutnik
d...@syrec.org
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-07-06 Thread Matthias Fechner
Am 06.07.2019 um 21:48 schrieb Dmitri Goutnik:
> -USES= gmake go:no_targets
> +USES= gmake go:modules,no_targets
>
> It adds -mod=vendor build flag that tells Go to not try to download
> anything and assume that all dependencies are already in vendor directory.

hm, it does not seems to have any impact it does not stop to complain:
# go install
go: finding github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
go: finding github.com/cloudflare/tableflip
v0.0.0-20190329062924-8392f1641731
go: finding google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898
go: finding github.com/libgit2/git2go v0.0.0-20190104134018-ecaeb7a21d47
go: finding github.com/prometheus/client_golang v0.9.3
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding gitlab.com/gitlab-org/gitaly-proto v1.32.0
go: finding github.com/stretchr/testify v1.2.2
go: finding gitlab.com/gitlab-org/labkit v0.0.0-20190221122536-0c3fc7cdd57c
go: finding github.com/BurntSushi/toml v0.3.1
go: golang.org/x/net@v0.0.0-20190311183353-d8887717615a: Get
https://proxy.golang.org/golang.org/x/net/@v/v0.0.0-20190311183353-d8887717615a.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: gitlab.com/gitlab-org/gitaly-proto@v1.32.0: Get
https://proxy.golang.org/gitlab.com/gitlab-org/gitaly-proto/@v/v1.32.0.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: github.com/prometheus/client_golang@v0.9.3: Get
https://proxy.golang.org/github.com/prometheus/client_golang/@v/v0.9.3.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: finding github.com/tinylib/msgp v1.1.0
go: github.com/cloudflare/tableflip@v0.0.0-20190329062924-8392f1641731:
Get
https://proxy.golang.org/github.com/cloudflare/tableflip/@v/v0.0.0-20190329062924-8392f1641731.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: finding gopkg.in/yaml.v2 v2.2.2
go: finding github.com/getsentry/raven-go v0.1.2
go: gitlab.com/gitlab-org/labkit@v0.0.0-20190221122536-0c3fc7cdd57c: Get
https://proxy.golang.org/gitlab.com/gitlab-org/labkit/@v/v0.0.0-20190221122536-0c3fc7cdd57c.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: google.golang.org/genproto@v0.0.0-20181202183823-bd91e49a0898: Get
https://proxy.golang.org/google.golang.org/genproto/@v/v0.0.0-20181202183823-bd91e49a0898.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: github.com/BurntSushi/toml@v0.3.1: Get
https://proxy.golang.org/github.com/%21burnt%21sushi/toml/@v/v0.3.1.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: github.com/grpc-ecosystem/go-grpc-middleware@v1.0.0: Get
https://proxy.golang.org/github.com/grpc-ecosystem/go-grpc-middleware/@v/v1.0.0.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: github.com/stretchr/testify@v1.2.2: Get
https://proxy.golang.org/github.com/stretchr/testify/@v/v1.2.2.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: finding google.golang.org/grpc v1.16.0
go: github.com/libgit2/git2go@v0.0.0-20190104134018-ecaeb7a21d47: Get
https://proxy.golang.org/github.com/libgit2/git2go/@v/v0.0.0-20190104134018-ecaeb7a21d47.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: finding github.com/sirupsen/logrus v1.2.0
go: finding github.com/golang/protobuf v1.3.1
go: finding golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
go: finding github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
go: finding github.com/kelseyhightower/envconfig v1.3.0
go: golang.org/x/sys@v0.0.0-20190215142949-d0b11bdaac8a: Get
https://proxy.golang.org/golang.org/x/sys/@v/v0.0.0-20190215142949-d0b11bdaac8a.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: github.com/golang/protobuf@v1.3.1: Get
https://proxy.golang.org/github.com/golang/protobuf/@v/v1.3.1.info: dial
tcp 172.217.20.113:443: connect: can't assign requested address
go: google.golang.org/grpc@v1.16.0: Get
https://proxy.golang.org/google.golang.org/grpc/@v/v1.16.0.info: dial
tcp 172.217.20.113:443: connect: can't assign requested address
go: golang.org/x/sync@v0.0.0-20181221193216-37e7f081c4d4: Get
https://proxy.golang.org/golang.org/x/sync/@v/v0.0.0-20181221193216-37e7f081c4d4.info:
dial tcp 172.217.20.113:443: connect: can't assign requested address
go: github.com/tinylib/msgp@v1.1.0: Get
https://proxy.golang.org/github.com/tinylib/msgp/@v/v1.1.0.info: dial
tcp 172.217.20.113:443: connect: can't assign requested address
go: github.com/sirupsen/logrus@v1.2.0: Get
https://proxy.golang.org/github.com/sirupsen/logrus/@v/v1.2.0.info: dial
tcp 172.217.20.113:443: connect: can't assign requested address
go: gopkg.in/yaml.v2@v2.2.2: Get
https://proxy.golang.org/gopkg.in/yaml.v2/@v/v2.2.2.info: dial tcp
172.217.20.113:443: connect: can't assign requested address
go: github.com/getsentry/raven-go@v0.1.2: Get

Re: How to handle go dependencies

2019-07-06 Thread Dmitri Goutnik via freebsd-ports
Hi Matthias,

On 19-07-06 19:52:04, Matthias Fechner wrote:

> I used now USES= gmake |go:no_targets|

In addition to `no_targets`, you'd also want a `modules` arg :

-USES=   gmake go:no_targets
+USES=   gmake go:modules,no_targets

It adds -mod=vendor build flag that tells Go to not try to download anything 
and assume that all dependencies are already in vendor directory.

Best regards,

--
Dmitri Goutnik
d...@syrec.org
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-07-06 Thread Matthias Fechner
Dear Dmitri,

at first thanks a lot for your suggestions.
The current version of the Makefile is always here:
https://gitlab.fechner.net/mfechner/Gitlab/blob/12.0/devel/gitaly/Makefile

Other answer under your suggestions.

Am 23.06.2019 um 23:40 schrieb Dmitri Goutnik via freebsd-ports:
> +USES= gmake 

I used now USES= gmake |go:no_targets|

|This pulls in go as dependency. Without go:no_targets I got an error
message that go was not found.
|

|
|

> "gitaly-proto" is not a valid group name (contains "-"); can be fixed by 
> changing the group name to e.g. "gitaly_proto"

thanks, now I was able to generate the distinfo file.

>  post-patch:
>   ${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" 
> ${WRKSRC}/config.toml.example
>   ${MV} ${WRKSRC}/config.toml.example ${WRKSRC}/config.toml.sample
> - ${RM} ${WRKSRC}/go.mod

removed.

But now I have the problem that go does not find the libs.
I get now the error messages like:
# go install
go: finding github.com/getsentry/raven-go v0.1.2
go: finding golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
go: finding github.com/golang/protobuf v1.3.1
go: finding gitlab.com/gitlab-org/gitaly-proto v1.32.0
go: finding github.com/stretchr/testify v1.2.2
go: finding github.com/cloudflare/tableflip
v0.0.0-20190329062924-8392f1641731
go: finding github.com/tinylib/msgp v1.1.0
go: finding github.com/sirupsen/logrus v1.2.0
go: finding github.com/libgit2/git2go v0.0.0-20190104134018-ecaeb7a21d47
go: finding github.com/BurntSushi/toml v0.3.1
go: github.com/BurntSushi/toml@v0.3.1: Get
https://proxy.golang.org/github.com/%21burnt%21sushi/toml/@v/v0.3.1.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: github.com/getsentry/raven-go@v0.1.2: Get
https://proxy.golang.org/github.com/getsentry/raven-go/@v/v0.1.2.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: github.com/cloudflare/tableflip@v0.0.0-20190329062924-8392f1641731:
Get
https://proxy.golang.org/github.com/cloudflare/tableflip/@v/v0.0.0-20190329062924-8392f1641731.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: github.com/sirupsen/logrus@v1.2.0: Get
https://proxy.golang.org/github.com/sirupsen/logrus/@v/v1.2.0.info: dial
tcp 172.217.19.209:443: connect: can't assign requested address
go: finding google.golang.org/grpc v1.16.0
go: finding google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898
go: github.com/libgit2/git2go@v0.0.0-20190104134018-ecaeb7a21d47: Get
https://proxy.golang.org/github.com/libgit2/git2go/@v/v0.0.0-20190104134018-ecaeb7a21d47.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: finding github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
go: github.com/stretchr/testify@v1.2.2: Get
https://proxy.golang.org/github.com/stretchr/testify/@v/v1.2.2.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: finding gopkg.in/yaml.v2 v2.2.2
go: golang.org/x/sync@v0.0.0-20181221193216-37e7f081c4d4: Get
https://proxy.golang.org/golang.org/x/sync/@v/v0.0.0-20181221193216-37e7f081c4d4.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: finding gitlab.com/gitlab-org/labkit v0.0.0-20190221122536-0c3fc7cdd57c
go: finding github.com/prometheus/client_golang v0.9.3
go: github.com/tinylib/msgp@v1.1.0: Get
https://proxy.golang.org/github.com/tinylib/msgp/@v/v1.1.0.info: dial
tcp 172.217.19.209:443: connect: can't assign requested address
go: github.com/golang/protobuf@v1.3.1: Get
https://proxy.golang.org/github.com/golang/protobuf/@v/v1.3.1.info: dial
tcp 172.217.19.209:443: connect: can't assign requested address
go: gitlab.com/gitlab-org/gitaly-proto@v1.32.0: Get
https://proxy.golang.org/gitlab.com/gitlab-org/gitaly-proto/@v/v1.32.0.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: finding github.com/kelseyhightower/envconfig v1.3.0
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
go: gitlab.com/gitlab-org/labkit@v0.0.0-20190221122536-0c3fc7cdd57c: Get
https://proxy.golang.org/gitlab.com/gitlab-org/labkit/@v/v0.0.0-20190221122536-0c3fc7cdd57c.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: github.com/grpc-ecosystem/go-grpc-middleware@v1.0.0: Get
https://proxy.golang.org/github.com/grpc-ecosystem/go-grpc-middleware/@v/v1.0.0.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: golang.org/x/net@v0.0.0-20190311183353-d8887717615a: Get
https://proxy.golang.org/golang.org/x/net/@v/v0.0.0-20190311183353-d8887717615a.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: github.com/grpc-ecosystem/go-grpc-prometheus@v1.2.0: Get
https://proxy.golang.org/github.com/grpc-ecosystem/go-grpc-prometheus/@v/v1.2.0.info:
dial tcp 172.217.19.209:443: connect: can't assign requested address
go: 

Re: How to handle go dependencies

2019-06-23 Thread Dmitri Goutnik via freebsd-ports
On 19-06-23 22:21:44, Matthias Fechner wrote:
> Am 23.06.2019 um 11:57 schrieb Tobias Kortkamp:
> > Please do not use it.  It is broken in many ways.  Use Dimtri's
> > devel/modules2tuple instead.  Change to WRKSRC of your port and run
> > `go mod vendor` then `modules2tuple vendor/modules.txt` and it will
> > spit out an appropriate GH_TUPLE etc.
> 
> thanks that looks fine now. I added also a target `gomod-deps` to get
> that more easily generated.
> It currently seems to only support GH and not GL, this could maybe
> improved later.
> 
> > Probably you need
> > USE_GITHUB= nodefault
> >
> > and it should work.
> 
> seems ok, I have now the following:
> https://gitlab.fechner.net/mfechner/Gitlab/commit/e83876fb9de9c79c39ba85801ebb242a08f5412c
> 
> But now I get the error message:
> ===
> The
> https://gitlab.com/gitlab-org/gitaly-proto/repository/f4db5d05d437abe1154d7308ca044d3577b5ccba/archive.tar.gz?dummy=/:gitaly-proto
> MASTER_SITES line has
> a group with invalid characters, only use [a-zA-Z0-9_]
> *** Error code 1
> 
> This seems to be a bug in the ports?
> Why is a `-` an invalid character, it exists in:
> https://gitlab.com/gitlab-org/gitaly/
> 
> Is there a way out?
> 
> Gruß
> Matthias
> 

Hi Matthias,

Gitaly seems to be using gmake for build so USES=go won't work here because 
go.mk would add a "do-build" target (as port's Makefile doesn't define one 
explicitly) and it will break the build,

-USES=  gmake go go:modules
+USES=  gmake
-MAKE_ENV+= GOPATH=${WRKSRC}

The group error is coming from this GL_TUPLE line:

gitlab-org:gitaly-proto:f4db5d05d437abe1154d7308ca044d3577b5ccba:gitaly-proto/vendor/gitlab.com/gitlab-org/gitaly-proto

"gitaly-proto" is not a valid group name (contains "-"); can be fixed by 
changing the group name to e.g. "gitaly_proto"

Upstream's Makefile is disabling Go modules support by setting 
GO111MODULES=off so "rm go.mod" can be removed from post-patch (go.mod is 
ignored with GO111MODULES=off):

 post-patch:
${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" 
${WRKSRC}/config.toml.example
${MV} ${WRKSRC}/config.toml.example ${WRKSRC}/config.toml.sample
-   ${RM} ${WRKSRC}/go.mod

-- Dmitri Goutnik
d...@syrec.org
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-06-23 Thread Matthias Fechner
Am 23.06.2019 um 11:57 schrieb Tobias Kortkamp:
> Please do not use it.  It is broken in many ways.  Use Dimtri's
> devel/modules2tuple instead.  Change to WRKSRC of your port and run
> `go mod vendor` then `modules2tuple vendor/modules.txt` and it will
> spit out an appropriate GH_TUPLE etc.

thanks that looks fine now. I added also a target `gomod-deps` to get
that more easily generated.
It currently seems to only support GH and not GL, this could maybe
improved later.

> Probably you need
> USE_GITHUB=   nodefault
>
> and it should work.

seems ok, I have now the following:
https://gitlab.fechner.net/mfechner/Gitlab/commit/e83876fb9de9c79c39ba85801ebb242a08f5412c

But now I get the error message:
===
The
https://gitlab.com/gitlab-org/gitaly-proto/repository/f4db5d05d437abe1154d7308ca044d3577b5ccba/archive.tar.gz?dummy=/:gitaly-proto
MASTER_SITES line has
a group with invalid characters, only use [a-zA-Z0-9_]
*** Error code 1

This seems to be a bug in the ports?
Why is a `-` an invalid character, it exists in:
https://gitlab.com/gitlab-org/gitaly/

Is there a way out?

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook




signature.asc
Description: OpenPGP digital signature


Re: How to handle go dependencies

2019-06-23 Thread Kurt Jaeger
Hi!

Dimitri wrote:
> It appears that upstream moved gobgp and gobgpd packages to ./cmd, so 
> GO_TARGET needs to be updated:
> 
> -GO_TARGET= ${GO_PKGNAME}/gobgp \
> -   ${GO_PKGNAME}/gobgpd
> +GO_TARGET= ./cmd/gobgp \
> +   ./cmd/gobgpd

Thanks, it seems to build.

-- 
p...@opsec.eu+49 171 3101372One year to go !
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-06-23 Thread Dmitri Goutnik via freebsd-ports
On 19-06-23 12:47:22, Kurt Jaeger wrote:
> Hi!
> 
> [...]
> > > can't load package: package github.com/osrg/gobgp/gobgpd: cannot find 
> > > package "github.com/osrg/gobgp/gobgpd" in any of:
> > >   /usr/local/go/src/github.com/osrg/gobgp/gobgpd (from $GOROOT)
> > >   /home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp/gobgpd (from 
> > > $GOPATH)
> > > *** Error code 1
> > 
> > You need USES=go:modules not just USES=go.
> 
> Thanks. This changes the 'cd' at the beginning from
> 
> cd /home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp
> 
> to
> 
> cd /home/pi/m/net/gobgp/work/gobgp-2.5.0
> 
> and with a slightly different error:
> 
> can't load package: package github.com/osrg/gobgp/gobgp: cannot find package 
> "." in:
>/home/pi/m/net/gobgp/work/gobgp-2.5.0/gobgp
> 
> I do not think that I understand what's going on 8-}
> 

It appears that upstream moved gobgp and gobgpd packages to ./cmd, so 
GO_TARGET needs to be updated:

-GO_TARGET= ${GO_PKGNAME}/gobgp \
-   ${GO_PKGNAME}/gobgpd
+GO_TARGET= ./cmd/gobgp \
+   ./cmd/gobgpd

-- 
Dmitri Goutnik
d...@syrec.org
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-06-23 Thread Kurt Jaeger
Hi!

[...]
> > can't load package: package github.com/osrg/gobgp/gobgpd: cannot find 
> > package "github.com/osrg/gobgp/gobgpd" in any of:
> > /usr/local/go/src/github.com/osrg/gobgp/gobgpd (from $GOROOT)
> > /home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp/gobgpd (from 
> > $GOPATH)
> > *** Error code 1
> 
> You need USES=go:modules not just USES=go.

Thanks. This changes the 'cd' at the beginning from

cd /home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp

to

cd /home/pi/m/net/gobgp/work/gobgp-2.5.0

and with a slightly different error:

can't load package: package github.com/osrg/gobgp/gobgp: cannot find package 
"." in:
   /home/pi/m/net/gobgp/work/gobgp-2.5.0/gobgp

I do not think that I understand what's going on 8-}

-- 
p...@opsec.eu+49 171 3101372One year to go !
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-06-23 Thread Tobias Kortkamp
On Sun, Jun 23, 2019 at 12:30:00PM +0200, Kurt Jaeger wrote:
> Hi!
> 
> > Please do not use it.  It is broken in many ways.  Use Dimtri's
> > devel/modules2tuple instead.  Change to WRKSRC of your port and run
> > `go mod vendor` then `modules2tuple vendor/modules.txt` and it will
> > spit out an appropriate GH_TUPLE etc.
> 
> Thanks, I tested that approach with an updated version of net/gobgp.
> 
> I got the updated GH_TUPLE, included it in the ports Makefile,
> ran make makesum, but make aborts, see below.
> 
> Are there several different ways that go is handling this ?
> 
> [...]
> => SHA256 Checksum OK for gobgp/vishvananda-netns-86bef332bfc3_GH0.tar.gz.
> ===>  Patching for gobgp-2.5.0
> ===>   gobgp-2.5.0 depends on file: /usr/local/bin/go - found
> ===>  Configuring for gobgp-2.5.0
> ===>  Building for gobgp-2.5.0
> (cd /home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp;  /usr/bin/env 
> XDG_DATA_HOME=/home/pi/m/net/gobgp/work  
> XDG_CONFIG_HOME=/home/pi/m/net/gobgp/work  HOME=/home/pi/m/net/gobgp/work 
> PATH=/home/pi/m/net/gobgp/work/.bin:/home/pi/bin:/client/bin:/client/sbin:/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin
>  NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES 
> PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  
> -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  
> LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe 
> -fstack-protector-strong -fno-strict-aliasing  "  MANPREFIX="/usr/local" 
> BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 
> 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 
> 0644"  BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  
> CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOARM= 
> GOPATH="/home/pi/m/net/gobgp/work"  GOBIN="" /usr/local/bin/go install -v 
> -buildmode=exe github.com/osrg/gobgp/gobgp  github.com/osrg/gobgp/gobgpd)
> can't load package: package github.com/osrg/gobgp/gobgp: cannot find package 
> "github.com/osrg/gobgp/gobgp" in any of:
>   /usr/local/go/src/github.com/osrg/gobgp/gobgp (from $GOROOT)
>   /home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp/gobgp (from $GOPATH)
> can't load package: package github.com/osrg/gobgp/gobgpd: cannot find package 
> "github.com/osrg/gobgp/gobgpd" in any of:
>   /usr/local/go/src/github.com/osrg/gobgp/gobgpd (from $GOROOT)
>   /home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp/gobgpd (from 
> $GOPATH)
> *** Error code 1

You need USES=go:modules not just USES=go.


signature.asc
Description: PGP signature


Re: How to handle go dependencies

2019-06-23 Thread Kurt Jaeger
Hi!

> Please do not use it.  It is broken in many ways.  Use Dimtri's
> devel/modules2tuple instead.  Change to WRKSRC of your port and run
> `go mod vendor` then `modules2tuple vendor/modules.txt` and it will
> spit out an appropriate GH_TUPLE etc.

Thanks, I tested that approach with an updated version of net/gobgp.

I got the updated GH_TUPLE, included it in the ports Makefile,
ran make makesum, but make aborts, see below.

Are there several different ways that go is handling this ?

[...]
=> SHA256 Checksum OK for gobgp/vishvananda-netns-86bef332bfc3_GH0.tar.gz.
===>  Patching for gobgp-2.5.0
===>   gobgp-2.5.0 depends on file: /usr/local/bin/go - found
===>  Configuring for gobgp-2.5.0
===>  Building for gobgp-2.5.0
(cd /home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp;  /usr/bin/env 
XDG_DATA_HOME=/home/pi/m/net/gobgp/work  
XDG_CONFIG_HOME=/home/pi/m/net/gobgp/work  HOME=/home/pi/m/net/gobgp/work 
PATH=/home/pi/m/net/gobgp/work/.bin:/home/pi/bin:/client/bin:/client/sbin:/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin
 NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES 
PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  
-fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  
LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe 
-fstack-protector-strong -fno-strict-aliasing  "  MANPREFIX="/usr/local" 
BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644" 
 BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  
BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  
CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOARM= 
GOPATH="/home/pi/m/net/gobgp/work
 "  GOBIN="" /usr/local/bin/go install -v -buildmode=exe 
github.com/osrg/gobgp/gobgp  github.com/osrg/gobgp/gobgpd)
can't load package: package github.com/osrg/gobgp/gobgp: cannot find package 
"github.com/osrg/gobgp/gobgp" in any of:
/usr/local/go/src/github.com/osrg/gobgp/gobgp (from $GOROOT)
/home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp/gobgp (from $GOPATH)
can't load package: package github.com/osrg/gobgp/gobgpd: cannot find package 
"github.com/osrg/gobgp/gobgpd" in any of:
/usr/local/go/src/github.com/osrg/gobgp/gobgpd (from $GOROOT)
/home/pi/m/net/gobgp/work/src/github.com/osrg/gobgp/gobgpd (from 
$GOPATH)
*** Error code 1

-- 
p...@opsec.eu+49 171 3101372One year to go !
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-06-23 Thread Tobias Kortkamp
On Sun, Jun 23, 2019 at 11:47:41AM +0200, Matthias Fechner wrote:
> Am 22.06.2019 um 22:52 schrieb Dmitri Goutnik:
> > Can be further simplified by using USES=go:modules. This will remove the 
> > need 
> > to modify MAKE_ENV as go.mk will then add -mod=vendor flag automagically.
> 
> very interesting.
> 
> I also found a nice mechanism in devel/bingo.
> It has a very nice awk script to generate the GH_TUPLE line
> automatically (see Makefile target gomod-deps).

Please do not use it.  It is broken in many ways.  Use Dimtri's
devel/modules2tuple instead.  Change to WRKSRC of your port and run
`go mod vendor` then `modules2tuple vendor/modules.txt` and it will
spit out an appropriate GH_TUPLE etc.

> But I have now the problem that my source is hosted on gitlab, so I use
> `USE_GITLAB`.
> It seems to make problem if I try to also use `USE_GITHUB`.
> 
> I see now the following problem:
> make: "/usr/ports/Mk/bsd.sites.mk" line 602: warning: duplicate script
> for target "git-clone-DEFAULT" ignored
> make: "/usr/ports/Mk/bsd.sites.mk" line 466: warning: using previous
> script for "git-clone-DEFAULT" defined here
> make: "/usr/ports/Mk/bsd.sites.mk" line 603: warning: duplicate script
> for target "git-clone-DEFAULT" ignored
> make: "/usr/ports/Mk/bsd.sites.mk" line 466: warning: using previous
> script for "git-clone-DEFAULT" defined here
> pkg-static: /tmp/pkgs/gitaly-1.47.0.txz: No such file or directory
> pkg-static: Was 'pkg install /tmp/pkgs/gitaly-1.47.0.txz' meant?
> 
> Can I use GITLAB too fetch the main archive and use GITHUB to fetch the
> go packages I need?

Probably you need

USE_GITHUB= nodefault

and it should work.


signature.asc
Description: PGP signature


Re: How to handle go dependencies

2019-06-23 Thread Matthias Fechner
Am 22.06.2019 um 22:52 schrieb Dmitri Goutnik:
> Can be further simplified by using USES=go:modules. This will remove the need 
> to modify MAKE_ENV as go.mk will then add -mod=vendor flag automagically.

very interesting.

I also found a nice mechanism in devel/bingo.
It has a very nice awk script to generate the GH_TUPLE line
automatically (see Makefile target gomod-deps).

But I have now the problem that my source is hosted on gitlab, so I use
`USE_GITLAB`.
It seems to make problem if I try to also use `USE_GITHUB`.

I see now the following problem:
make: "/usr/ports/Mk/bsd.sites.mk" line 602: warning: duplicate script
for target "git-clone-DEFAULT" ignored
make: "/usr/ports/Mk/bsd.sites.mk" line 466: warning: using previous
script for "git-clone-DEFAULT" defined here
make: "/usr/ports/Mk/bsd.sites.mk" line 603: warning: duplicate script
for target "git-clone-DEFAULT" ignored
make: "/usr/ports/Mk/bsd.sites.mk" line 466: warning: using previous
script for "git-clone-DEFAULT" defined here
pkg-static: /tmp/pkgs/gitaly-1.47.0.txz: No such file or directory
pkg-static: Was 'pkg install /tmp/pkgs/gitaly-1.47.0.txz' meant?

Can I use GITLAB too fetch the main archive and use GITHUB to fetch the
go packages I need?

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook


___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-06-22 Thread Dmitri Goutnik via freebsd-ports
On 19-06-22 14:31:24, Adam Weinberger wrote:
> On Sat, Jun 22, 2019 at 2:22 PM Bernhard Froehlich  wrote:
> >
> >
> > Am 22.06.2019 19:47 schrieb Adam Weinberger :
> > >
> > > On Sat, Jun 22, 2019 at 11:10 AM Bernhard Froehlich  
> > > wrote:
> > > >
> > > >
> > > > Am 22.06.2019 17:56 schrieb Adam Weinberger :
> > > > >
> > > > > On Sat, Jun 22, 2019 at 8:21 AM Danilo G. Baio  
> > > > > wrote:
> > > > > >
> > > > > > On Sat, Jun 22, 2019 at 11:58:49AM +0200, Matthias Fechner wrote:
> > > > > > > Dear all,
> > > > > > >
> > > > > > > I just prepare the gitlab-ce upgrade to version 12.0.0.
> > > > > > > But I have some problem with a package that uses go to compile.
> > > > > > >
> > > > > > > The new version of devel/gitaly has changed the way the package 
> > > > > > > is defined.
> > > > > > > They removed now all files from the vendor/ folder and add 
> > > > > > > dependencies
> > > > > > > in a `go.mod` file.
> > > > > > >
> > > > > > > If I now build the port it tries to fetch the files while no 
> > > > > > > network
> > > > > > > access is allowed.
> > > > > > >
> > > > > > > What is the correct way to getting these dependencies fetched and
> > > > > > > correctly included into the work-source in the fetch step using 
> > > > > > > go?
> > > > > > >
> > > > > > > Thanks a lot!
> > > > > > >
> > > > > > > Gruß
> > > > > > > Matthias
> > > > > > >
> > > > > >
> > > > > > Try this and remove the go.mod file
> > > > > >
> > > > > > ports-mgmt/modules2tuple
> > > > > > https://github.com/dmgk/modules2tuple
> > > > > >
> > > > > > Examples:
> > > > > > net/geoipupdate
> > > > > > shells/antibody
> > > > >
> > > > > Just a note here, both those ports are mine, and I have no idea if
> > > > > that's the right thing to do; it built right so I did it. I don't
> > > > > understand Go packaging at all, and I'd sure appreciate someone with
> > > > > Go knowledge verifying whether removing go.mod is the proper thing to
> > > > > do.
> > > >
> > > > The correct magic that you are searching is:
> > > >
> > > > MAKE_ENV+= GOFLAGS=-mod=vendor
> > > >
> > > > (like it is used in mail/smtprelay)
> > >
> > > With that I still get:
> > >
> > > $GOPATH/go.mod exists but should not
> > > *** Error code 1
> > >
> > > Stop.
> > >
> >
> > Which port is that? I had a look at shells/antibody which you mentioned and 
> > came up with that:
> >
> > --- /home/decke/dev/ports/shells/antibody/Makefile  2019-06-12 
> > 18:57:58.189631000 +
> > +++ /home/decke/dev/myports/shells/antibody/Makefile2019-06-22 
> > 20:13:05.627718000 +
> > @@ -21,23 +21,18 @@
> >
> >  USE_GITHUB=yes
> >  GH_ACCOUNT=getantibody
> > -GH_SUBDIR= src/github.com/${GH_ACCOUNT_DEFAULT}/${PORTNAME}
> >  # Not needed: go-spew, go-difflib
> > -GH_TUPLE=  
> > alecthomas:kingpin:a39589:kingpin/src/github.com/alecthomas/kingpin \
> > -   
> > alecthomas:template:a0175e:tempalte/src/github.com/alecthomas/template \
> > -   
> > alecthomas:units:2efee8:units/src/github.com/alecthomas/units \
> > -   
> > caarlos0:gohome:75f08ebc:gohome/src/github.com/caarlos0/gohome \
> > -   
> > getantibody:folder:v1.0.0:folder/src/github.com/getantibody/folder \
> > -   golang:crypto:1a580b:crypto/src/golang.org/x/crypto \
> > -   golang:net:2491c5:net/src/golang.org/x/net \
> > -   golang:sync:1d60e4:sync/src/golang.org/x/sync \
> > -   golang:sys:7c87d1:sys/src/golang.org/x/sys
> > +GH_TUPLE=  
> > alecthomas:kingpin:a39589:kingpin/vendor/github.com/alecthomas/kingpin \
> > +   
> > alecthomas:template:a0175e:template/vendor/github.com/alecthomas/template \
> > +   
> > alecthomas:units:2efee8:units/vendor/github.com/alecthomas/units \
> > +   
> > caarlos0:gohome:75f08ebc:gohome/vendor/github.com/caarlos0/gohome \
> > +   
> > getantibody:folder:v1.0.0:folder/vendor/github.com/getantibody/folder \
> > +   golang:crypto:1a580b:crypto/vendor/golang.org/x/crypto \
> > +   golang:net:2491c5:net/vendor/golang.org/x/net \
> > +   golang:sync:1d60e4:sync/vendor/golang.org/x/sync \
> > +   golang:sys:7c87d1:sys/vendor/golang.org/x/sys
> >
> > -do-build:
> > -   ${RM} ${WRKSRC}/go.mod
> > -   cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${BUILD_ENV} GOPATH=${WRKSRC} 
> > go build
> > -
> > -do-install:
> > -   ${INSTALL_PROGRAM} ${WRKSRC}/antibody-${PORTVERSION} 
> > ${STAGEDIR}${PREFIX}/bin/antibody
> > +GO_PKGNAME=github.com/getantibody/antibody
> > +MAKE_ENV+= GOFLAGS=-mod=vendor
> >
> >  .include 
> >
> > It looks much more complicated than it is. In GH_TUPLE replace src with 
> > vendor to have the dependencies in the path where go will look for. Add 
> > GOFLAGS=-mod=vendor to force go to use the sources it finds there and 
> > ignore go.mod/go.sum And last but not least set GO_PKGNAME and let our 
> > Uses/go.mk do the magic.
> 
> Wow, I had 

Re: How to handle go dependencies

2019-06-22 Thread Adam Weinberger
On Sat, Jun 22, 2019 at 2:22 PM Bernhard Froehlich  wrote:
>
>
> Am 22.06.2019 19:47 schrieb Adam Weinberger :
> >
> > On Sat, Jun 22, 2019 at 11:10 AM Bernhard Froehlich  
> > wrote:
> > >
> > >
> > > Am 22.06.2019 17:56 schrieb Adam Weinberger :
> > > >
> > > > On Sat, Jun 22, 2019 at 8:21 AM Danilo G. Baio  
> > > > wrote:
> > > > >
> > > > > On Sat, Jun 22, 2019 at 11:58:49AM +0200, Matthias Fechner wrote:
> > > > > > Dear all,
> > > > > >
> > > > > > I just prepare the gitlab-ce upgrade to version 12.0.0.
> > > > > > But I have some problem with a package that uses go to compile.
> > > > > >
> > > > > > The new version of devel/gitaly has changed the way the package is 
> > > > > > defined.
> > > > > > They removed now all files from the vendor/ folder and add 
> > > > > > dependencies
> > > > > > in a `go.mod` file.
> > > > > >
> > > > > > If I now build the port it tries to fetch the files while no network
> > > > > > access is allowed.
> > > > > >
> > > > > > What is the correct way to getting these dependencies fetched and
> > > > > > correctly included into the work-source in the fetch step using go?
> > > > > >
> > > > > > Thanks a lot!
> > > > > >
> > > > > > Gruß
> > > > > > Matthias
> > > > > >
> > > > >
> > > > > Try this and remove the go.mod file
> > > > >
> > > > > ports-mgmt/modules2tuple
> > > > > https://github.com/dmgk/modules2tuple
> > > > >
> > > > > Examples:
> > > > > net/geoipupdate
> > > > > shells/antibody
> > > >
> > > > Just a note here, both those ports are mine, and I have no idea if
> > > > that's the right thing to do; it built right so I did it. I don't
> > > > understand Go packaging at all, and I'd sure appreciate someone with
> > > > Go knowledge verifying whether removing go.mod is the proper thing to
> > > > do.
> > >
> > > The correct magic that you are searching is:
> > >
> > > MAKE_ENV+= GOFLAGS=-mod=vendor
> > >
> > > (like it is used in mail/smtprelay)
> >
> > With that I still get:
> >
> > $GOPATH/go.mod exists but should not
> > *** Error code 1
> >
> > Stop.
> >
>
> Which port is that? I had a look at shells/antibody which you mentioned and 
> came up with that:
>
> --- /home/decke/dev/ports/shells/antibody/Makefile  2019-06-12 
> 18:57:58.189631000 +
> +++ /home/decke/dev/myports/shells/antibody/Makefile2019-06-22 
> 20:13:05.627718000 +
> @@ -21,23 +21,18 @@
>
>  USE_GITHUB=yes
>  GH_ACCOUNT=getantibody
> -GH_SUBDIR= src/github.com/${GH_ACCOUNT_DEFAULT}/${PORTNAME}
>  # Not needed: go-spew, go-difflib
> -GH_TUPLE=  
> alecthomas:kingpin:a39589:kingpin/src/github.com/alecthomas/kingpin \
> -   
> alecthomas:template:a0175e:tempalte/src/github.com/alecthomas/template \
> -   alecthomas:units:2efee8:units/src/github.com/alecthomas/units 
> \
> -   
> caarlos0:gohome:75f08ebc:gohome/src/github.com/caarlos0/gohome \
> -   
> getantibody:folder:v1.0.0:folder/src/github.com/getantibody/folder \
> -   golang:crypto:1a580b:crypto/src/golang.org/x/crypto \
> -   golang:net:2491c5:net/src/golang.org/x/net \
> -   golang:sync:1d60e4:sync/src/golang.org/x/sync \
> -   golang:sys:7c87d1:sys/src/golang.org/x/sys
> +GH_TUPLE=  
> alecthomas:kingpin:a39589:kingpin/vendor/github.com/alecthomas/kingpin \
> +   
> alecthomas:template:a0175e:template/vendor/github.com/alecthomas/template \
> +   
> alecthomas:units:2efee8:units/vendor/github.com/alecthomas/units \
> +   
> caarlos0:gohome:75f08ebc:gohome/vendor/github.com/caarlos0/gohome \
> +   
> getantibody:folder:v1.0.0:folder/vendor/github.com/getantibody/folder \
> +   golang:crypto:1a580b:crypto/vendor/golang.org/x/crypto \
> +   golang:net:2491c5:net/vendor/golang.org/x/net \
> +   golang:sync:1d60e4:sync/vendor/golang.org/x/sync \
> +   golang:sys:7c87d1:sys/vendor/golang.org/x/sys
>
> -do-build:
> -   ${RM} ${WRKSRC}/go.mod
> -   cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${BUILD_ENV} GOPATH=${WRKSRC} 
> go build
> -
> -do-install:
> -   ${INSTALL_PROGRAM} ${WRKSRC}/antibody-${PORTVERSION} 
> ${STAGEDIR}${PREFIX}/bin/antibody
> +GO_PKGNAME=github.com/getantibody/antibody
> +MAKE_ENV+= GOFLAGS=-mod=vendor
>
>  .include 
>
> It looks much more complicated than it is. In GH_TUPLE replace src with 
> vendor to have the dependencies in the path where go will look for. Add 
> GOFLAGS=-mod=vendor to force go to use the sources it finds there and ignore 
> go.mod/go.sum And last but not least set GO_PKGNAME and let our Uses/go.mk do 
> the magic.

Wow, I had no idea about any of this!

Please, can you add a Wiki page for how to do Go ports? Or send some
text (even in plain text format) to the doc team and they can format
it for the PHB.

# Adam


-- 
Adam Weinberger
ad...@adamw.org
https://www.adamw.org
___
freebsd-ports@freebsd.org mailing 

Re: How to handle go dependencies

2019-06-22 Thread Adam Weinberger
On Sat, Jun 22, 2019 at 11:10 AM Bernhard Froehlich  wrote:
>
>
> Am 22.06.2019 17:56 schrieb Adam Weinberger :
> >
> > On Sat, Jun 22, 2019 at 8:21 AM Danilo G. Baio  wrote:
> > >
> > > On Sat, Jun 22, 2019 at 11:58:49AM +0200, Matthias Fechner wrote:
> > > > Dear all,
> > > >
> > > > I just prepare the gitlab-ce upgrade to version 12.0.0.
> > > > But I have some problem with a package that uses go to compile.
> > > >
> > > > The new version of devel/gitaly has changed the way the package is 
> > > > defined.
> > > > They removed now all files from the vendor/ folder and add dependencies
> > > > in a `go.mod` file.
> > > >
> > > > If I now build the port it tries to fetch the files while no network
> > > > access is allowed.
> > > >
> > > > What is the correct way to getting these dependencies fetched and
> > > > correctly included into the work-source in the fetch step using go?
> > > >
> > > > Thanks a lot!
> > > >
> > > > Gruß
> > > > Matthias
> > > >
> > >
> > > Try this and remove the go.mod file
> > >
> > > ports-mgmt/modules2tuple
> > > https://github.com/dmgk/modules2tuple
> > >
> > > Examples:
> > > net/geoipupdate
> > > shells/antibody
> >
> > Just a note here, both those ports are mine, and I have no idea if
> > that's the right thing to do; it built right so I did it. I don't
> > understand Go packaging at all, and I'd sure appreciate someone with
> > Go knowledge verifying whether removing go.mod is the proper thing to
> > do.
>
> The correct magic that you are searching is:
>
> MAKE_ENV+= GOFLAGS=-mod=vendor
>
> (like it is used in mail/smtprelay)

With that I still get:

$GOPATH/go.mod exists but should not
*** Error code 1

Stop.

# Adam


-- 
Adam Weinberger
ad...@adamw.org
https://www.adamw.org
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-06-22 Thread Adam Weinberger
On Sat, Jun 22, 2019 at 8:21 AM Danilo G. Baio  wrote:
>
> On Sat, Jun 22, 2019 at 11:58:49AM +0200, Matthias Fechner wrote:
> > Dear all,
> >
> > I just prepare the gitlab-ce upgrade to version 12.0.0.
> > But I have some problem with a package that uses go to compile.
> >
> > The new version of devel/gitaly has changed the way the package is defined.
> > They removed now all files from the vendor/ folder and add dependencies
> > in a `go.mod` file.
> >
> > If I now build the port it tries to fetch the files while no network
> > access is allowed.
> >
> > What is the correct way to getting these dependencies fetched and
> > correctly included into the work-source in the fetch step using go?
> >
> > Thanks a lot!
> >
> > Gruß
> > Matthias
> >
>
> Try this and remove the go.mod file
>
> ports-mgmt/modules2tuple
> https://github.com/dmgk/modules2tuple
>
> Examples:
> net/geoipupdate
> shells/antibody

Just a note here, both those ports are mine, and I have no idea if
that's the right thing to do; it built right so I did it. I don't
understand Go packaging at all, and I'd sure appreciate someone with
Go knowledge verifying whether removing go.mod is the proper thing to
do.

# Adam


-- 
Adam Weinberger
ad...@adamw.org
https://www.adamw.org
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: How to handle go dependencies

2019-06-22 Thread Danilo G. Baio
On Sat, Jun 22, 2019 at 11:58:49AM +0200, Matthias Fechner wrote:
> Dear all,
> 
> I just prepare the gitlab-ce upgrade to version 12.0.0.
> But I have some problem with a package that uses go to compile.
> 
> The new version of devel/gitaly has changed the way the package is defined.
> They removed now all files from the vendor/ folder and add dependencies
> in a `go.mod` file.
> 
> If I now build the port it tries to fetch the files while no network
> access is allowed.
> 
> What is the correct way to getting these dependencies fetched and
> correctly included into the work-source in the fetch step using go?
> 
> Thanks a lot!
> 
> Gruß
> Matthias
> 

Try this and remove the go.mod file

ports-mgmt/modules2tuple
https://github.com/dmgk/modules2tuple

Examples:
net/geoipupdate
shells/antibody

Regards.
-- 
Danilo G. Baio (dbaio)


signature.asc
Description: PGP signature


Re: How to handle go dependencies

2019-06-22 Thread Eugene Grosbein
22.06.2019 16:58, Matthias Fechner wrote:

> Dear all,
> 
> I just prepare the gitlab-ce upgrade to version 12.0.0.
> But I have some problem with a package that uses go to compile.
> 
> The new version of devel/gitaly has changed the way the package is defined.
> They removed now all files from the vendor/ folder and add dependencies
> in a `go.mod` file.
> 
> If I now build the port it tries to fetch the files while no network
> access is allowed.
> 
> What is the correct way to getting these dependencies fetched and
> correctly included into the work-source in the fetch step using go?

That's not easy question. You may find it useful to check out
existing port sysutils/fusefs-webdavfs that successfully deals
with several dependencies located at Github (pborman/getopt and bazil/fuse).

Tricky part is in the post-patch: target of port's Makefile
that creates ${GETOPT_WRKSRCDIR} and ${FUSE_WRKSRCDIR} directories
and symlinks real paths for extracted dependencies into needed names
under ${GETOPT_WRKSRCDIR} and ${FUSE_WRKSRCDIR}.

Another dependency "golang.org/x/net/context" was integrated into golang itself
as "context" since go-1.7 so the port uses REINPLACE_CMD to patch the name in 
source files.

___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


How to handle go dependencies

2019-06-22 Thread Matthias Fechner
Dear all,

I just prepare the gitlab-ce upgrade to version 12.0.0.
But I have some problem with a package that uses go to compile.

The new version of devel/gitaly has changed the way the package is defined.
They removed now all files from the vendor/ folder and add dependencies
in a `go.mod` file.

If I now build the port it tries to fetch the files while no network
access is allowed.

What is the correct way to getting these dependencies fetched and
correctly included into the work-source in the fetch step using go?

Thanks a lot!

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook




signature.asc
Description: OpenPGP digital signature