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
43ebc6b5
Commit
43ebc6b5
authored
Jan 30, 2012
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gobuilder: use go tool to build and test sub-repositories
R=rsc CC=golang-dev
https://golang.org/cl/5576047
parent
d87813b5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
24 deletions
+51
-24
misc/dashboard/builder/http.go
misc/dashboard/builder/http.go
+3
-2
misc/dashboard/builder/main.go
misc/dashboard/builder/main.go
+48
-22
No files found.
misc/dashboard/builder/http.go
View file @
43ebc6b5
...
@@ -183,11 +183,12 @@ func dashboardCommit(pkg, hash string) bool {
...
@@ -183,11 +183,12 @@ func dashboardCommit(pkg, hash string) bool {
return
err
==
nil
return
err
==
nil
}
}
func
dashboardPackages
()
[]
string
{
func
dashboardPackages
(
kind
string
)
[]
string
{
args
:=
url
.
Values
{
"kind"
:
[]
string
{
kind
}}
var
resp
[]
struct
{
var
resp
[]
struct
{
Path
string
Path
string
}
}
if
err
:=
dash
(
"GET"
,
"packages"
,
nil
,
nil
,
&
resp
);
err
!=
nil
{
if
err
:=
dash
(
"GET"
,
"packages"
,
args
,
nil
,
&
resp
);
err
!=
nil
{
log
.
Println
(
"dashboardPackages:"
,
err
)
log
.
Println
(
"dashboardPackages:"
,
err
)
return
nil
return
nil
}
}
...
...
misc/dashboard/builder/main.go
View file @
43ebc6b5
...
@@ -318,8 +318,8 @@ func (b *Builder) buildHash(hash string) (err error) {
...
@@ -318,8 +318,8 @@ func (b *Builder) buildHash(hash string) (err error) {
return
fmt
.
Errorf
(
"recordResult: %s"
,
err
)
return
fmt
.
Errorf
(
"recordResult: %s"
,
err
)
}
}
// build
goinstallable packag
es
// build
Go sub-repositori
es
b
.
build
Package
s
(
filepath
.
Join
(
workpath
,
"go"
),
hash
)
b
.
build
Subrepo
s
(
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
{
...
@@ -355,47 +355,68 @@ func (b *Builder) buildHash(hash string) (err error) {
...
@@ -355,47 +355,68 @@ func (b *Builder) buildHash(hash string) (err error) {
return
return
}
}
func
(
b
*
Builder
)
build
Package
s
(
goRoot
,
goHash
string
)
{
func
(
b
*
Builder
)
build
Subrepo
s
(
goRoot
,
goHash
string
)
{
for
_
,
pkg
:=
range
dashboardPackages
()
{
for
_
,
pkg
:=
range
dashboardPackages
(
"subrepo"
)
{
// get the latest todo for this package
// get the latest todo for this package
hash
,
err
:=
b
.
todo
(
"build-package"
,
pkg
,
goHash
)
hash
,
err
:=
b
.
todo
(
"build-package"
,
pkg
,
goHash
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"build
Package
s %s: %v"
,
pkg
,
err
)
log
.
Printf
(
"build
Subrepo
s %s: %v"
,
pkg
,
err
)
continue
continue
}
}
if
hash
==
""
{
if
hash
==
""
{
continue
continue
}
}
//
goinstall
the package
//
build
the package
if
*
verbose
{
if
*
verbose
{
log
.
Printf
(
"build
Packages %s: install
ing %q"
,
pkg
,
hash
)
log
.
Printf
(
"build
Subrepos %s: build
ing %q"
,
pkg
,
hash
)
}
}
buildLog
,
err
:=
b
.
goinstall
(
goRoot
,
pkg
,
hash
)
buildLog
,
err
:=
b
.
buildSubrepo
(
goRoot
,
pkg
,
hash
)
ok
:=
buildLog
==
""
if
err
!=
nil
{
if
err
!=
nil
{
ok
=
false
if
buildLog
==
""
{
log
.
Printf
(
"buildPackages %s: %v"
,
pkg
,
err
)
buildLog
=
err
.
Error
()
}
log
.
Printf
(
"buildSubrepos %s: %v"
,
pkg
,
err
)
}
}
// record the result
// record the result
err
=
b
.
recordResult
(
ok
,
pkg
,
hash
,
goHash
,
buildLog
,
0
)
err
=
b
.
recordResult
(
err
==
nil
,
pkg
,
hash
,
goHash
,
buildLog
,
0
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"build
Package
s %s: %v"
,
pkg
,
err
)
log
.
Printf
(
"build
Subrepo
s %s: %v"
,
pkg
,
err
)
}
}
}
}
}
}
func
(
b
*
Builder
)
goinstall
(
goRoot
,
pkg
,
hash
string
)
(
string
,
error
)
{
// buildSubrepo fetches the given package, updates it to the specified hash,
bin
:=
filepath
.
Join
(
goRoot
,
"bin/goinstall"
)
// and runs 'go test pkg/...'. It returns the build log and any error.
func
(
b
*
Builder
)
buildSubrepo
(
goRoot
,
pkg
,
hash
string
)
(
string
,
error
)
{
goBin
:=
filepath
.
Join
(
goRoot
,
"bin"
)
goTool
:=
filepath
.
Join
(
goBin
,
"go"
)
env
:=
append
(
b
.
envv
(),
"GOROOT="
+
goRoot
)
env
:=
append
(
b
.
envv
(),
"GOROOT="
+
goRoot
)
// add goBin to PATH
for
i
,
e
:=
range
env
{
const
p
=
"PATH="
if
!
strings
.
HasPrefix
(
e
,
p
)
{
continue
}
env
[
i
]
=
p
+
goBin
+
string
(
os
.
PathListSeparator
)
+
e
[
len
(
p
)
:
]
}
// fetch package and dependencies
// fetch package and dependencies
log
,
status
,
err
:=
runLog
(
env
,
""
,
goRoot
,
bin
,
log
,
status
,
err
:=
runLog
(
env
,
""
,
goRoot
,
goTool
,
"get"
,
"-d"
,
pkg
)
"-dashboard=false"
,
"-install=false"
,
pkg
)
if
err
==
nil
&&
status
!=
0
{
if
err
!=
nil
||
status
!=
0
{
err
=
fmt
.
Errorf
(
"go exited with status %d"
,
status
)
}
if
err
!=
nil
{
// 'go get -d' will fail for a subrepo because its top-level
// directory does not contain a go package. No matter, just
// check whether an hg directory exists and proceed.
hgDir
:=
filepath
.
Join
(
goRoot
,
"src/pkg"
,
pkg
,
".hg"
)
if
fi
,
e
:=
os
.
Stat
(
hgDir
);
e
!=
nil
||
!
fi
.
IsDir
()
{
return
log
,
err
return
log
,
err
}
}
}
// hg update to the specified hash
// hg update to the specified hash
pkgPath
:=
filepath
.
Join
(
goRoot
,
"src/pkg"
,
pkg
)
pkgPath
:=
filepath
.
Join
(
goRoot
,
"src/pkg"
,
pkg
)
...
@@ -403,8 +424,11 @@ func (b *Builder) goinstall(goRoot, pkg, hash string) (string, error) {
...
@@ -403,8 +424,11 @@ func (b *Builder) goinstall(goRoot, pkg, hash string) (string, error) {
return
""
,
err
return
""
,
err
}
}
// build the package
// test the package
log
,
_
,
err
=
runLog
(
env
,
""
,
goRoot
,
bin
,
"-dashboard=false"
,
pkg
)
log
,
status
,
err
=
runLog
(
env
,
""
,
goRoot
,
goTool
,
"test"
,
pkg
+
"/..."
)
if
err
==
nil
&&
status
!=
0
{
err
=
fmt
.
Errorf
(
"go exited with status %d"
,
status
)
}
return
log
,
err
return
log
,
err
}
}
...
@@ -491,8 +515,10 @@ func commitWatcher() {
...
@@ -491,8 +515,10 @@ func commitWatcher() {
if
*
verbose
{
if
*
verbose
{
log
.
Printf
(
"poll..."
)
log
.
Printf
(
"poll..."
)
}
}
// Main Go repository.
commitPoll
(
key
,
""
)
commitPoll
(
key
,
""
)
for
_
,
pkg
:=
range
dashboardPackages
()
{
// Go sub-repositories.
for
_
,
pkg
:=
range
dashboardPackages
(
"subrepo"
)
{
commitPoll
(
key
,
pkg
)
commitPoll
(
key
,
pkg
)
}
}
if
*
verbose
{
if
*
verbose
{
...
...
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