Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
be587a4d
Commit
be587a4d
authored
Dec 08, 2011
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gobuilder: goinstall packages after building go tree
R=rsc CC=golang-dev
https://golang.org/cl/5450100
parent
2e3bd890
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
18 deletions
+82
-18
misc/dashboard/builder/exec.go
misc/dashboard/builder/exec.go
+1
-1
misc/dashboard/builder/http.go
misc/dashboard/builder/http.go
+16
-10
misc/dashboard/builder/main.go
misc/dashboard/builder/main.go
+64
-6
misc/dashboard/builder/package.go
misc/dashboard/builder/package.go
+1
-1
No files found.
misc/dashboard/builder/exec.go
View file @
be587a4d
...
@@ -60,7 +60,7 @@ func runLog(envv []string, logfile, dir string, argv ...string) (string, int, er
...
@@ -60,7 +60,7 @@ func runLog(envv []string, logfile, dir string, argv ...string) (string, int, er
return
b
.
String
(),
ws
.
ExitStatus
(),
nil
return
b
.
String
(),
ws
.
ExitStatus
(),
nil
}
}
}
}
return
b
.
String
(),
0
,
nil
return
b
.
String
(),
0
,
err
}
}
// useBash prefixes a list of args with 'bash' if the first argument
// useBash prefixes a list of args with 'bash' if the first argument
...
...
misc/dashboard/builder/http.go
View file @
be587a4d
...
@@ -83,9 +83,12 @@ func dash(meth, cmd string, args url.Values, req, resp interface{}) error {
...
@@ -83,9 +83,12 @@ func dash(meth, cmd string, args url.Values, req, resp interface{}) error {
}
}
// todo returns the next hash to build.
// todo returns the next hash to build.
func
(
b
*
Builder
)
todo
()
(
rev
string
,
err
error
)
{
func
(
b
*
Builder
)
todo
(
pkg
,
goHash
string
)
(
rev
string
,
err
error
)
{
// TODO(adg): handle packages
args
:=
url
.
Values
{
args
:=
url
.
Values
{
"builder"
:
{
b
.
name
}}
"builder"
:
{
b
.
name
},
"packagePath"
:
{
pkg
},
"goHash"
:
{
goHash
},
}
var
resp
string
var
resp
string
if
err
=
dash
(
"GET"
,
"todo"
,
args
,
nil
,
&
resp
);
err
!=
nil
{
if
err
=
dash
(
"GET"
,
"todo"
,
args
,
nil
,
&
resp
);
err
!=
nil
{
return
return
...
@@ -97,13 +100,16 @@ func (b *Builder) todo() (rev string, err error) {
...
@@ -97,13 +100,16 @@ func (b *Builder) todo() (rev string, err error) {
}
}
// recordResult sends build results to the dashboard
// recordResult sends build results to the dashboard
func
(
b
*
Builder
)
recordResult
(
buildLog
string
,
hash
string
)
error
{
func
(
b
*
Builder
)
recordResult
(
ok
bool
,
pkg
,
hash
,
goHash
,
buildLog
string
)
error
{
// TODO(adg): handle packages
req
:=
obj
{
return
dash
(
"POST"
,
"result"
,
url
.
Values
{
"key"
:
{
b
.
key
}},
obj
{
"Builder"
:
b
.
name
,
"Builder"
:
b
.
name
,
"PackagePath"
:
pkg
,
"Hash"
:
hash
,
"Hash"
:
hash
,
"Log"
:
buildLog
,
"GoHash"
:
goHash
,
},
nil
)
"OK"
:
ok
,
"Log"
:
buildLog
,
}
return
dash
(
"POST"
,
"result"
,
url
.
Values
{
"key"
:
{
b
.
key
}},
req
,
nil
)
}
}
// packages fetches a list of package paths from the dashboard
// packages fetches a list of package paths from the dashboard
...
...
misc/dashboard/builder/main.go
View file @
be587a4d
...
@@ -237,7 +237,7 @@ func (b *Builder) build() bool {
...
@@ -237,7 +237,7 @@ func (b *Builder) build() bool {
log
.
Println
(
b
.
name
,
"build:"
,
err
)
log
.
Println
(
b
.
name
,
"build:"
,
err
)
}
}
}()
}()
hash
,
err
:=
b
.
todo
()
hash
,
err
:=
b
.
todo
(
""
,
""
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Println
(
err
)
log
.
Println
(
err
)
return
false
return
false
...
@@ -285,8 +285,7 @@ func (b *Builder) buildHash(hash string) (err error) {
...
@@ -285,8 +285,7 @@ func (b *Builder) buildHash(hash string) (err error) {
}
}
// update to specified revision
// update to specified revision
err
=
run
(
nil
,
path
.
Join
(
workpath
,
"go"
),
err
=
run
(
nil
,
path
.
Join
(
workpath
,
"go"
),
"hg"
,
"update"
,
hash
)
"hg"
,
"update"
,
hash
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
...
@@ -305,19 +304,22 @@ func (b *Builder) buildHash(hash string) (err error) {
...
@@ -305,19 +304,22 @@ func (b *Builder) buildHash(hash string) (err error) {
if
status
!=
0
{
if
status
!=
0
{
return
errors
.
New
(
"go build failed"
)
return
errors
.
New
(
"go build failed"
)
}
}
return
b
.
buildPackages
(
workpath
,
hash
)
return
b
.
build
External
Packages
(
workpath
,
hash
)
}
}
if
status
!=
0
{
if
status
!=
0
{
// record failure
// record failure
return
b
.
recordResult
(
buildLog
,
hash
)
return
b
.
recordResult
(
false
,
""
,
hash
,
""
,
buildLog
)
}
}
// record success
// record success
if
err
=
b
.
recordResult
(
""
,
hash
);
err
!=
nil
{
if
err
=
b
.
recordResult
(
true
,
""
,
hash
,
""
,
""
);
err
!=
nil
{
return
fmt
.
Errorf
(
"recordResult: %s"
,
err
)
return
fmt
.
Errorf
(
"recordResult: %s"
,
err
)
}
}
// build goinstallable packages
b
.
buildPackages
(
filepath
.
Join
(
workpath
,
"go"
),
hash
)
// finish here if codeUsername and codePassword aren't set
// finish here if codeUsername and codePassword aren't set
if
b
.
codeUsername
==
""
||
b
.
codePassword
==
""
||
!*
buildRelease
{
if
b
.
codeUsername
==
""
||
b
.
codePassword
==
""
||
!*
buildRelease
{
return
return
...
@@ -344,11 +346,67 @@ func (b *Builder) buildHash(hash string) (err error) {
...
@@ -344,11 +346,67 @@ func (b *Builder) buildHash(hash string) (err error) {
"-w"
,
b
.
codePassword
,
"-w"
,
b
.
codePassword
,
"-l"
,
fmt
.
Sprintf
(
"%s,%s"
,
b
.
goos
,
b
.
goarch
),
"-l"
,
fmt
.
Sprintf
(
"%s,%s"
,
b
.
goos
,
b
.
goarch
),
fn
)
fn
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"%s: %s"
,
codePyScript
,
err
)
}
}
}
return
return
}
}
func
(
b
*
Builder
)
buildPackages
(
goRoot
,
goHash
string
)
{
for
_
,
pkg
:=
range
dashboardPackages
()
{
// get the latest todo for this package
hash
,
err
:=
b
.
todo
(
pkg
,
goHash
)
if
err
!=
nil
{
log
.
Printf
(
"buildPackages %s: %v"
,
pkg
,
err
)
continue
}
if
hash
==
""
{
continue
}
// goinstall the package
if
*
verbose
{
log
.
Printf
(
"buildPackages %s: installing %q"
,
pkg
,
hash
)
}
buildLog
,
err
:=
b
.
goinstall
(
goRoot
,
pkg
,
hash
)
ok
:=
buildLog
==
""
if
err
!=
nil
{
ok
=
false
log
.
Printf
(
"buildPackages %s: %v"
,
pkg
,
err
)
}
// record the result
err
=
b
.
recordResult
(
ok
,
pkg
,
hash
,
goHash
,
buildLog
)
if
err
!=
nil
{
log
.
Printf
(
"buildPackages %s: %v"
,
pkg
,
err
)
}
}
}
func
(
b
*
Builder
)
goinstall
(
goRoot
,
pkg
,
hash
string
)
(
string
,
error
)
{
bin
:=
filepath
.
Join
(
goRoot
,
"bin/goinstall"
)
env
:=
append
(
b
.
envv
(),
"GOROOT="
+
goRoot
)
// fetch package and dependencies
log
,
status
,
err
:=
runLog
(
env
,
""
,
goRoot
,
bin
,
"-dashboard=false"
,
"-install=false"
,
pkg
)
if
err
!=
nil
||
status
!=
0
{
return
log
,
err
}
// hg update to the specified hash
pkgPath
:=
filepath
.
Join
(
goRoot
,
"src/pkg"
,
pkg
)
if
err
:=
run
(
nil
,
pkgPath
,
"hg"
,
"update"
,
hash
);
err
!=
nil
{
return
""
,
err
}
// build the package
log
,
_
,
err
=
runLog
(
env
,
""
,
goRoot
,
bin
,
"-dashboard=false"
,
pkg
)
return
log
,
err
}
// envv returns an environment for build/bench execution
// envv returns an environment for build/bench execution
func
(
b
*
Builder
)
envv
()
[]
string
{
func
(
b
*
Builder
)
envv
()
[]
string
{
if
runtime
.
GOOS
==
"windows"
{
if
runtime
.
GOOS
==
"windows"
{
...
...
misc/dashboard/builder/package.go
View file @
be587a4d
...
@@ -18,7 +18,7 @@ import (
...
@@ -18,7 +18,7 @@ import (
const
MaxCommentLength
=
500
// App Engine won't store more in a StringProperty.
const
MaxCommentLength
=
500
// App Engine won't store more in a StringProperty.
func
(
b
*
Builder
)
buildPackages
(
workpath
string
,
hash
string
)
error
{
func
(
b
*
Builder
)
build
External
Packages
(
workpath
string
,
hash
string
)
error
{
logdir
:=
filepath
.
Join
(
*
buildroot
,
"log"
)
logdir
:=
filepath
.
Join
(
*
buildroot
,
"log"
)
if
err
:=
os
.
Mkdir
(
logdir
,
0755
);
err
!=
nil
{
if
err
:=
os
.
Mkdir
(
logdir
,
0755
);
err
!=
nil
{
return
err
return
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment