|
|
|
@ -136,10 +136,18 @@ var ( |
|
|
|
|
"golang-go": "/usr/lib/go", |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// This is the version of go that will be downloaded by
|
|
|
|
|
// This is the version of Go that will be downloaded by
|
|
|
|
|
//
|
|
|
|
|
// go run ci.go install -dlgo
|
|
|
|
|
dlgoVersion = "1.20.1" |
|
|
|
|
|
|
|
|
|
// This is the version of Go that will be used to bootstrap the PPA builder.
|
|
|
|
|
//
|
|
|
|
|
// This version is fine to be old and full of security holes, we just use it
|
|
|
|
|
// to build the latest Go. Don't change it. If it ever becomes infufficient,
|
|
|
|
|
// we need to switch over to a recursive builder to jumpt across supported
|
|
|
|
|
// versions.
|
|
|
|
|
gobootVersion = "1.19" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin")) |
|
|
|
@ -655,10 +663,11 @@ func doDebianSource(cmdline []string) { |
|
|
|
|
gpg.Stdin = bytes.NewReader(key) |
|
|
|
|
build.MustRun(gpg) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Download and verify the Go source package.
|
|
|
|
|
gobundle := downloadGoSources(*cachedir) |
|
|
|
|
|
|
|
|
|
// Download and verify the Go source packages.
|
|
|
|
|
var ( |
|
|
|
|
gobootbundle = downloadGoBootstrapSources(*cachedir) |
|
|
|
|
gobundle = downloadGoSources(*cachedir) |
|
|
|
|
) |
|
|
|
|
// Download all the dependencies needed to build the sources and run the ci script
|
|
|
|
|
srcdepfetch := tc.Go("mod", "download") |
|
|
|
|
srcdepfetch.Env = append(srcdepfetch.Env, "GOPATH="+filepath.Join(*workdir, "modgopath")) |
|
|
|
@ -675,12 +684,19 @@ func doDebianSource(cmdline []string) { |
|
|
|
|
meta := newDebMetadata(distro, goboot, *signer, env, now, pkg.Name, pkg.Version, pkg.Executables) |
|
|
|
|
pkgdir := stageDebianSource(*workdir, meta) |
|
|
|
|
|
|
|
|
|
// Add Go source code
|
|
|
|
|
// Add bootstrapper Go source code
|
|
|
|
|
if err := build.ExtractArchive(gobootbundle, pkgdir); err != nil { |
|
|
|
|
log.Fatalf("Failed to extract bootstrapper Go sources: %v", err) |
|
|
|
|
} |
|
|
|
|
if err := os.Rename(filepath.Join(pkgdir, "go"), filepath.Join(pkgdir, ".goboot")); err != nil { |
|
|
|
|
log.Fatalf("Failed to rename bootstrapper Go source folder: %v", err) |
|
|
|
|
} |
|
|
|
|
// Add builder Go source code
|
|
|
|
|
if err := build.ExtractArchive(gobundle, pkgdir); err != nil { |
|
|
|
|
log.Fatalf("Failed to extract Go sources: %v", err) |
|
|
|
|
log.Fatalf("Failed to extract builder Go sources: %v", err) |
|
|
|
|
} |
|
|
|
|
if err := os.Rename(filepath.Join(pkgdir, "go"), filepath.Join(pkgdir, ".go")); err != nil { |
|
|
|
|
log.Fatalf("Failed to rename Go source folder: %v", err) |
|
|
|
|
log.Fatalf("Failed to rename builder Go source folder: %v", err) |
|
|
|
|
} |
|
|
|
|
// Add all dependency modules in compressed form
|
|
|
|
|
os.MkdirAll(filepath.Join(pkgdir, ".mod", "cache"), 0755) |
|
|
|
@ -709,6 +725,19 @@ func doDebianSource(cmdline []string) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// downloadGoBootstrapSources downloads the Go source tarball that will be used
|
|
|
|
|
// to bootstrap the builder Go.
|
|
|
|
|
func downloadGoBootstrapSources(cachedir string) string { |
|
|
|
|
csdb := build.MustLoadChecksums("build/checksums.txt") |
|
|
|
|
file := fmt.Sprintf("go%s.src.tar.gz", gobootVersion) |
|
|
|
|
url := "https://dl.google.com/go/" + file |
|
|
|
|
dst := filepath.Join(cachedir, file) |
|
|
|
|
if err := csdb.DownloadFile(url, dst); err != nil { |
|
|
|
|
log.Fatal(err) |
|
|
|
|
} |
|
|
|
|
return dst |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// downloadGoSources downloads the Go source tarball.
|
|
|
|
|
func downloadGoSources(cachedir string) string { |
|
|
|
|
csdb := build.MustLoadChecksums("build/checksums.txt") |
|
|
|
|