Skip to content

Commit 399ad79

Browse files
dmitshurgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent e7495d8 commit 399ad79

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

src/bootstrap.bash

+8-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@
2121
set -e
2222

2323
if [ "$GOOS" = "" -o "$GOARCH" = "" ]; then
24-
echo "usage: GOOS=os GOARCH=arch ./bootstrap.bash" >&2
24+
echo "usage: GOOS=os GOARCH=arch ./bootstrap.bash [-force]" >&2
2525
exit 2
2626
fi
2727

28+
forceflag=""
29+
if [ "$1" = "-force" ]; then
30+
forceflag=-force
31+
shift
32+
fi
33+
2834
targ="../../go-${GOOS}-${GOARCH}-bootstrap"
2935
if [ -e $targ ]; then
3036
echo "$targ already exists; remove before continuing"
@@ -47,7 +53,7 @@ echo
4753
echo "#### Building $targ"
4854
echo
4955
cd src
50-
./make.bash --no-banner
56+
./make.bash --no-banner $forceflag
5157
gohostos="$(../bin/go env GOHOSTOS)"
5258
gohostarch="$(../bin/go env GOHOSTARCH)"
5359
goos="$(../bin/go env GOOS)"

src/cmd/dist/build.go

+17-3
Original file line numberDiff line numberDiff line change
@@ -1314,17 +1314,25 @@ func cmdbootstrap() {
13141314

13151315
var noBanner, noClean bool
13161316
var debug bool
1317+
var force bool
13171318
flag.BoolVar(&rebuildall, "a", rebuildall, "rebuild all")
13181319
flag.BoolVar(&debug, "d", debug, "enable debugging of bootstrap process")
13191320
flag.BoolVar(&noBanner, "no-banner", noBanner, "do not print banner")
13201321
flag.BoolVar(&noClean, "no-clean", noClean, "print deprecation warning")
1322+
flag.BoolVar(&force, "force", force, "build even if the port is marked as broken")
13211323

13221324
xflagparse(0)
13231325

13241326
if noClean {
13251327
xprintf("warning: --no-clean is deprecated and has no effect; use 'go install std cmd' instead\n")
13261328
}
13271329

1330+
// Don't build broken ports by default.
1331+
if broken[goos+"/"+goarch] && !force {
1332+
fatalf("build stopped because the port %s/%s is marked as broken\n\n"+
1333+
"Use the -force flag to build anyway.\n", goos, goarch)
1334+
}
1335+
13281336
// Set GOPATH to an internal directory. We shouldn't actually
13291337
// need to store files here, since the toolchain won't
13301338
// depend on modules outside of vendor directories, but if
@@ -1674,12 +1682,18 @@ var cgoEnabled = map[string]bool{
16741682
}
16751683

16761684
// List of platforms which are supported but not complete yet. These get
1677-
// filtered out of cgoEnabled for 'dist list'. See golang.org/issue/28944
1685+
// filtered out of cgoEnabled for 'dist list'. See go.dev/issue/28944.
16781686
var incomplete = map[string]bool{
16791687
"linux/sparc64": true,
16801688
}
16811689

1682-
// List of platforms which are first class ports. See golang.org/issue/38874.
1690+
// List of platforms that are marked as broken ports.
1691+
// These require -force flag to build, and also
1692+
// get filtered out of cgoEnabled for 'dist list'.
1693+
// See go.dev/issue/56679.
1694+
var broken = map[string]bool{}
1695+
1696+
// List of platforms which are first class ports. See go.dev/issue/38874.
16831697
var firstClass = map[string]bool{
16841698
"darwin/amd64": true,
16851699
"darwin/arm64": true,
@@ -1825,7 +1839,7 @@ func cmdlist() {
18251839

18261840
var plats []string
18271841
for p := range cgoEnabled {
1828-
if incomplete[p] {
1842+
if broken[p] || incomplete[p] {
18291843
continue
18301844
}
18311845
plats = append(plats, p)

0 commit comments

Comments
 (0)