Debian / dh-make-golang

Automatically creates Debian packaging for Go packages
BSD 3-Clause "New" or "Revised" License
378 stars 76 forks source link

Have an option to determine recursive package dependencies. #89

Open rajudev opened 6 years ago

rajudev commented 6 years ago

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

stapelberg commented 6 years ago

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.

rajudev commented 6 years ago

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.

stapelberg commented 6 years ago

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.

rajudev commented 6 years ago

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.

stapelberg commented 6 years ago

The estimate command is ready to use.

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

rajudev commented 6 years ago

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 commented 6 years ago

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
stapelberg commented 6 years ago

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 commented 6 years ago

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

rajudev commented 6 years ago

@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.

ramantehlan commented 5 years ago

@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.

eenagy commented 1 year ago

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
gibmat commented 1 year ago

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.