Skip to content

Commit cb005b7

Browse files
committed
Download release tarball from hoster if available
just like what uscan would do with our default debian/watch file, instead of generating our own tarball from downloaded Git repository. GitHub and GitLab are currently supported.
1 parent d4a568d commit cb005b7

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

make.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,24 @@ func (u *upstream) tar(gopath, repo string) error {
166166
}
167167
u.tarPath = f.Name()
168168
f.Close()
169+
170+
if u.isRelease {
171+
if u.hasGodeps {
172+
log.Printf("Godeps/_workspace exists, not downloading tarball from hoster.")
173+
} else {
174+
u.compression = "gz"
175+
err := u.tarballFromHoster(repo)
176+
if err != nil && err.Error() == "Unsupported hoster" {
177+
log.Printf("INFO: Hoster does not provide release tarball\n")
178+
} else {
179+
return err
180+
}
181+
}
182+
}
183+
184+
u.compression = "xz"
169185
base := filepath.Base(repo)
186+
log.Printf("Generating temp tarball as %q\n", u.tarPath)
170187
dir := filepath.Dir(repo)
171188
cmd := exec.Command(
172189
"tar",
@@ -818,7 +835,8 @@ func execMake(args []string, usage func()) {
818835
debbin, debbin)
819836
}
820837

821-
orig := fmt.Sprintf("%s_%s.orig.tar.xz", debsrc, u.version)
838+
orig := fmt.Sprintf("%s_%s.orig.tar.%s", debsrc, u.version, u.compression)
839+
log.Printf("Moving tempfile to %q\n", orig)
822840
// We need to copy the file, merely renaming is not enough since the file
823841
// might be on a different filesystem (/tmp often is a tmpfs).
824842
if err := copyFile(u.tarPath, orig); err != nil {

0 commit comments

Comments
 (0)