Commit 5d1c7bd1 authored by Andrew Gerrand's avatar Andrew Gerrand

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
parent 2cf658f6
...@@ -29,14 +29,15 @@ import ( ...@@ -29,14 +29,15 @@ import (
) )
var ( var (
tag = flag.String("tag", "release", "mercurial tag to check out") tag = flag.String("tag", "release", "mercurial tag to check out")
repo = flag.String("repo", "https://code.google.com/p/go", "repo URL") 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") tourPath = flag.String("tour", "code.google.com/p/go-tour", "Go tour repo import path")
verbose = flag.Bool("v", false, "verbose output") verbose = flag.Bool("v", false, "verbose output")
upload = flag.Bool("upload", true, "upload resulting files to Google Code") upload = flag.Bool("upload", true, "upload resulting files to Google Code")
wxsFile = flag.String("wxs", "", "path to custom installer.wxs") wxsFile = flag.String("wxs", "", "path to custom installer.wxs")
addLabel = flag.String("label", "", "additional label to apply to file when uploading") addLabel = flag.String("label", "", "additional label to apply to file when uploading")
includeRace = flag.Bool("race", true, "build race detector packages") includeRace = flag.Bool("race", true, "build race detector packages")
versionOverride = flag.String("version", "", "override version name")
username, password string // for Google Code upload username, password string // for Google Code upload
) )
...@@ -184,28 +185,28 @@ func (b *Build) Do() error { ...@@ -184,28 +185,28 @@ func (b *Build) Do() error {
} else { } else {
_, err = b.run(src, "bash", "make.bash") _, err = b.run(src, "bash", "make.bash")
} }
} if *includeRace {
if err != nil { if err != nil {
return err return err
} }
if !b.Source && *includeRace { goCmd := filepath.Join(b.root, "bin", "go")
goCmd := filepath.Join(b.root, "bin", "go") if b.OS == "windows" {
if b.OS == "windows" { goCmd += ".exe"
goCmd += ".exe" }
} _, err = b.run(src, goCmd, "install", "-race", "std")
_, err = b.run(src, goCmd, "install", "-race", "std") if err != nil {
if err != nil { return err
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 { if err != nil {
return err return err
} }
err = b.tour()
} }
if err != nil {
if err := b.tour(); err != nil {
return err return err
} }
...@@ -229,6 +230,9 @@ func (b *Build) Do() error { ...@@ -229,6 +230,9 @@ func (b *Build) Do() error {
fullVersion = bytes.TrimSpace(fullVersion) fullVersion = bytes.TrimSpace(fullVersion)
v := bytes.SplitN(fullVersion, []byte(" "), 2) v := bytes.SplitN(fullVersion, []byte(" "), 2)
version = string(v[0]) version = string(v[0])
if *versionOverride != "" {
version = *versionOverride
}
// Write VERSION file. // Write VERSION file.
err = ioutil.WriteFile(filepath.Join(b.root, "VERSION"), fullVersion, 0644) err = ioutil.WriteFile(filepath.Join(b.root, "VERSION"), fullVersion, 0644)
...@@ -522,7 +526,12 @@ func (b *Build) Upload(version string, filename string) error { ...@@ -522,7 +526,12 @@ func (b *Build) Upload(version string, filename string) error {
ftype = "Source" ftype = "Source"
summary = fmt.Sprintf("%s (source only)", version) 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 != "" { if *addLabel != "" {
labels = append(labels, *addLabel) labels = append(labels, *addLabel)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment