Skip to content

Commit 75e029d

Browse files
committed
build, travis: use ephemeral debsrc GOPATH to get mod deps
1 parent f8790b9 commit 75e029d

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

‎.travis.yml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ jobs:
9191
- python-bzrlib
9292
- python-paramiko
9393
script:
94-
# Fake building locally to download all the go module dependencies
95-
- go install -n ./...
96-
97-
# Assemble the sources, dependencies and Go SDK into a deb source and upload to Launchpad
9894
- echo '|1|7SiYPr9xl3uctzovOTj4gMwAC1M=|t6ReES75Bo/PxlOPJ6/GsGbTrM0= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0aKz5UTUndYgIGG7dQBV+HaeuEZJ2xPHo2DS2iSKvUL4xNMSAY4UguNW+pX56nAQmZKIZZ8MaEvSj6zMEDiq6HFfn5JcTlM80UwlnyKe8B8p7Nk06PPQLrnmQt5fh0HmEcZx+JU9TZsfCHPnX7MNz4ELfZE6cFsclClrKim3BHUIGq//t93DllB+h4O9LHjEUsQ1Sr63irDLSutkLJD6RXchjROXkNirlcNVHH/jwLWR5RcYilNX7S5bIkK8NlWPjsn/8Ua5O7I9/YoE97PpO6i73DTGLh5H9JN/SITwCKBkgSDWUt61uPK3Y11Gty7o2lWsBjhBUm2Y38CBsoGmBw==' >> ~/.ssh/known_hosts
9995
- go run build/ci.go debsrc -goversion 1.13.4 -upload ethereum/ethereum -sftp-user geth-ci -signer "Go Ethereum Linux Builder <geth-ci@ethereum.org>"
10096

‎build/ci.go‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import (
4646
"encoding/base64"
4747
"flag"
4848
"fmt"
49-
gobuild "go/build"
5049
"go/parser"
5150
"go/token"
5251
"io/ioutil"
@@ -502,6 +501,11 @@ func doDebianSource(cmdline []string) {
502501
// Download and verify the Go source package.
503502
gobundle := downloadGoSources(*goversion, *cachedir)
504503

504+
// Download all the dependencies needed to build the sources
505+
depfetch := goTool("install", "-n", "./...")
506+
depfetch.Env = append(os.Environ(), "GOPATH="+filepath.Join(*workdir, "modgopath"))
507+
build.MustRun(depfetch)
508+
505509
// Create Debian packages and upload them.
506510
for _, pkg := range debPackages {
507511
for distro, goboot := range debDistroGoBoots {
@@ -517,7 +521,8 @@ func doDebianSource(cmdline []string) {
517521
log.Fatalf("Failed to rename Go source folder: %v", err)
518522
}
519523
// Add all dependency modules in compressed form
520-
if err := cp.CopyAll(filepath.Join(pkgdir, ".mod", "cache", "download"), filepath.Join(gobuild.Default.GOPATH, "pkg", "mod", "cache", "download")); err != nil {
524+
os.MkdirAll(filepath.Join(pkgdir, ".mod", "cache"), 0755)
525+
if err := cp.CopyAll(filepath.Join(pkgdir, ".mod", "cache", "download"), filepath.Join(*workdir, "modgopath", "pkg", "mod", "cache", "download")); err != nil {
521526
log.Fatalf("Failed to copy Go module dependencies: %v", err)
522527
}
523528
// Run the packaging and upload to the PPA
@@ -1067,16 +1072,11 @@ func doXgo(cmdline []string) {
10671072

10681073
func xgoTool(args []string) *exec.Cmd {
10691074
cmd := exec.Command(filepath.Join(GOBIN, "xgo"), args...)
1070-
cmd.Env = []string{
1075+
cmd.Env = os.Environ()
1076+
cmd.Env = append(cmd.Env, []string{
10711077
"GOPATH=" + build.GOPATH(),
10721078
"GOBIN=" + GOBIN,
1073-
}
1074-
for _, e := range os.Environ() {
1075-
if strings.HasPrefix(e, "GOPATH=") || strings.HasPrefix(e, "GOBIN=") {
1076-
continue
1077-
}
1078-
cmd.Env = append(cmd.Env, e)
1079-
}
1079+
}...)
10801080
return cmd
10811081
}
10821082

0 commit comments

Comments
 (0)