1
0
mirror of https://github.com/golang/go synced 2024-09-29 01:14:29 -06:00

cmd/dist: add map of broken ports and -force flag

It's empty so far. The next CL adds linux/sparc64.

Also add -force flag to the bootstrap.bash script
so that it's possible to use it with broken ports.

For #56679.

Change-Id: I09c733d0df0a68df34fb808eae29be010a6da461
Reviewed-on: https://go-review.googlesource.com/c/go/+/458515
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Dmitri Shuralyov 2022-12-19 16:50:24 -05:00 committed by Gopher Robot
parent e7495d8737
commit 399ad79fa6
2 changed files with 25 additions and 5 deletions

View File

@ -21,10 +21,16 @@
set -e set -e
if [ "$GOOS" = "" -o "$GOARCH" = "" ]; then if [ "$GOOS" = "" -o "$GOARCH" = "" ]; then
echo "usage: GOOS=os GOARCH=arch ./bootstrap.bash" >&2 echo "usage: GOOS=os GOARCH=arch ./bootstrap.bash [-force]" >&2
exit 2 exit 2
fi fi
forceflag=""
if [ "$1" = "-force" ]; then
forceflag=-force
shift
fi
targ="../../go-${GOOS}-${GOARCH}-bootstrap" targ="../../go-${GOOS}-${GOARCH}-bootstrap"
if [ -e $targ ]; then if [ -e $targ ]; then
echo "$targ already exists; remove before continuing" echo "$targ already exists; remove before continuing"
@ -47,7 +53,7 @@ echo
echo "#### Building $targ" echo "#### Building $targ"
echo echo
cd src cd src
./make.bash --no-banner ./make.bash --no-banner $forceflag
gohostos="$(../bin/go env GOHOSTOS)" gohostos="$(../bin/go env GOHOSTOS)"
gohostarch="$(../bin/go env GOHOSTARCH)" gohostarch="$(../bin/go env GOHOSTARCH)"
goos="$(../bin/go env GOOS)" goos="$(../bin/go env GOOS)"

20
src/cmd/dist/build.go vendored
View File

@ -1314,10 +1314,12 @@ func cmdbootstrap() {
var noBanner, noClean bool var noBanner, noClean bool
var debug bool var debug bool
var force bool
flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all") flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process") flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process")
flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner") flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner")
flag.BoolVar(&noClean, "no-clean", noClean, "print deprecation warning") flag.BoolVar(&noClean, "no-clean", noClean, "print deprecation warning")
flag.BoolVar(&force, "force", force, "build even if the port is marked as broken")
xflagparse(0) xflagparse(0)
@ -1325,6 +1327,12 @@ func cmdbootstrap() {
xprintf("warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead\n") xprintf("warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead\n")
} }
// Don't build broken ports by default.
if broken[goos+"/"+goarch] && !force {
fatalf("build stopped because the port %s/%s is marked as broken\n\n"+
"Use the -force flag to build anyway.\n", goos, goarch)
}
// Set GOPATH to an internal directory. We shouldn't actually // Set GOPATH to an internal directory. We shouldn't actually
// need to store files here, since the toolchain won't // need to store files here, since the toolchain won't
// depend on modules outside of vendor directories, but if // depend on modules outside of vendor directories, but if
@ -1674,12 +1682,18 @@ var cgoEnabled = map[string]bool{
} }
// List of platforms which are supported but not complete yet. These get // List of platforms which are supported but not complete yet. These get
// filtered out of cgoEnabled for 'dist list'. See golang.org/issue/28944 // filtered out of cgoEnabled for 'dist list'. See go.dev/issue/28944.
var incomplete = map[string]bool{ var incomplete = map[string]bool{
"linux/sparc64": true, "linux/sparc64": true,
} }
// List of platforms which are first class ports. See golang.org/issue/38874. // List of platforms that are marked as broken ports.
// These require -force flag to build, and also
// get filtered out of cgoEnabled for 'dist list'.
// See go.dev/issue/56679.
var broken = map[string]bool{}
// List of platforms which are first class ports. See go.dev/issue/38874.
var firstClass = map[string]bool{ var firstClass = map[string]bool{
"darwin/amd64": true, "darwin/amd64": true,
"darwin/arm64": true, "darwin/arm64": true,
@ -1825,7 +1839,7 @@ func cmdlist() {
var plats []string var plats []string
for p := range cgoEnabled { for p := range cgoEnabled {
if incomplete[p] { if broken[p] || incomplete[p] {
continue continue
} }
plats = append(plats, p) plats = append(plats, p)