Skip to content

Commit 99a2380

Browse files
committed
Unvendor packages unconditionally.
Fixes #46
1 parent be72733 commit 99a2380

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

make.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,29 @@ func makeUpstreamSourceTarball(gopkg string) (string, string, map[string]bool, s
125125
log.Printf("WARNING: ignoring debian/ directory that came with the upstream sources\n")
126126
}
127127

128+
vendorpath := filepath.Join(tempdir, "src", gopkg, "vendor")
129+
130+
if _, err := os.Stat(vendorpath); err == nil {
131+
files, _ := filepath.Glob(filepath.Join(vendorpath, "*.go"))
132+
if len(files) == 0 {
133+
log.Printf("WARNING: ignoring vendor/ directory that came with the upstream sources, and reinstalling dependencies\n")
134+
os.RemoveAll(vendorpath)
135+
go progressSize("go get", filepath.Join(tempdir, "src"), done)
136+
cmd := exec.Command("go", "get", "-d", "-t", "./...")
137+
cmd.Stderr = os.Stderr
138+
cmd.Env = append([]string{
139+
fmt.Sprintf("GOPATH=%s", tempdir),
140+
}, passthroughEnv()...)
141+
cmd.Dir = filepath.Join(tempdir, "src", gopkg)
142+
if err := cmd.Run(); err != nil {
143+
done <- true
144+
return "", "", dependencies, autoPkgType, err
145+
}
146+
done <- true
147+
fmt.Printf("\r")
148+
}
149+
}
150+
128151
f, err := ioutil.TempFile("", "dh-make-golang")
129152
tempfile := f.Name()
130153
f.Close()
@@ -136,7 +159,6 @@ func makeUpstreamSourceTarball(gopkg string) (string, string, map[string]bool, s
136159
tempfile,
137160
"--exclude-vcs",
138161
"--exclude=Godeps",
139-
"--exclude=vendor",
140162
fmt.Sprintf("--exclude=%s/debian", base),
141163
base)
142164
cmd.Dir = filepath.Join(tempdir, "src", dir)

0 commit comments

Comments
 (0)