From b25f3012f3d43ee1c6d4af40423bdf9e4017a1fc Mon Sep 17 00:00:00 2001 From: Chris Manghane Date: Tue, 24 Sep 2013 16:08:25 -0700 Subject: [PATCH] go.tools/dashboard/builder: only download gcc once for gccgo buildTool. Downloading the GCC repo takes a lot of time and everything works fine if we just store it in the buildRoot and reuse it. R=golang-dev, adg CC=golang-dev https://golang.org/cl/13583045 --- dashboard/builder/env.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dashboard/builder/env.go b/dashboard/builder/env.go index 0a0d558d..94b4c23e 100644 --- a/dashboard/builder/env.go +++ b/dashboard/builder/env.go @@ -126,21 +126,27 @@ func (env *goEnv) setup(repo *Repo, workpath, hash string, envv []string) (strin type gccgoEnv struct{} // setup for a gccgoEnv clones the gofrontend repo to workpath/go at the hash -// and clones the latest GCC branch to workpath/gcc. The gccgo sources are +// and clones the latest GCC branch to repo.Path/gcc. The gccgo sources are // replaced with the updated sources in the gofrontend repo and gcc gets // gets configured and built in workpath/gcc-objdir. The path to // workpath/gcc-objdir is returned. func (env *gccgoEnv) setup(repo *Repo, workpath, hash string, envv []string) (string, error) { gofrontendpath := filepath.Join(workpath, "gofrontend") - gccpath := filepath.Join(workpath, "gcc") + gccpath := filepath.Join(repo.Path, "gcc") // get a handle to SVN vcs.Cmd for pulling down GCC. svn := vcs.ByCmd("svn") - if err := timeout(*cmdTimeout, func() error { - // pull down a working copy of GCC. - return svn.Create(gccpath, *gccPath) - }); err != nil { + // only pull down gcc if we don't have a local copy. + if _, err := os.Stat(gccpath); err != nil { + if err := timeout(*cmdTimeout, func() error { + // pull down a working copy of GCC. + return svn.Create(gccpath, *gccPath) + }); err != nil { + return "", err + } + } + if err := svn.Download(gccpath); err != nil { return "", err }