зеркало из https://github.com/golang/build.git
go.tools/dashboard/builder: use "hg archive -t files -r REV dest" instead of "hg clone" for the work directory.
It will save a lot of time for slow builders running on slow SD cards. LGTM=dave, adg R=golang-codereviews, dave, adg CC=golang-codereviews https://golang.org/cl/63550043
This commit is contained in:
Родитель
fac83ad60b
Коммит
fa5c998c67
|
@ -117,8 +117,11 @@ func (b *Builder) envvWindows() []string {
|
||||||
// and returns the path workpath/go/src, the location of all go build scripts.
|
// and returns the path workpath/go/src, the location of all go build scripts.
|
||||||
func (env *goEnv) setup(repo *Repo, workpath, hash string, envv []string) (string, error) {
|
func (env *goEnv) setup(repo *Repo, workpath, hash string, envv []string) (string, error) {
|
||||||
goworkpath := filepath.Join(workpath, "go")
|
goworkpath := filepath.Join(workpath, "go")
|
||||||
if _, err := repo.Clone(goworkpath, hash); err != nil {
|
if err := repo.Export(goworkpath, hash); err != nil {
|
||||||
return "", fmt.Errorf("error cloning repository: %s", err)
|
return "", fmt.Errorf("error exporting repository: %s", err)
|
||||||
|
}
|
||||||
|
if err := ioutil.WriteFile(filepath.Join(goworkpath, "VERSION"), []byte(hash), 0644); err != nil {
|
||||||
|
return "", fmt.Errorf("error writing VERSION file: %s", err)
|
||||||
}
|
}
|
||||||
return filepath.Join(goworkpath, "src"), nil
|
return filepath.Join(goworkpath, "src"), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,24 @@ func (r *Repo) Clone(path, rev string) (*Repo, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Export exports the current Repo at revision rev to a new destination.
|
||||||
|
func (r *Repo) Export(path, rev string) error {
|
||||||
|
r.Lock()
|
||||||
|
defer r.Unlock()
|
||||||
|
|
||||||
|
downloadPath := r.Path
|
||||||
|
if !r.Exists() {
|
||||||
|
_, err := r.Clone(path, rev)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
args := []string{r.Master.VCS.Cmd, "archive", "-t", "files", "-r", rev, path}
|
||||||
|
if err := run(*cmdTimeout, nil, downloadPath, args...); err != nil {
|
||||||
|
return fmt.Errorf("executing %s: %v", strings.Join(args, " "), err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// UpdateTo updates the working copy of this Repo to the
|
// UpdateTo updates the working copy of this Repo to the
|
||||||
// supplied revision.
|
// supplied revision.
|
||||||
func (r *Repo) UpdateTo(hash string) error {
|
func (r *Repo) UpdateTo(hash string) error {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче