Commit c967ba02 authored by Andrew Gerrand's avatar Andrew Gerrand

goinstall: always rebuild a package after its dependencies are built

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4627047
parent 3c065184
...@@ -150,7 +150,7 @@ func logPackage(pkg string) { ...@@ -150,7 +150,7 @@ func logPackage(pkg string) {
} }
// install installs the package named by path, which is needed by parent. // install installs the package named by path, which is needed by parent.
func install(pkg, parent string) { func install(pkg, parent string) (built bool) {
// Make sure we're not already trying to install pkg. // Make sure we're not already trying to install pkg.
switch visit[pkg] { switch visit[pkg] {
case done: case done:
...@@ -201,9 +201,12 @@ func install(pkg, parent string) { ...@@ -201,9 +201,12 @@ func install(pkg, parent string) {
errorf("%s: package has no files\n", pkg) errorf("%s: package has no files\n", pkg)
return return
} }
var depBuilt bool
for _, p := range dirInfo.Imports { for _, p := range dirInfo.Imports {
if p != "C" { if p != "C" {
install(p, pkg) if install(p, pkg) {
depBuilt = true
}
} }
} }
if errors { if errors {
...@@ -224,20 +227,22 @@ func install(pkg, parent string) { ...@@ -224,20 +227,22 @@ func install(pkg, parent string) {
script.Clean() script.Clean()
} }
if *doInstall { if *doInstall {
if script.Stale() { if depBuilt || script.Stale() {
vlogf("%s: install\n", pkg) vlogf("%s: install\n", pkg)
if err := script.Run(); err != nil { if err := script.Run(); err != nil {
errorf("%s: install: %v\n", pkg, err) errorf("%s: install: %v\n", pkg, err)
return return
} }
built = true
} else { } else {
vlogf("%s: install: up-to-date\n", pkg) vlogf("%s: up-to-date\n", pkg)
} }
} }
if remote { if remote {
// mark package as installed in $GOROOT/goinstall.log // mark package as installed in $GOROOT/goinstall.log
logPackage(pkg) logPackage(pkg)
} }
return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment