mirror of
https://github.com/golang/go.git
synced 2025-05-17 13:24:38 +00:00
cmd/dist: reach fixed point in rebuild during run.bash
This is basically a mini-bootstrap, to reach a fixed point. Change-Id: I88abad3d3ac961c3d11a48cb64d625d458684ef7 Reviewed-on: https://go-review.googlesource.com/74792 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
bf21c67b1e
commit
6eb8076961
15
src/cmd/dist/build.go
vendored
15
src/cmd/dist/build.go
vendored
@ -1044,6 +1044,8 @@ func timelog(op, name string) {
|
|||||||
fmt.Fprintf(timeLogFile, "%s %+.1fs %s %s\n", t.Format(time.UnixDate), t.Sub(timeLogStart).Seconds(), op, name)
|
fmt.Fprintf(timeLogFile, "%s %+.1fs %s %s\n", t.Format(time.UnixDate), t.Sub(timeLogStart).Seconds(), op, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var toolchain = []string{"cmd/asm", "cmd/cgo", "cmd/compile", "cmd/link"}
|
||||||
|
|
||||||
// The bootstrap command runs a build from scratch,
|
// The bootstrap command runs a build from scratch,
|
||||||
// stopping at having installed the go_bootstrap command.
|
// stopping at having installed the go_bootstrap command.
|
||||||
//
|
//
|
||||||
@ -1151,8 +1153,7 @@ func cmdbootstrap() {
|
|||||||
// chosen $CC_FOR_TARGET in this case.
|
// chosen $CC_FOR_TARGET in this case.
|
||||||
os.Setenv("CC", defaultcctarget)
|
os.Setenv("CC", defaultcctarget)
|
||||||
}
|
}
|
||||||
toolchain := []string{"cmd/asm", "cmd/cgo", "cmd/compile", "cmd/link", "cmd/buildid"}
|
goInstall(goBootstrap, toolchain...)
|
||||||
goInstall(toolchain...)
|
|
||||||
if debug {
|
if debug {
|
||||||
run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
|
run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
|
||||||
run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
|
run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
|
||||||
@ -1180,7 +1181,7 @@ func cmdbootstrap() {
|
|||||||
xprintf("\n")
|
xprintf("\n")
|
||||||
}
|
}
|
||||||
xprintf("Building Go toolchain3 using go_bootstrap and Go toolchain2.\n")
|
xprintf("Building Go toolchain3 using go_bootstrap and Go toolchain2.\n")
|
||||||
goInstall(append([]string{"-a"}, toolchain...)...)
|
goInstall(goBootstrap, append([]string{"-a"}, toolchain...)...)
|
||||||
if debug {
|
if debug {
|
||||||
run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
|
run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full")
|
||||||
run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
|
run("", ShowOutput|CheckExit, pathf("%s/buildid", tooldir), pathf("%s/pkg/%s_%s/runtime/internal/sys.a", goroot, goos, goarch))
|
||||||
@ -1204,7 +1205,7 @@ func cmdbootstrap() {
|
|||||||
xprintf("\n")
|
xprintf("\n")
|
||||||
}
|
}
|
||||||
xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
|
xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch)
|
||||||
goInstall("std", "cmd")
|
goInstall(goBootstrap, "std", "cmd")
|
||||||
checkNotStale(goBootstrap, "std", "cmd")
|
checkNotStale(goBootstrap, "std", "cmd")
|
||||||
checkNotStale(cmdGo, "std", "cmd")
|
checkNotStale(cmdGo, "std", "cmd")
|
||||||
|
|
||||||
@ -1219,7 +1220,7 @@ func cmdbootstrap() {
|
|||||||
os.Setenv("CC", defaultcctarget)
|
os.Setenv("CC", defaultcctarget)
|
||||||
xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
|
xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch)
|
||||||
}
|
}
|
||||||
goInstall("std", "cmd")
|
goInstall(goBootstrap, "std", "cmd")
|
||||||
checkNotStale(goBootstrap, "std", "cmd")
|
checkNotStale(goBootstrap, "std", "cmd")
|
||||||
checkNotStale(cmdGo, "std", "cmd")
|
checkNotStale(cmdGo, "std", "cmd")
|
||||||
if debug {
|
if debug {
|
||||||
@ -1252,8 +1253,8 @@ func cmdbootstrap() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func goInstall(args ...string) {
|
func goInstall(goBinary string, args ...string) {
|
||||||
installCmd := []string{pathf("%s/go_bootstrap", tooldir), "install", "-gcflags=" + gogcflags, "-ldflags=" + goldflags}
|
installCmd := []string{goBinary, "install", "-gcflags=" + gogcflags, "-ldflags=" + goldflags}
|
||||||
if vflag > 0 {
|
if vflag > 0 {
|
||||||
installCmd = append(installCmd, "-v")
|
installCmd = append(installCmd, "-v")
|
||||||
}
|
}
|
||||||
|
12
src/cmd/dist/test.go
vendored
12
src/cmd/dist/test.go
vendored
@ -116,12 +116,12 @@ func (t *tester) run() {
|
|||||||
|
|
||||||
if t.rebuild {
|
if t.rebuild {
|
||||||
t.out("Building packages and commands.")
|
t.out("Building packages and commands.")
|
||||||
cmd := exec.Command("go", "install", "-a", "-v", "std", "cmd")
|
// Rebuilding is a shortened bootstrap.
|
||||||
cmd.Stdout = os.Stdout
|
// See cmdbootstrap for a description of the overall process.
|
||||||
cmd.Stderr = os.Stderr
|
goInstall("go", toolchain...)
|
||||||
if err := cmd.Run(); err != nil {
|
goInstall("go", toolchain...)
|
||||||
log.Fatalf("building packages and commands: %v", err)
|
goInstall("go", "std", "cmd")
|
||||||
}
|
checkNotStale("go", "std", "cmd")
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.iOS() {
|
if t.iOS() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user