Browse Source

fix(travis): fixes from the third_party.go merge

Brandon Philips 12 years ago
parent
commit
56909bb6a3
2 changed files with 11 additions and 25 deletions
  1. 3 5
      .travis.yml
  2. 8 20
      third_party.go

+ 3 - 5
.travis.yml

@@ -4,10 +4,8 @@ go: 1.2
 install:
  - echo "Skip install"
 
+before_script:
+ - ./build
+
 script:
  - ./test.sh
-
-# temporarily fix Travis
-env:
-  global:
-      - TRAVIS_BUILD_DIR=/home/travis/build/coreos/etcd

+ 8 - 20
third_party.go

@@ -64,13 +64,11 @@ func binDir() string {
 	return path.Join(root, "bin")
 }
 
-// runEnv execs a command like a shell script piping everything to the parent's
+// run execs a command like a shell script piping everything to the parent's
 // stderr/stdout and uses the given environment.
-func runEnv(env []string, name string, arg ...string) *os.ProcessState {
+func run(name string, arg ...string) *os.ProcessState {
 	cmd := exec.Command(name, arg...)
 
-	cmd.Env = env
-
 	stdout, err := cmd.StdoutPipe()
 	if err != nil {
 		fmt.Fprintf(os.Stderr, err.Error())
@@ -93,16 +91,6 @@ func runEnv(env []string, name string, arg ...string) *os.ProcessState {
 	return cmd.ProcessState
 }
 
-// run calls runEnv with the GOPATH third_party packages.
-func run(name string, arg ...string) *os.ProcessState {
-	env := append(os.Environ(),
-		"GOPATH="+thirdPartyDir(),
-		"GOBIN="+binDir(),
-	)
-
-	return runEnv(env, name, arg...)
-}
-
 // setupProject does the initial setup of the third_party src directory
 // including setting up the symlink to the cwd from the src directory.
 func setupProject(pkg string) {
@@ -255,11 +243,8 @@ func bump(pkg, version string) {
 	}
 	defer os.RemoveAll(temp)
 
-	env := append(os.Environ(),
-		"GOPATH="+temp,
-	)
-
-	runEnv(env, "go", "get", "-u", "-d", pkg)
+	os.Setenv("GOPATH", temp)
+	run("go", "get", "-u", "-d", pkg)
 
 	for {
 		root := path.Join(temp, "src", pkg) // the temp installation root
@@ -308,7 +293,6 @@ func bump(pkg, version string) {
 // This is used by the bumpAll walk to bump all of the existing packages.
 func validPkg(pkg string) bool {
 	env := append(os.Environ(),
-		"GOPATH="+thirdPartyDir(),
 	)
 	cmd := exec.Command("go", "list", pkg)
 	cmd.Env = env
@@ -362,6 +346,10 @@ func bumpAll() {
 func main() {
 	log.SetFlags(0)
 
+	// third_party manages GOPATH, no one else
+	os.Setenv("GOPATH", thirdPartyDir())
+	os.Setenv("GOBIN", binDir())
+
 	if len(os.Args) <= 1 {
 		log.Fatalf("No command")
 	}