Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(426)

Side by Side Diff: misc/dashboard/builder/http.go

Issue 4172056: code review 4172056: gobuilder: add -package flag to build external packages (Closed)
Patch Set: diff -r c166ed517af1 https://go.googlecode.com/hg/ Created 14 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 package main 1 package main
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
5 "encoding/base64" 5 "encoding/base64"
6 "encoding/binary" 6 "encoding/binary"
7 "fmt" 7 "fmt"
8 "http" 8 "http"
9 "json"
10 "log"
9 "os" 11 "os"
12 "strconv"
rsc 2011/02/23 17:07:37 |sort
10 "regexp" 13 "regexp"
11 ) 14 )
12 15
13 // getHighWater returns the current highwater revision hash for this builder 16 // getHighWater returns the current highwater revision hash for this builder
14 func (b *Builder) getHighWater() (rev string, err os.Error) { 17 func (b *Builder) getHighWater() (rev string, err os.Error) {
15 url := fmt.Sprintf("http://%s/hw-get?builder=%s", *dashboard, b.name) 18 url := fmt.Sprintf("http://%s/hw-get?builder=%s", *dashboard, b.name)
16 r, _, err := http.Get(url) 19 r, _, err := http.Get(url)
17 if err != nil { 20 if err != nil {
18 return 21 return
19 } 22 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 59 }
57 b64.Close() 60 b64.Close()
58 return httpCommand("benchmarks", map[string]string{ 61 return httpCommand("benchmarks", map[string]string{
59 "builder": b.name, 62 "builder": b.name,
60 "key": b.key, 63 "key": b.key,
61 "node": c.node, 64 "node": c.node,
62 "benchmarkdata": buf.String(), 65 "benchmarkdata": buf.String(),
63 }) 66 })
64 } 67 }
65 68
69 // getPackages fetches a list of package paths from the dashboard
70 func getPackages() (pkgs []string, err os.Error) {
71 r, _, err := http.Get(fmt.Sprintf("http://%v/package?fmt=json", *dashboa rd))
72 if err != nil {
73 return
74 }
75 defer r.Body.Close()
76 d := json.NewDecoder(r.Body)
77 var resp struct {
78 Packages []struct {
79 Path string
80 }
81 }
82 if err = d.Decode(&resp); err != nil {
83 return
84 }
85 for _, p := range resp.Packages {
86 pkgs = append(pkgs, p.Path)
87 }
88 return
89 }
90
91 // updatePackage sends package build results and info to the dashboard
92 func (b *Builder) updatePackage(pkg string, state bool, buildLog, info string, c Commit) os.Error {
93 args := map[string]string{
94 "builder": b.name,
95 "key": b.key,
96 "path": pkg,
97 "state": strconv.Btoa(state),
98 "log": buildLog,
99 "info": info,
100 "go_rev": strconv.Itoa(c.num),
101 }
102 return httpCommand("package", args)
103 }
104
66 func httpCommand(cmd string, args map[string]string) os.Error { 105 func httpCommand(cmd string, args map[string]string) os.Error {
106 if *verbose {
107 log.Println("httpCommand", cmd, args)
108 }
67 url := fmt.Sprintf("http://%v/%v", *dashboard, cmd) 109 url := fmt.Sprintf("http://%v/%v", *dashboard, cmd)
68 _, err := http.PostForm(url, args) 110 _, err := http.PostForm(url, args)
69 return err 111 return err
70 } 112 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b