From a342006207dad6884a43fdcdb62d190dd0db9ce4 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Mon, 4 Jul 2011 16:05:11 +1000 Subject: [PATCH] goinstall: only report successfully-installed packages to the dashboard R=golang-dev, r CC=golang-dev https://golang.org/cl/4657071 --- src/cmd/goinstall/download.go | 26 ++++++++++++++------------ src/cmd/goinstall/main.go | 6 +++++- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/cmd/goinstall/download.go b/src/cmd/goinstall/download.go index ab5662e272..da892a69d4 100644 --- a/src/cmd/goinstall/download.go +++ b/src/cmd/goinstall/download.go @@ -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 diff --git a/src/cmd/goinstall/main.go b/src/cmd/goinstall/main.go index bdf8469a00..5cdf0f18e2 100644 --- a/src/cmd/goinstall/main.go +++ b/src/cmd/goinstall/main.go @@ -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)