env: update nacl builders to be VM-based
Be lazy and use sid as a base, instead of trusty.
This replaces my earlier failed attempt: https://golang.org/cl/4960
Fixes golang/go#9879
Change-Id: Ia0a39c99747844b6e34bf7561c01dce49fa3b226
Reviewed-on: https://go-review.googlesource.com/5191
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 3f97849..6634c26 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -77,6 +77,9 @@
if strings.HasPrefix(c.Name, "plan9-") {
return "src/all.rc"
}
+ if strings.HasPrefix(c.Name, "nacl-") {
+ return "src/nacltest.bash"
+ }
return "src/all.bash"
}
@@ -175,10 +178,6 @@
tool: "gccgo",
})
- // TODO(bradfitz,adg,jbd): convert nacl builders to be VMs too:
- addBuilder(BuildConfig{Name: "nacl-386"})
- addBuilder(BuildConfig{Name: "nacl-amd64p32"})
-
// VMs:
addBuilder(BuildConfig{
Name: "freebsd-amd64-gce93",
@@ -277,6 +276,18 @@
env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
})
addBuilder(BuildConfig{
+ Name: "nacl-386",
+ VMImage: "linux-buildlet-nacl",
+ buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.linux-amd64",
+ env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GOOS=nacl", "GOARCH=386", "GOHOSTOS=linux", "GOHOSTARCH=amd64"},
+ })
+ addBuilder(BuildConfig{
+ Name: "nacl-amd64p32",
+ VMImage: "linux-buildlet-nacl",
+ buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.linux-amd64",
+ env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GOOS=nacl", "GOARCH=amd64p32", "GOHOSTOS=linux", "GOHOSTARCH=amd64"},
+ })
+ addBuilder(BuildConfig{
Name: "openbsd-amd64-gce56",
VMImage: "openbsd-amd64-56",
machineType: "n1-highcpu-2",
@@ -362,15 +373,6 @@
if c.tool == "" {
c.tool = "go"
}
-
- if strings.HasPrefix(c.Name, "nacl-") {
- if c.Image == "" {
- c.Image = "gobuilders/linux-x86-nacl"
- }
- if c.cmd == "" {
- c.cmd = "/usr/local/bin/build-command.pl"
- }
- }
if strings.HasPrefix(c.Name, "linux-") && c.Image == "" && c.VMImage == "" {
c.Image = "gobuilders/linux-x86-base"
}
diff --git a/env/linux-x86-nacl/Dockerfile b/env/linux-x86-nacl/Dockerfile
index 805b066..82f030f 100644
--- a/env/linux-x86-nacl/Dockerfile
+++ b/env/linux-x86-nacl/Dockerfile
@@ -1,27 +1,19 @@
-# Copyright 2014 The Go Authors. All rights reserved.
+# Copyright 2015 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.
# gobuilders/linux-x86-nacl for 32- and 64-bit nacl.
#
# We need more modern libc than Debian stable as used in base, so we're
-# using Ubuntu LTS here.
-#
-# TODO(bradfitz): make both be Ubuntu? But we also want Debian, Fedora,
-# etc coverage., so deal with unifying these later, once there's a plan
-# or a generator for them and the other builders are turned down.
+# using Debian sid instead.
-FROM ubuntu:trusty
+FROM gobuilders/linux-x86-sid
MAINTAINER golang-dev <golang-dev@googlegroups.com>
ENV DEBIAN_FRONTEND noninteractive
-ADD /scripts/install-apt-deps.sh /scripts/
-RUN /scripts/install-apt-deps.sh
+RUN (cd /usr/bin && curl -s -O https://storage.googleapis.com/gobuilder/sel_ldr_x86_32 && chmod +x sel_ldr_x86_32)
+RUN (cd /usr/bin && curl -s -O https://storage.googleapis.com/gobuilder/sel_ldr_x86_64 && chmod +x sel_ldr_x86_64)
-ADD /scripts/build-go-builder.sh /scripts/
-RUN GO_REV=go1.4 TOOLS_REV=d79e0375a BUILDER_REV=fa8373a /scripts/build-go-builder.sh && test -f /usr/local/bin/builder
-
-ADD build-command.pl /usr/local/bin/
-
-ENV PATH /usr/local/bin:$GOROOT/bin:$PATH
+ADD go_nacl_386_exec /usr/bin/
+ADD go_nacl_amd64p32_exec /usr/bin/
diff --git a/env/linux-x86-nacl/Makefile b/env/linux-x86-nacl/Makefile
index d2f76ed..582e49e 100644
--- a/env/linux-x86-nacl/Makefile
+++ b/env/linux-x86-nacl/Makefile
@@ -5,8 +5,12 @@
docker: Dockerfile
docker build -t gobuilders/linux-x86-nacl .
-upload: docker
- docker save gobuilders/linux-x86-nacl | gzip | (cd ../../cmd/upload && go run upload.go --public go-builder-data/docker-linux.nacl.tar.gz)
+# TODO(bradfitz): test targets, using cmd/gomote and the buildlet in the container.
-check: docker
- docker run gobuilders/linux-x86-nacl /usr/local/bin/builder -rev=77e96c9208d0 -buildroot=/ -v -cmd=/usr/local/bin/build-command.pl -report=false nacl-amd64p32
+# TODO(bradfitz): docs on how to build a new image. In a nutshell,
+#
+# $ go install golang.org/x/build/cmd/docker2boot
+# $ sudo docker2boot --image=gobuilders/linux-x86-nacl --out=linux-buildlet-nacl.tar.gz --gb=3
+# $ gsutil cp -a public-read linux-buildlet-nacl.tar.gz gs://go-builder-data/linux-buildlet-nacl.tar.gz
+# $ gcloud compute --project symbolic-datum-552 images create linux-buildlet-nacl --source-uri gs://go-builder-data/linux-buildlet-nacl.tar.gz
+
diff --git a/env/linux-x86-nacl/build-command.pl b/env/linux-x86-nacl/build-command.pl
deleted file mode 100755
index 0eb9edb..0000000
--- a/env/linux-x86-nacl/build-command.pl
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-
-if ($ENV{GOOS} eq "nacl") {
- delete $ENV{GOROOT_FINAL};
- exec("./nacltest.bash", @ARGV);
- die "Failed to run nacltest.bash: $!\n";
-}
-
-exec("./all.bash", @ARGV);
-die "Failed to run all.bash: $!\n";
-
diff --git a/env/linux-x86-nacl/go_nacl_386_exec b/env/linux-x86-nacl/go_nacl_386_exec
new file mode 100755
index 0000000..9cff635
--- /dev/null
+++ b/env/linux-x86-nacl/go_nacl_386_exec
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+eval $(go env)
+
+export NACLENV_GOARCH=$GOARCH
+export NACLENV_GOOS=$GOOS
+export NACLENV_GOROOT=/go
+export NACLENV_NACLPWD=$(pwd | sed "s;$GOROOT;/go;")
+
+exec sel_ldr_x86_32 -l /dev/null -S -e "$@"
diff --git a/env/linux-x86-nacl/go_nacl_amd64p32_exec b/env/linux-x86-nacl/go_nacl_amd64p32_exec
new file mode 100755
index 0000000..0a5ed65
--- /dev/null
+++ b/env/linux-x86-nacl/go_nacl_amd64p32_exec
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+eval $(go env)
+
+export NACLENV_GOARCH=$GOARCH
+export NACLENV_GOOS=$GOOS
+export NACLENV_GOROOT=/go
+export NACLENV_NACLPWD=$(pwd | sed "s;$GOROOT;/go;")
+
+exec sel_ldr_x86_64 -l /dev/null -S -e "$@"
diff --git a/env/linux-x86-nacl/scripts/build-go-builder.sh b/env/linux-x86-nacl/scripts/build-go-builder.sh
deleted file mode 100755
index a735147..0000000
--- a/env/linux-x86-nacl/scripts/build-go-builder.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-set -ex
-
-export GOPATH=/gopath
-export GOROOT=/goroot
-PREFIX=/usr/local
-: ${GO_REV:?"need to be set to the golang repo revision used to build the builder."}
-: ${TOOLS_REV:?"need to be set to the tools repo revision used to build the builder."}
-: ${BUILDER_REV:?"need to be set to the build repo revision for the builder."}
-
-mkdir -p $GOROOT
-git clone https://go.googlesource.com/go $GOROOT
-(cd $GOROOT/src && git checkout $GO_REV && find && ./make.bash)
-
-GO_TOOLS=$GOPATH/src/golang.org/x/tools
-mkdir -p $GO_TOOLS
-git clone https://go.googlesource.com/tools $GO_TOOLS
-(cd $GO_TOOLS && git reset --hard $TOOLS_REV)
-
-GO_BUILD=$GOPATH/src/golang.org/x/build
-mkdir -p $GO_BUILD
-git clone https://go.googlesource.com/build $GO_BUILD
-
-mkdir -p $PREFIX/bin
-(cd $GO_BUILD && git reset --hard $BUILDER_REV && GOBIN=$PREFIX/bin /goroot/bin/go install golang.org/x/build/cmd/builder)
-
-rm -fR $GOROOT/bin $GOROOT/pkg $GOPATH
-
-(cd /usr/local/bin && curl -s -O https://storage.googleapis.com/gobuilder/sel_ldr_x86_32 && chmod +x sel_ldr_x86_32)
-(cd /usr/local/bin && curl -s -O https://storage.googleapis.com/gobuilder/sel_ldr_x86_64 && chmod +x sel_ldr_x86_64)
-
-ln -s $GOROOT/misc/nacl/go_nacl_386_exec /usr/local/bin/
-ln -s $GOROOT/misc/nacl/go_nacl_amd64p32_exec /usr/local/bin/
-
-cd $GOROOT
-git clean -f -d -x
-git checkout master
diff --git a/env/linux-x86-nacl/scripts/install-apt-deps.sh b/env/linux-x86-nacl/scripts/install-apt-deps.sh
deleted file mode 100755
index 0034fa6..0000000
--- a/env/linux-x86-nacl/scripts/install-apt-deps.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-set -ex
-
-apt-get update
-# curl is needed to fetch the sel_ldr nacl binaries:
-apt-get install -y --no-install-recommends curl ca-certificates
-# For building Go's bootstrap 'dist' prog
-apt-get install -y --no-install-recommends gcc libc6-dev
-# For interacting with the Go source & subrepos:
-apt-get install -y --no-install-recommends git-core
-# For 32-bit nacl:
-apt-get install -y --no-install-recommends libc6-i386 libc6-dev-i386 lib32stdc++6 gcc-multilib
-
-apt-get clean
-rm -fr /var/lib/apt/lists