1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:34:40 -07:00

builder: Allow buildroot to be passed as command-line argument

R=adg
CC=golang-dev
https://golang.org/cl/3473041
This commit is contained in:
Devon H. O'Dell 2010-12-06 10:34:39 +11:00 committed by Andrew Gerrand
parent dbcf79b4b9
commit dfd98d090c

View File

@ -37,6 +37,7 @@ type BenchRequest struct {
}
var (
buildroot = flag.String("buildroot", path.Join(os.TempDir(), "gobuilder"), "Directory under which to build")
dashboard = flag.String("dashboard", "godashboard.appspot.com", "Go Dashboard Host")
runBenchmarks = flag.Bool("bench", false, "Run benchmarks")
buildRelease = flag.Bool("release", false, "Build and upload binary release archives")
@ -45,8 +46,7 @@ var (
)
var (
buildroot = path.Join(os.TempDir(), "gobuilder")
goroot = path.Join(buildroot, "goroot")
goroot string
releaseRegexp = regexp.MustCompile(`^release\.[0-9\-]+`)
benchRequests vector.Vector
)
@ -61,6 +61,7 @@ func main() {
if len(flag.Args()) == 0 {
flag.Usage()
}
goroot = path.Join(*buildroot, "goroot")
builders := make([]*Builder, len(flag.Args()))
for i, builder := range flag.Args() {
b, err := NewBuilder(builder)
@ -69,13 +70,13 @@ func main() {
}
builders[i] = b
}
if err := os.RemoveAll(buildroot); err != nil {
log.Exitf("Error removing build root (%s): %s", buildroot, err)
if err := os.RemoveAll(*buildroot); err != nil {
log.Exitf("Error removing build root (%s): %s", *buildroot, err)
}
if err := os.Mkdir(buildroot, mkdirPerm); err != nil {
log.Exitf("Error making build root (%s): %s", buildroot, err)
if err := os.Mkdir(*buildroot, mkdirPerm); err != nil {
log.Exitf("Error making build root (%s): %s", *buildroot, err)
}
if err := run(nil, buildroot, "hg", "clone", hgUrl, goroot); err != nil {
if err := run(nil, *buildroot, "hg", "clone", hgUrl, goroot); err != nil {
log.Exit("Error cloning repository:", err)
}
// if specified, build revision and return
@ -236,7 +237,7 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
log.Println(b.name, "building", c.num)
// create place in which to do work
workpath := path.Join(buildroot, b.name+"-"+strconv.Itoa(c.num))
workpath := path.Join(*buildroot, b.name+"-"+strconv.Itoa(c.num))
err = os.Mkdir(workpath, mkdirPerm)
if err != nil {
return