From 56909bb6a3e50327cea339406c4890ad8e775e49 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Tue, 14 Jan 2014 22:22:19 -0800 Subject: [PATCH] fix(travis): fixes from the third_party.go merge --- .travis.yml | 8 +++----- third_party.go | 28 ++++++++-------------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4162c48c5..23c73823c 100644 --- a/.travis.yml +++ b/.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 diff --git a/third_party.go b/third_party.go index 4cc053c65..6c4bc9971 100644 --- a/third_party.go +++ b/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") }