mirror of
https://github.com/golang/go.git
synced 2025-05-06 08:03:03 +00:00
dashboard/builder: remove the repo export speed hack for hg
The builder will no longer generate a VERSION file, so we can revert https://golang.org/cl/1405 once all builders have updated. Fixes golang/go#9296. Change-Id: Ie51cb06a712157c16b231167f166b31d10ba8667 Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/1510 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Chris Manghane <cmang@golang.org>
This commit is contained in:
parent
f56df04f2d
commit
a6c97ce144
@ -7,7 +7,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -125,13 +124,6 @@ func (env *goEnv) setup(repo *Repo, workpath, hash string, envv []string) (strin
|
|||||||
if err := repo.Export(goworkpath, hash); err != nil {
|
if err := repo.Export(goworkpath, hash); err != nil {
|
||||||
return "", fmt.Errorf("error exporting repository: %s", err)
|
return "", fmt.Errorf("error exporting repository: %s", err)
|
||||||
}
|
}
|
||||||
// Write out VERSION file if it does not already exist.
|
|
||||||
vFile := filepath.Join(goworkpath, "VERSION")
|
|
||||||
if _, err := os.Stat(vFile); os.IsNotExist(err) {
|
|
||||||
if err := ioutil.WriteFile(vFile, []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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,30 +63,9 @@ func (r *Repo) Clone(path, rev string) (*Repo, error) {
|
|||||||
|
|
||||||
// Export exports the current Repo at revision rev to a new destination.
|
// Export exports the current Repo at revision rev to a new destination.
|
||||||
func (r *Repo) Export(path, rev string) error {
|
func (r *Repo) Export(path, rev string) error {
|
||||||
r.Lock()
|
|
||||||
|
|
||||||
downloadPath := r.Path
|
|
||||||
if !r.Exists() {
|
|
||||||
r.Unlock()
|
|
||||||
_, err := r.Clone(path, rev)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
switch r.Master.VCS.Cmd {
|
|
||||||
default:
|
|
||||||
r.Unlock()
|
|
||||||
// TODO(adg,cmang): implement Export in go/vcs
|
// TODO(adg,cmang): implement Export in go/vcs
|
||||||
_, err := r.Clone(path, rev)
|
_, err := r.Clone(path, rev)
|
||||||
return err
|
return err
|
||||||
case "hg":
|
|
||||||
defer r.Unlock()
|
|
||||||
cmd := exec.Command(r.Master.VCS.Cmd, "archive", "-t", "files", "-r", rev, path)
|
|
||||||
cmd.Dir = downloadPath
|
|
||||||
if err := run(cmd); err != nil {
|
|
||||||
return fmt.Errorf("executing %v: %v", cmd.Args, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateTo updates the working copy of this Repo to the
|
// UpdateTo updates the working copy of this Repo to the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user