summaryrefslogtreecommitdiff
path: root/misc/dashboard/godashboard
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-08-03 16:54:30 +0200
committerOndřej Surý <ondrej@sury.org>2011-08-03 16:54:30 +0200
commit28592ee1ea1f5cdffcf85472f9de0285d928cf12 (patch)
tree32944e18b23f7fe4a0818a694aa2a6dfb1835463 /misc/dashboard/godashboard
parente836bee4716dc0d4d913537ad3ad1925a7ac32d0 (diff)
downloadgolang-upstream/59.tar.gz
Imported Upstream version 59upstream/59
Diffstat (limited to 'misc/dashboard/godashboard')
-rw-r--r--misc/dashboard/godashboard/auth.py13
-rw-r--r--misc/dashboard/godashboard/gobuild.py7
-rw-r--r--misc/dashboard/godashboard/index.yaml1
-rw-r--r--misc/dashboard/godashboard/package.html30
-rw-r--r--misc/dashboard/godashboard/package.py45
-rw-r--r--misc/dashboard/godashboard/static/style.css13
6 files changed, 73 insertions, 36 deletions
diff --git a/misc/dashboard/godashboard/auth.py b/misc/dashboard/godashboard/auth.py
new file mode 100644
index 000000000..73a54c0d4
--- /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 5678f2e1b..685dc83a9 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 4a00c4a6f..f39299d5d 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 9332b5a79..043080b5b 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.
</p>
+
+ <p>
+ An "ok" in the <b>build</b> column indicates that the package is
+ <a href="http://golang.org/cmd/goinstall/">goinstallable</a>
+ with the latest
+ <a href="http://golang.org/doc/devel/release.html">release</a> of Go.
+ </p>
+
+ <p>
+ The <b>info</b> column shows the first paragraph from the
+ <a href="http://blog.golang.org/2011/03/godoc-documenting-go-code.html">package doc comment</a>.
+ </p>
<h2>Recently Installed Packages</h2>
<table class="alternate" cellpadding="0" cellspacing="0">
- <tr><th>last install</th><th>count</th><th>path</th><th>project</th></tr>
+ <tr><th>last install</th><th>count</th><th>build</th><th>path</th><th>info</th></tr>
{% for r in by_time %}
<tr>
<td class="time">{{r.last_install|date:"Y-M-d H:i"}}</td>
<td class="count">{{r.count}}</td>
+ <td class="ok">{% if r.ok %}<a title="{{r.last_ok|date:"Y-M-d H:i"}}">ok</a>{% else %}&nbsp;{% endif %}</td>
<td class="path"><a href="{{r.web_url}}">{{r.path}}</a></td>
- <td class="project">
- {% for p in r.project_set %}
- <a href="{{p.web_url}}">{{p.name}}</a> - {{p.descr}}
- {% endfor %}
- </td>
+ <td class="info">{% if r.info %}{{r.info|escape}}{% endif %}</td>
</tr>
{% endfor %}
</table>
<h2>Most Installed Packages</h2>
<table class="alternate" cellpadding="0" cellspacing="0">
- <tr><th>last install</th><th>count</th><th>path</th><th>project</th></tr>
+ <tr><th>last install</th><th>count</th><th>build</th><th>path</th><th>info</th></tr>
{% for r in by_count %}
<tr>
<td class="time">{{r.last_install|date:"Y-M-d H:i"}}</td>
<td class="count">{{r.count}}</td>
+ <td class="ok">{% if r.ok %}<a title="{{r.last_ok|date:"Y-M-d H:i"}}">ok</a>{% else %}&nbsp;{% endif %}</td>
<td class="path"><a href="{{r.web_url}}">{{r.path}}</a></td>
- <td class="project">
- {% for p in r.project_set %}
- <a href="{{p.web_url}}">{{p.name}}</a> - {{p.descr}}
- {% endfor %}
- </td>
+ <td class="info">{% if r.info %}{{r.info|escape}}{% endif %}</td>
</tr>
{% endfor %}
</table>
diff --git a/misc/dashboard/godashboard/package.py b/misc/dashboard/godashboard/package.py
index a1bca1908..316f3867f 100644
--- a/misc/dashboard/godashboard/package.py
+++ b/misc/dashboard/godashboard/package.py
@@ -23,6 +23,7 @@ import sets
# local imports
import toutf8
import const
+from auth import auth
template.register_template_library('toutf8')
@@ -34,6 +35,11 @@ class Package(db.Model):
count = db.IntegerProperty()
last_install = db.DateTimeProperty()
+ # data contributed by gobuilder
+ info = db.StringProperty()
+ ok = db.BooleanProperty()
+ last_ok = db.DateTimeProperty()
+
class Project(db.Model):
name = db.StringProperty(indexed=True)
descr = db.StringProperty()
@@ -43,23 +49,25 @@ class Project(db.Model):
tags = db.ListProperty(str)
approved = db.BooleanProperty(indexed=True)
-re_bitbucket = re.compile(r'^bitbucket\.org/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+$')
-re_googlecode = re.compile(r'^[a-z0-9\-]+\.googlecode\.com/(svn|hg)$')
-re_github = re.compile(r'^github\.com/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+$')
+re_bitbucket = re.compile(r'^(bitbucket\.org/[a-z0-9A-Z_.\-]+/[a-zA-Z0-9_.\-]+)(/[a-z0-9A-Z_.\-/]+)?$')
+re_googlecode = re.compile(r'^[a-z0-9\-]+\.googlecode\.com/(svn|hg)(/[a-z0-9A-Z_.\-/]+)?$')
+re_github = re.compile(r'^github\.com/[a-z0-9A-Z_.\-]+(/[a-z0-9A-Z_.\-]+)+$')
re_launchpad = re.compile(r'^launchpad\.net/([a-z0-9A-Z_.\-]+(/[a-z0-9A-Z_.\-]+)?|~[a-z0-9A-Z_.\-]+/(\+junk|[a-z0-9A-Z_.\-]+)/[a-z0-9A-Z_.\-]+)(/[a-z0-9A-Z_.\-/]+)?$')
-
def vc_to_web(path):
if re_bitbucket.match(path):
- check_url = 'http://' + path + '/?cmd=heads'
- web = 'http://' + path + '/'
+ m = re_bitbucket.match(path)
+ check_url = 'http://' + m.group(1) + '/?cmd=heads'
+ web = 'http://' + m.group(1) + '/'
elif re_github.match(path):
- # github doesn't let you fetch the .git directory anymore.
- # fetch .git/info/refs instead, like git clone would.
- check_url = 'http://'+path+'.git/info/refs'
- web = 'http://' + path
+ m = re_github_web.match(path)
+ check_url = 'https://raw.github.com/' + m.group(1) + '/' + m.group(2) + '/master/'
+ web = 'http://github.com/' + m.group(1) + '/' + m.group(2) + '/'
elif re_googlecode.match(path):
+ m = re_googlecode.match(path)
check_url = 'http://'+path
+ if not m.group(2): # append / after bare '/hg'
+ check_url += '/'
web = 'http://code.google.com/p/' + path[:path.index('.')]
elif re_launchpad.match(path):
check_url = web = 'https://'+path
@@ -143,8 +151,7 @@ class PackagePage(webapp.RequestHandler):
def can_get_url(self, url):
try:
- req = urllib2.Request(url)
- response = urllib2.urlopen(req)
+ urllib2.urlopen(urllib2.Request(url))
return True
except:
return False
@@ -174,15 +181,23 @@ class PackagePage(webapp.RequestHandler):
return False
p = Package(key_name = key, path = path, count = 0, web_url = web)
+ # is this the builder updating package metadata?
+ if auth(self.request):
+ p.info = self.request.get('info')
+ p.ok = self.request.get('ok') == "true"
+ if p.ok:
+ p.last_ok = datetime.datetime.utcnow()
+ else:
+ p.count += 1
+ p.last_install = datetime.datetime.utcnow()
+
# update package object
- p.count += 1
- p.last_install = datetime.datetime.utcnow()
p.put()
return True
def post(self):
path = self.request.get('path')
- ok = self.record_pkg(path)
+ ok = db.run_in_transaction(self.record_pkg, path)
if ok:
self.response.set_status(200)
self.response.out.write('ok')
diff --git a/misc/dashboard/godashboard/static/style.css b/misc/dashboard/godashboard/static/style.css
index 481af36d7..a7e61dda5 100644
--- a/misc/dashboard/godashboard/static/style.css
+++ b/misc/dashboard/godashboard/static/style.css
@@ -52,7 +52,7 @@ table.alternate tr td:last-child {
padding-right: 0;
}
table.alternate tr:nth-child(2n) {
- background-color: #f8f8f8;
+ background-color: #f0f0f0;
}
span.hash {
font-family: monospace;
@@ -62,10 +62,19 @@ span.hash {
td.date {
color: #aaa;
}
-td.result {
+td.ok {
text-align: center;
+ color: #060;
+ font-weight: bold;
+}
+td.ok a {
+ cursor: help;
+}
+th {
+ text-align: left;
}
th.builder {
+ text-align: center;
font-weight: bold;
}
a.fail {