From: Andrew Gerrand Date: Thu, 4 Apr 2013 03:21:19 +0000 (+1100) Subject: misc/dist: add -version flag to override version name X-Git-Tag: go1.1rc2~183 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5d1c7bd1a66544376cf267706b005462b275f6a6;p=gostls13.git misc/dist: add -version flag to override version name Also, don't build the tour when making the source distribution. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/8354043 --- diff --git a/misc/dist/bindist.go b/misc/dist/bindist.go index d06a4f6e28..574c099136 100644 --- a/misc/dist/bindist.go +++ b/misc/dist/bindist.go @@ -29,14 +29,15 @@ import ( ) var ( - tag = flag.String("tag", "release", "mercurial tag to check out") - repo = flag.String("repo", "https://code.google.com/p/go", "repo URL") - tourPath = flag.String("tour", "code.google.com/p/go-tour", "Go tour repo import path") - verbose = flag.Bool("v", false, "verbose output") - upload = flag.Bool("upload", true, "upload resulting files to Google Code") - wxsFile = flag.String("wxs", "", "path to custom installer.wxs") - addLabel = flag.String("label", "", "additional label to apply to file when uploading") - includeRace = flag.Bool("race", true, "build race detector packages") + tag = flag.String("tag", "release", "mercurial tag to check out") + repo = flag.String("repo", "https://code.google.com/p/go", "repo URL") + tourPath = flag.String("tour", "code.google.com/p/go-tour", "Go tour repo import path") + verbose = flag.Bool("v", false, "verbose output") + upload = flag.Bool("upload", true, "upload resulting files to Google Code") + wxsFile = flag.String("wxs", "", "path to custom installer.wxs") + addLabel = flag.String("label", "", "additional label to apply to file when uploading") + includeRace = flag.Bool("race", true, "build race detector packages") + versionOverride = flag.String("version", "", "override version name") username, password string // for Google Code upload ) @@ -184,28 +185,28 @@ func (b *Build) Do() error { } else { _, err = b.run(src, "bash", "make.bash") } - } - if err != nil { - return err - } - if !b.Source && *includeRace { - goCmd := filepath.Join(b.root, "bin", "go") - if b.OS == "windows" { - goCmd += ".exe" - } - _, err = b.run(src, goCmd, "install", "-race", "std") - if err != nil { - return err + if *includeRace { + if err != nil { + return err + } + goCmd := filepath.Join(b.root, "bin", "go") + if b.OS == "windows" { + goCmd += ".exe" + } + _, err = b.run(src, goCmd, "install", "-race", "std") + if err != nil { + return err + } + // Re-install std without -race, so that we're not left with + // a slower, race-enabled cmd/go, cmd/godoc, etc. + _, err = b.run(src, goCmd, "install", "-a", "std") } - // Re-install std without -race, so that we're not left with - // a slower, race-enabled cmd/go, cmd/godoc, etc. - _, err = b.run(src, goCmd, "install", "-a", "std") if err != nil { return err } + err = b.tour() } - - if err := b.tour(); err != nil { + if err != nil { return err } @@ -229,6 +230,9 @@ func (b *Build) Do() error { fullVersion = bytes.TrimSpace(fullVersion) v := bytes.SplitN(fullVersion, []byte(" "), 2) version = string(v[0]) + if *versionOverride != "" { + version = *versionOverride + } // Write VERSION file. err = ioutil.WriteFile(filepath.Join(b.root, "VERSION"), fullVersion, 0644) @@ -522,7 +526,12 @@ func (b *Build) Upload(version string, filename string) error { ftype = "Source" summary = fmt.Sprintf("%s (source only)", version) } - labels = append(labels, "OpSys-"+opsys, "Type-"+ftype) + if opsys != "" { + labels = append(labels, "OpSys-"+opsys) + } + if ftype != "" { + labels = append(labels, "Type-"+ftype) + } if *addLabel != "" { labels = append(labels, *addLabel) }