Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug with dh-make-golang estimate: src/ folder does not exists #159

Open
pymnh opened this issue Mar 19, 2021 · 8 comments
Open

bug with dh-make-golang estimate: src/ folder does not exists #159

pymnh opened this issue Mar 19, 2021 · 8 comments
Labels
Milestone

Comments

@pymnh
Copy link
Contributor

pymnh commented Mar 19, 2021

When running dh-make-golang estimate github.com/caddyserver/caddy, it will fail shortly with the following error:

2021/03/19 11:43:14 lstat /tmp/dh-make-golang225762394/src: no such file or directory

The problem as it seems to me is that go get does not download the source files to src/, but instead everything lands in pkg/mod. I understand the change in the download directory was introduced in v1.12 and is default as of v1.13, see here: golang/go#31529

I can reproduce the error with GO111MODULE set to off, on and auto. I am using ubuntu 20.10 with go v. 1.14 and can reproduce the error with both dh-make-golang v0.3.3 and v0.4.0

On debian buster with go v. 1.11 dh-make-golang estimate github.com/caddyserver/caddy seems to run fine (but will eventually fail because of a missing core library that the package depends on but that was indroduced with go v1.13 😞).

@pymnh
Copy link
Contributor Author

pymnh commented Mar 19, 2021

The error does not occur with these little changes applied:

diff --git a/estimate.go b/estimate.go
index 5d10cf5..7d5e782 100644
--- a/estimate.go
+++ b/estimate.go
@@ -19,7 +19,7 @@ import (
 func get(gopath, repo string) error {
 	done := make(chan struct{})
 	defer close(done)
-	go progressSize("go get", filepath.Join(gopath, "src"), done)
+	go progressSize("go get", filepath.Join(gopath, "pkg", "mod"), done)
 
 	// As per https://groups.google.com/forum/#!topic/golang-nuts/N5apfenE4m4,
 	// the arguments to “go get” are packages, not repositories. Hence, we
@@ -37,7 +37,7 @@ func get(gopath, repo string) error {
 }
 
 func removeVendor(gopath string) (found bool, _ error) {
-	err := filepath.Walk(filepath.Join(gopath, "src"), func(path string, info os.FileInfo, err error) error {
+	err := filepath.Walk(filepath.Join(gopath, "pkg", "mod"), func(path string, info os.FileInfo, err error) error {
 		if err != nil {
 			return err
 		}

However, instead it will fail only shortly after, with the following error.

2021/03/19 13:13:54 unlinkat /tmp/dh-make-golang889617655/pkg/mod/github.com/cpuguy83/go-md2man/v2@v2.0.0/vendor/modules.txt: permission denied

I am unsure if it is at all related, or an issue of its own.

The file permissions for /tmp/dh-make-golang889617655/pkg/mod/github.com/cpuguy83/go-md2man/v2@v2.0.0/vendor/modules.txt are set to 444/readonly, I understand this is usual: golang/go#27161

@creekorful
Copy link
Member

When packaging Debian library it is common practice to be on Debian unstable (sid) and install dh-make-golang using APT, so you are sure to have the latest up-to-date dependencies installed. Maybe you can try again in a VM for example?

@pymnh
Copy link
Contributor Author

pymnh commented Mar 19, 2021

I can reproduce the error on an up-to-date debian sid, with dh-make-golang installed from the repos.

@creekorful
Copy link
Member

What's the output of go version on your debian/sid?

@pymnh
Copy link
Contributor Author

pymnh commented Mar 19, 2021

% go version
go version go1.15.9 linux/amd64

@creekorful
Copy link
Member

That's definitely strange. I'm running dh-make-golang v0.4.0 with go 1.15.9 and I haven't face the same issue as you. Can you maybe try to run estimate on another repository and see if it works?

creekorful@debuild:~$ dh-make-golang estimate github.com/creekorful/direktion
2021/03/19 20:53:20 Bringing github.com/creekorful/direktion to Debian requires packaging the following Go packages:
github.com/creekorful/direktion

for example.

@pymnh
Copy link
Contributor Author

pymnh commented Mar 19, 2021

i picked two random ITPs from wnpp.debian.net, getting mixed results:

% dh-make-golang estimate github.com/mattbaird/elastigo
2021/03/19 21:15:56 Bringing github.com/mattbaird/elastigo to Debian requires packaging the following Go packages:
github.com/mattbaird/elastigo
    github.com/bitly/go-hostpool
% dh-make-golang estimate github.com/cli/cli 
go get: 0.00 KiBgo: downloading github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/itchyny/gojq v0.12.1
go: downloading github.com/henvic/httpretty v0.0.6
go: downloading github.com/cli/safeexec v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
go: downloading github.com/cli/shurcooL-graphql v0.0.0-20200707151639-0f7232a2bf7e
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: downloading github.com/stretchr/testify v1.6.1
go: downloading github.com/AlecAivazis/survey/v2 v2.2.7
go: downloading golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
go: downloading github.com/google/go-cmp v0.5.2
go: downloading github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
go: downloading github.com/shurcooL/githubv4 v0.0.0-20200928013246-d292edc3691b
go get: 0.00 KiBgo: downloading github.com/MakeNowJust/heredoc v1.0.0
go: downloading github.com/muesli/termenv v0.7.4
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/enescakir/emoji v1.0.0
go: downloading github.com/itchyny/timefmt-go v0.1.1
go: downloading golang.org/x/text v0.3.4
go get: 0.00 KiBgo: downloading github.com/itchyny/astgen-go v0.0.0-20210113000433-0da0671862a3
go: downloading github.com/cli/oauth v0.8.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading golang.org/x/net v0.0.0-20200707034311-ab3426394381
go: downloading golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78
go: downloading github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
go: downloading github.com/spf13/cobra v1.1.1
go: downloading github.com/lucasb-eyer/go-colorful v1.0.3
go: downloading github.com/rivo/uniseg v0.1.0
go get: 0.00 KiBgo: downloading github.com/charmbracelet/glamour v0.2.1-0.20200724174618-1246d13c1684
go: downloading github.com/pmezard/go-difflib v1.0.0
go get: 0.00 KiBgo: downloading github.com/hashicorp/go-version v1.2.1
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/briandowns/spinner v1.11.1
go get: 0.00 KiBgo: downloading github.com/cli/browser v1.0.0
go get: 0.00 KiBgo: downloading github.com/inconshreveable/mousetrap v1.0.0
go: downloading github.com/mattn/go-runewidth v0.0.9
go get: 0.00 KiBgo: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0
go: downloading github.com/yuin/goldmark v1.2.0
go get: 0.00 KiBgo: downloading github.com/fatih/color v1.7.0
go: downloading github.com/olekukonko/tablewriter v0.0.4
go: downloading github.com/muesli/reflow v0.1.0
go get: 0.00 KiBgo: downloading github.com/russross/blackfriday/v2 v2.0.1
go: downloading github.com/microcosm-cc/bluemonday v1.0.2
go: downloading github.com/alecthomas/chroma v0.7.3
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go get: 0.00 KiBgo: downloading github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
go: downloading github.com/dlclark/regexp2 v1.2.0
2021/03/19 21:17:44 lstat /tmp/dh-make-golang001898671/src: no such file or directory

@sab-regime
Copy link

sab-regime commented Apr 20, 2021

**```

  • #> ~~~~

@anthonyfok anthonyfok added the bug label Mar 22, 2024
@anthonyfok anthonyfok added this to the v0.8.0 milestone Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants