1
0
mirror of https://github.com/golang/go synced 2024-11-21 13:24:40 -07:00

goinstall: only report successfully-installed packages to the dashboard

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4657071
This commit is contained in:
Andrew Gerrand 2011-07-04 16:05:11 +10:00
parent 13f889778e
commit a342006207
2 changed files with 19 additions and 13 deletions

View File

@ -214,33 +214,35 @@ func isRemote(pkg string) bool {
}
// download checks out or updates pkg from the remote server.
func download(pkg, srcDir string) os.Error {
func download(pkg, srcDir string) (dashReport bool, err os.Error) {
if strings.Contains(pkg, "..") {
return os.NewError("invalid path (contains ..)")
err = os.NewError("invalid path (contains ..)")
return
}
dashReport := true
m, err := findHostedRepo(pkg)
if err != nil {
return err
return
}
if m == nil {
if m != nil {
dashReport = true // only report public code hosting sites
} else {
m, err = findAnyRepo(pkg)
if err != nil {
return err
return
}
dashReport = false // only report public code hosting sites
}
if m == nil {
return os.NewError("cannot download: " + pkg)
err = os.NewError("cannot download: " + pkg)
return
}
installed, err := m.checkoutRepo(srcDir, m.prefix, m.repo)
if err != nil {
return err
return
}
if dashReport && installed {
maybeReportToDashboard(pkg)
if !installed {
dashReport = false
}
return nil
return
}
// Try to detect if a "release" tag exists. If it does, update

View File

@ -182,9 +182,10 @@ func install(pkg, parent string) {
}
// Download remote packages if not found or forced with -u flag.
remote := isRemote(pkg)
dashReport := false
if remote && (err == build.ErrNotFound || (err == nil && *update)) {
printf("%s: download\n", pkg)
err = download(pkg, tree.SrcDir())
dashReport, err = download(pkg, tree.SrcDir())
}
if err != nil {
errorf("%s: %v\n", pkg, err)
@ -243,6 +244,9 @@ func install(pkg, parent string) {
}
}
}
if dashReport {
maybeReportToDashboard(pkg)
}
if remote {
// mark package as installed in $GOROOT/goinstall.log
logPackage(pkg)