cmd/coordinator, dashboard: cross compile linux-arm-arm5spacemonkey

Change-Id: I3a228627ec8236d0d10bb9a1a61443c81493145d
Reviewed-on: https://go-review.googlesource.com/38460
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Jeff Wendling 2017-03-23 09:46:39 -06:00 коммит произвёл Brad Fitzpatrick
Родитель 08248cebaa
Коммит 02f25ac65d
2 изменённых файлов: 38 добавлений и 10 удалений

Просмотреть файл

@ -1430,11 +1430,14 @@ func (st *buildStatus) forceSnapshotUsage() {
st.useSnapshotMemo = &truth
}
func (st *buildStatus) shouldCrossCompileMake() bool {
if inStaging {
return st.name == "linux-arm" && kubeErr == nil
func (st *buildStatus) getCrossCompileConfig() *crossCompileConfig {
if kubeErr != nil {
return nil
}
return st.isTry() && st.name == "linux-arm" && kubeErr == nil
if inStaging || st.isTry() {
return crossCompileConfigs[st.name]
}
return nil
}
func (st *buildStatus) build() error {
@ -1451,8 +1454,8 @@ func (st *buildStatus) build() error {
}
sp.done(nil)
if !snapshotExists && st.shouldCrossCompileMake() {
if err := st.crossCompileMakeAndSnapshot(); err != nil {
if config := st.getCrossCompileConfig(); !snapshotExists && config != nil {
if err := st.crossCompileMakeAndSnapshot(config); err != nil {
return err
}
st.forceSnapshotUsage()
@ -1647,7 +1650,26 @@ func (st *buildStatus) runAllSharded() (remoteErr, err error) {
return nil, nil
}
func (st *buildStatus) crossCompileMakeAndSnapshot() (err error) {
type crossCompileConfig struct {
Buildlet string
CCForTarget string
GOARM string
}
var crossCompileConfigs = map[string]*crossCompileConfig{
"linux-arm": {
Buildlet: "host-linux-armhf-cross",
CCForTarget: "arm-linux-gnueabihf-gcc",
GOARM: "7",
},
"linux-arm-arm5spacemonkey": {
Buildlet: "host-linux-armel-cross",
CCForTarget: "arm-linux-gnueabi-gcc",
GOARM: "5",
},
}
func (st *buildStatus) crossCompileMakeAndSnapshot(config *crossCompileConfig) (err error) {
// TODO: currently we ditch this buildlet when we're done with
// the make.bash & snapshot. For extra speed later, we could
// keep it around and use it to "go test -c" each stdlib
@ -1657,7 +1679,7 @@ func (st *buildStatus) crossCompileMakeAndSnapshot() (err error) {
ctx, cancel := context.WithCancel(st.ctx)
defer cancel()
sp := st.createSpan("get_buildlet_cross")
kubeBC, err := kubePool.GetBuildlet(ctx, "host-linux-armhf-cross", st)
kubeBC, err := kubePool.GetBuildlet(ctx, config.Buildlet, st)
sp.done(err)
if err != nil {
return err
@ -1688,10 +1710,10 @@ func (st *buildStatus) crossCompileMakeAndSnapshot() (err error) {
ExtraEnv: []string{
"GOROOT_BOOTSTRAP=/go1.4",
"CGO_ENABLED=1",
"CC_FOR_TARGET=arm-linux-gnueabihf-gcc",
"CC_FOR_TARGET=" + config.CCForTarget,
"GOOS=" + goos,
"GOARCH=" + goarch,
"GOARM=7", // harmless if GOARCH != "arm"
"GOARM=" + config.GOARM, // harmless if GOARCH != "arm"
},
Debug: true,
})

Просмотреть файл

@ -34,6 +34,12 @@ var Hosts = map[string]*HostConfig{
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
},
"host-linux-armel-cross": &HostConfig{
Notes: "Kubernetes container on GKE built from env/crosscompile/linux-armel-stretch",
KubeImage: "linux-armel-stretch:latest",
buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
},
"host-nacl-kube": &HostConfig{
Notes: "Kubernetes container on GKE.",