Commit a3420062 authored by Andrew Gerrand's avatar Andrew Gerrand

goinstall: only report successfully-installed packages to the dashboard

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4657071
parent 13f88977
......@@ -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
......
......@@ -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)
......
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