1
0
mirror of https://github.com/golang/go synced 2024-11-25 04:57:56 -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. // 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, "..") { if strings.Contains(pkg, "..") {
return os.NewError("invalid path (contains ..)") err = os.NewError("invalid path (contains ..)")
return
} }
dashReport := true
m, err := findHostedRepo(pkg) m, err := findHostedRepo(pkg)
if err != nil { 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) m, err = findAnyRepo(pkg)
if err != nil { if err != nil {
return err return
} }
dashReport = false // only report public code hosting sites
} }
if m == nil { 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) installed, err := m.checkoutRepo(srcDir, m.prefix, m.repo)
if err != nil { if err != nil {
return err return
} }
if dashReport && installed { if !installed {
maybeReportToDashboard(pkg) dashReport = false
} }
return nil return
} }
// Try to detect if a "release" tag exists. If it does, update // 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. // Download remote packages if not found or forced with -u flag.
remote := isRemote(pkg) remote := isRemote(pkg)
dashReport := false
if remote && (err == build.ErrNotFound || (err == nil && *update)) { if remote && (err == build.ErrNotFound || (err == nil && *update)) {
printf("%s: download\n", pkg) printf("%s: download\n", pkg)
err = download(pkg, tree.SrcDir()) dashReport, err = download(pkg, tree.SrcDir())
} }
if err != nil { if err != nil {
errorf("%s: %v\n", pkg, err) errorf("%s: %v\n", pkg, err)
@ -243,6 +244,9 @@ func install(pkg, parent string) {
} }
} }
} }
if dashReport {
maybeReportToDashboard(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)