dh-make-golang icon indicating copy to clipboard operation
dh-make-golang copied to clipboard

Have an option to determine recursive package dependencies.

Open rajudev opened this issue 7 years ago • 13 comments

While running dh-make-golang <package-name> , we get a list of dependencies which are still not in Debian. Then we have to do the same thing for all the dependencies and there sub-dependencies on multiple hierarchies manually.

It would be great if dh-make-golang has an optional flag, may be -r or something like --recursive-dependencies so that it can generate the whole dependency tree.

A simple text hierarchical output of the dependency tree is fine as well. The functionality can be further enhanced to provide an image file of the dependency tree, some thing like this

rajudev avatar Feb 04 '18 19:02 rajudev

Implemented the estimate command, which should do the trick. Leaving this issue open until -git_revision is supported. Issue #88 is a somewhat related usability improvement.

stapelberg avatar Feb 15 '18 22:02 stapelberg

Like, already. I was planning to start working on this.

Anyways, it would have taken me ages. Glad you implemented it. Will test the functionality in sometime.

rajudev avatar Feb 16 '18 08:02 rajudev

dh-make-golang estimate github.com/jinzhu/gorm doesn’t list the test-only dependency github.com/erikstmartin/go-testdb (packaged in golang-github-erikstmartin-go-testdb-dev).

I think we’ll need to add TestImports and XTestImports to the go list template.

stapelberg avatar Feb 18 '18 19:02 stapelberg

Is the go estimate <package-name> reliable for use now? Also while estimating dependencies for a package. I just got a list of packaged and un-packaged dependencies, instead of the tree graph that we planned. A list just gets which packages are not yet done, without letting me know which package depends on what. Am I missing something, or that is yet to be implemented.

rajudev avatar Apr 05 '18 05:04 rajudev

The estimate command is ready to use.

Which package are you running this on that a tree is required instead of a list?

stapelberg avatar Apr 05 '18 06:04 stapelberg

Well running it for http://github.com/zyedidia/micro It has dependencies and dependencies has there own dependencies . I have already determined the dependency tree manually. It is just that I am testing the estimate option if it could have saved me the manual work.

rajudev avatar Apr 05 '18 07:04 rajudev

Using the estimate command complains for the digraph tool not being present. May be we should add golang-golang-x-tools as a dependency for dh-make-golang in control.

rajudev@5658cb08429d:~/dev/salsa.debian.org$ dh-make-golang estimate github.com/Debian/dh-make-golang
/bin/sh: 1: digraph: not found
2018/04/06 05:27:50 [/bin/sh -c go list -f '{{.ImportPath}}{{.Imports}}{{.TestImports}}{{.XTestImports}}' ... | tr '[]' ' ' | digraph forward $(go list github.com/Debian/dh-make-golang/...)]: exit status 127

rajudev avatar Apr 06 '18 05:04 rajudev

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898396 is another example for a rather complicated dependency tree. We should likely display the tree as an indented list at least.

stapelberg avatar May 14 '18 21:05 stapelberg

Commit 55a1fa2dd408a7a4d98d1189b4582e2a9e12567c implements printing an indented tree. Hope that helps.

stapelberg avatar Jun 24 '18 15:06 stapelberg

@stapelberg thanks a lot for all the work you have done for enabling this feature. The indented lists is fine and it works nicely. I'll work on it in future to add support for tree style outputs.

rajudev avatar Jun 26 '18 13:06 rajudev

@rajudev @stapelberg Hey, I just created this tool GoCheckDeb and golang package github.com/ramantehlan/GoCheckDeb/pkg/gocheckdeb/gocheckdeb.go to address this issue.

This package can return, Graph, Tree and List of Go project dependencies, with tags of whether it is packaged in Debian or not. It also has some other minor features which some people might like.

ramantehlan avatar Apr 22 '19 06:04 ramantehlan

I'm getting some errors around the estimate command with github.com/russross/blackfriday/v2

dh-make-golang estimate github.com/ethereum/go-ethereum
go get: 3.36 GiBpackage github.com/ethereum/go-ethereum/cmd/abigen: cannot find package "github.com/urfave/cli/v2" in any of:
	/usr/lib/go-1.19/src/github.com/urfave/cli/v2 (from $GOROOT)
	/tmp/dh-make-golang4192342632/src/github.com/urfave/cli/v2 (from $GOPATH)
go get: 3.37 GiBpackage github.com/ethereum/go-ethereum/cmd/abigen: cannot find package "github.com/golang-jwt/jwt/v4" in any of:
	/usr/lib/go-1.19/src/github.com/golang-jwt/jwt/v4 (from $GOROOT)
	/tmp/dh-make-golang4192342632/src/github.com/golang-jwt/jwt/v4 (from $GOPATH)
go get: 3.38 GiBpackage github.com/ethereum/go-ethereum/cmd/abigen
	imports github.com/influxdata/line-protocol: no Go files in /tmp/dh-make-golang4192342632/src/github.com/influxdata/line-protocol
go get: 3.74 GiBpackage github.com/ethereum/go-ethereum/cmd/abigen: cannot find package "github.com/flosch/pongo2/v4" in any of:
	/usr/lib/go-1.19/src/github.com/flosch/pongo2/v4 (from $GOROOT)
	/tmp/dh-make-golang4192342632/src/github.com/flosch/pongo2/v4 (from $GOPATH)
go get: 3.74 GiBpackage github.com/ethereum/go-ethereum/cmd/abigen: cannot find package "github.com/russross/blackfriday/v2" in any of:
	/usr/lib/go-1.19/src/github.com/russross/blackfriday/v2 (from $GOROOT)
	/tmp/dh-make-golang4192342632/src/github.com/russross/blackfriday/v2 (from $GOPATH)
2023/09/02 02:16:44 estimate: go get: exit status 1

eniko1556 avatar Sep 02 '23 02:09 eniko1556

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050523; it appears that something in go 1.21 has broken this, but I haven't dug into it very much.

gibmat avatar Sep 02 '23 12:09 gibmat