diff --git a/misc/dashboard/builder/http.go b/misc/dashboard/builder/http.go index 5e1da0c878d..98400c51a81 100644 --- a/misc/dashboard/builder/http.go +++ b/misc/dashboard/builder/http.go @@ -112,16 +112,15 @@ func packages() (pkgs []string, err os.Error) { return } -// updatePackage sends package build results and info to the dashboard -func (b *Builder) updatePackage(pkg string, state bool, buildLog, info string, hash string) os.Error { +// updatePackage sends package build results and info dashboard +func (b *Builder) updatePackage(pkg string, ok bool, buildLog, info string) os.Error { return dash("POST", "package", nil, param{ "builder": b.name, "key": b.key, "path": pkg, - "state": strconv.Btoa(state), + "ok": strconv.Btoa(ok), "log": buildLog, "info": info, - "go_rev": hash[:12], }) } diff --git a/misc/dashboard/builder/main.go b/misc/dashboard/builder/main.go index bee663d6cff..989965bc41b 100644 --- a/misc/dashboard/builder/main.go +++ b/misc/dashboard/builder/main.go @@ -60,8 +60,9 @@ var ( ) var ( - goroot string - releaseRegexp = regexp.MustCompile(`^(release|weekly)\.[0-9\-.]+`) + goroot string + binaryTagRe = regexp.MustCompile(`^(release\.r|weekly\.)[0-9\-.]+`) + releaseRe = regexp.MustCompile(`^release\.r[0-9\-.]+`) ) func main() { @@ -200,7 +201,7 @@ func (b *Builder) buildExternal() { log.Println("hg pull failed:", err) continue } - hash, tag, err := firstTag(releaseRegexp) + hash, tag, err := firstTag(releaseRe) if err != nil { log.Println(err) continue @@ -321,7 +322,7 @@ func (b *Builder) buildHash(hash string) (err os.Error) { } // if this is a release, create tgz and upload to google code - releaseHash, release, err := firstTag(releaseRegexp) + releaseHash, release, err := firstTag(binaryTagRe) if hash == releaseHash { // clean out build state err = run(b.envv(), srcDir, "./clean.bash", "--nopkg") @@ -591,7 +592,7 @@ func fullHash(rev string) (hash string, err os.Error) { if s == "" { return "", fmt.Errorf("cannot find revision") } - if len(s) != 20 { + if len(s) != 40 { return "", fmt.Errorf("hg returned invalid hash " + s) } return s, nil @@ -615,7 +616,7 @@ func firstTag(re *regexp.Regexp) (hash string, tag string, err os.Error) { continue } tag = s[1] - hash, err = fullHash(s[3]) + hash, err = fullHash(s[2]) return } err = os.NewError("no matching tag found") diff --git a/misc/dashboard/builder/package.go b/misc/dashboard/builder/package.go index dd18e3af5fa..b6674428dac 100644 --- a/misc/dashboard/builder/package.go +++ b/misc/dashboard/builder/package.go @@ -14,6 +14,8 @@ import ( "strings" ) +const MaxCommentLength = 500 // App Engine won't store more in a StringProperty. + func (b *Builder) buildPackages(workpath string, hash string) os.Error { pkgs, err := packages() if err != nil { @@ -21,25 +23,34 @@ func (b *Builder) buildPackages(workpath string, hash string) os.Error { } for _, p := range pkgs { goroot := filepath.Join(workpath, "go") - goinstall := filepath.Join(goroot, "bin", "goinstall") + gobin := filepath.Join(goroot, "bin") + goinstall := filepath.Join(gobin, "goinstall") envv := append(b.envv(), "GOROOT="+goroot) + // add GOBIN to path + for i, v := range envv { + if strings.HasPrefix(v, "PATH=") { + p := filepath.SplitList(v[5:]) + p = append([]string{gobin}, p...) + s := strings.Join(p, string(filepath.ListSeparator)) + envv[i] = "PATH=" + s + } + } + // goinstall - buildLog, code, err := runLog(envv, "", goroot, goinstall, p) + buildLog, code, err := runLog(envv, "", goroot, goinstall, "-log=false", p) if err != nil { log.Printf("goinstall %v: %v", p, err) - continue } - built := code == 0 // get doc comment from package source - info, err := packageComment(p, filepath.Join(goroot, "pkg", p)) + info, err := packageComment(p, filepath.Join(goroot, "src", "pkg", p)) if err != nil { - log.Printf("goinstall %v: %v", p, err) + log.Printf("packageComment %v: %v", p, err) } // update dashboard with build state + info - err = b.updatePackage(p, built, buildLog, info, hash) + err = b.updatePackage(p, code == 0, buildLog, info) if err != nil { log.Printf("updatePackage %v: %v", p, err) } @@ -69,5 +80,15 @@ func packageComment(pkg, pkgpath string) (info string, err os.Error) { pdoc := doc.NewPackageDoc(pkgs[name], pkg) info = pdoc.Doc } + // grab only first paragraph + if parts := strings.SplitN(info, "\n\n", 2); len(parts) > 1 { + info = parts[0] + } + // replace newlines with spaces + info = strings.Replace(info, "\n", " ", -1) + // truncate + if len(info) > MaxCommentLength { + info = info[:MaxCommentLength] + } return } diff --git a/misc/dashboard/godashboard/auth.py b/misc/dashboard/godashboard/auth.py new file mode 100644 index 00000000000..73a54c0d45c --- /dev/null +++ b/misc/dashboard/godashboard/auth.py @@ -0,0 +1,13 @@ +# Copyright 2011 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +import hmac + +# local imports +import key + +def auth(req): + k = req.get('key') + return k == hmac.new(key.accessKey, req.get('builder')).hexdigest() or k == key.accessKey + diff --git a/misc/dashboard/godashboard/gobuild.py b/misc/dashboard/godashboard/gobuild.py index 5678f2e1b05..685dc83a9bf 100644 --- a/misc/dashboard/godashboard/gobuild.py +++ b/misc/dashboard/godashboard/gobuild.py @@ -14,14 +14,13 @@ from google.appengine.ext.webapp import template from google.appengine.ext.webapp.util import run_wsgi_app import datetime import hashlib -import hmac import logging import os import re import bz2 # local imports -import key +from auth import auth import const # The majority of our state are commit objects. One of these exists for each of @@ -142,10 +141,6 @@ class DashboardHandler(webapp.RequestHandler): simplejson.dump(obj, self.response.out) return -def auth(req): - k = req.get('key') - return k == hmac.new(key.accessKey, req.get('builder')).hexdigest() or k == key.accessKey - # Todo serves /todo. It tells the builder which commits need to be built. class Todo(DashboardHandler): def get(self): diff --git a/misc/dashboard/godashboard/index.yaml b/misc/dashboard/godashboard/index.yaml index 4a00c4a6fe8..f39299d5dca 100644 --- a/misc/dashboard/godashboard/index.yaml +++ b/misc/dashboard/godashboard/index.yaml @@ -49,4 +49,3 @@ indexes: # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. - diff --git a/misc/dashboard/godashboard/package.html b/misc/dashboard/godashboard/package.html index 9332b5a7927..043080b5bfd 100644 --- a/misc/dashboard/godashboard/package.html +++ b/misc/dashboard/godashboard/package.html @@ -19,37 +19,43 @@ Packages listed on this page are written by third parties and may or may not build or be safe to use.
+ ++ An "ok" in the build column indicates that the package is + goinstallable + with the latest + release of Go. +
+ ++ The info column shows the first paragraph from the + package doc comment. +
last install | count | path | project | ||
---|---|---|---|---|---|
last install | count | build | path | info | |
{{r.last_install|date:"Y-M-d H:i"}} | {{r.count}} | +{% if r.ok %}ok{% else %} {% endif %} | {{r.path}} | -- {% for p in r.project_set %} - {{p.name}} - {{p.descr}} - {% endfor %} - | +{% if r.info %}{{r.info|escape}}{% endif %} |
last install | count | path | project | ||
---|---|---|---|---|---|
last install | count | build | path | info | |
{{r.last_install|date:"Y-M-d H:i"}} | {{r.count}} | +{% if r.ok %}ok{% else %} {% endif %} | {{r.path}} | -- {% for p in r.project_set %} - {{p.name}} - {{p.descr}} - {% endfor %} - | +{% if r.info %}{{r.info|escape}}{% endif %} |