From 63365376dbf845e7479f29d363685d84a8137b1f Mon Sep 17 00:00:00 2001 From: Chris Manghane Date: Wed, 2 Oct 2013 15:56:27 -0700 Subject: [PATCH] go.tools/dashboard: Don't keep unversioned directories in gcc copy. `svn update` would fail if the updated files were in the gcc/libgo or gcc/go/gofrontend because unrevisioned versions of those files had been inserted in the last build of gcc. R=adg, adg CC=golang-dev https://golang.org/cl/14299043 --- dashboard/builder/env.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dashboard/builder/env.go b/dashboard/builder/env.go index 94b4c23e..3c79bfd4 100644 --- a/dashboard/builder/env.go +++ b/dashboard/builder/env.go @@ -133,6 +133,8 @@ type gccgoEnv struct{} func (env *gccgoEnv) setup(repo *Repo, workpath, hash string, envv []string) (string, error) { gofrontendpath := filepath.Join(workpath, "gofrontend") gccpath := filepath.Join(repo.Path, "gcc") + gccgopath := filepath.Join(gccpath, "gcc", "go", "gofrontend") + gcclibgopath := filepath.Join(gccpath, "libgo") // get a handle to SVN vcs.Cmd for pulling down GCC. svn := vcs.ByCmd("svn") @@ -145,6 +147,15 @@ func (env *gccgoEnv) setup(repo *Repo, workpath, hash string, envv []string) (st }); err != nil { return "", err } + } else { + // make sure to remove gccgopath and gcclibgopath before + // updating the repo to avoid file clobbering. + if err := os.RemoveAll(gccgopath); err != nil { + return "", err + } + if err := os.RemoveAll(gcclibgopath); err != nil { + return "", err + } } if err := svn.Download(gccpath); err != nil { return "", err @@ -155,9 +166,7 @@ func (env *gccgoEnv) setup(repo *Repo, workpath, hash string, envv []string) (st return "", err } - // remove gccpath/gcc/go/gofrontend and gcc/libgo - gccgopath := filepath.Join(gccpath, "gcc", "go", "gofrontend") - gcclibgopath := filepath.Join(gccpath, "libgo") + // remove gccgopath and gcclibgopath before copying over gofrontend. if err := os.RemoveAll(gccgopath); err != nil { return "", err } @@ -191,7 +200,6 @@ func (env *gccgoEnv) setup(repo *Repo, workpath, hash string, envv []string) (st } return gccobjdir, nil - } // copyDir copies the src directory into the dst