diff options
Diffstat (limited to 'misc/makerelease/makerelease.go')
-rw-r--r-- | misc/makerelease/makerelease.go | 83 |
1 files changed, 64 insertions, 19 deletions
diff --git a/misc/makerelease/makerelease.go b/misc/makerelease/makerelease.go index 2496a865a..3b511b1db 100644 --- a/misc/makerelease/makerelease.go +++ b/misc/makerelease/makerelease.go @@ -14,6 +14,7 @@ import ( "compress/gzip" "crypto/sha1" "encoding/json" + "errors" "flag" "fmt" "io" @@ -30,7 +31,7 @@ import ( "strings" "code.google.com/p/goauth2/oauth" - "code.google.com/p/google-api-go-client/storage/v1beta2" + storage "code.google.com/p/google-api-go-client/storage/v1" ) var ( @@ -53,20 +54,20 @@ var ( ) const ( - blogPath = "code.google.com/p/go.blog" - toolPath = "code.google.com/p/go.tools" + blogPath = "golang.org/x/blog" + toolPath = "golang.org/x/tools" tourPath = "code.google.com/p/go-tour" - defaultToolTag = "release-branch.go1.2" - defaultTourTag = "release-branch.go1.2" + defaultToolTag = "release-branch.go1.4" + defaultTourTag = "release-branch.go1.4" ) // Import paths for tool commands. // These must be the command that cmd/go knows to install to $GOROOT/bin // or $GOROOT/pkg/tool. var toolPaths = []string{ - "code.google.com/p/go.tools/cmd/cover", - "code.google.com/p/go.tools/cmd/godoc", - "code.google.com/p/go.tools/cmd/vet", + "golang.org/x/tools/cmd/cover", + "golang.org/x/tools/cmd/godoc", + "golang.org/x/tools/cmd/vet", } var preBuildCleanFiles = []string{ @@ -74,8 +75,8 @@ var preBuildCleanFiles = []string{ "misc/dashboard/godashboard", "src/cmd/cov", "src/cmd/prof", - "src/pkg/exp", - "src/pkg/old", + "src/exp", + "src/old", } var cleanFiles = []string{ @@ -154,6 +155,7 @@ func main() { log.Fatalln("setupOAuthClient:", err) } } + ok := true for _, targ := range flag.Args() { var b Build if m := fileRe.FindStringSubmatch(targ); m != nil { @@ -205,8 +207,12 @@ func main() { } if err := b.Do(); err != nil { log.Printf("%s: %v", targ, err) + ok = false } } + if !ok { + os.Exit(1) + } } type Build struct { @@ -432,7 +438,8 @@ func (b *Build) Do() error { // Build package. _, err = b.run(work, "candle", "-nologo", - "-dVersion="+version, + "-dGoVersion="+version, + "-dWixGoVersion="+wixVersion(version), "-dArch="+b.Arch, "-dSourceDir=go", installer, appfiles) @@ -466,6 +473,22 @@ func (b *Build) Do() error { return err } +var versionRe = regexp.MustCompile(`^go([0-9]+(\.[0-9]+)*)`) + +// The Microsoft installer requires version format major.minor.build +// (http://msdn.microsoft.com/en-us/library/aa370859%28v=vs.85%29.aspx). +// Where the major and minor field has a maximum value of 255 and build 65535. +// The offical Go version format is goMAJOR.MINOR.PATCH at $GOROOT/VERSION. +// It's based on the Mercurial tag. Remove prefix and suffix to make the +// installer happy. +func wixVersion(v string) string { + m := versionRe.FindStringSubmatch(v) + if m == nil { + return "0.0.0" + } + return m[1] +} + // extras fetches the go.tools, go.blog, and go-tour repositories, // builds them and copies the resulting binaries and static assets // to the new GOROOT. @@ -482,16 +505,38 @@ func (b *Build) extras() error { } func (b *Build) get(repoPath, revision string) error { - // Fetch the packages (without building/installing). - _, err := b.run(b.gopath, filepath.Join(b.root, "bin", "go"), - "get", "-d", repoPath+"/...") - if err != nil { - return err + dest := filepath.Join(b.gopath, "src", filepath.FromSlash(repoPath)) + + if strings.HasPrefix(repoPath, "golang.org/x/") { + // For sub-repos, fetch the old Mercurial repo; bypass "go get". + // DO NOT import this special case into the git tree. + + if err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil { + return err + } + repo := strings.Replace(repoPath, "golang.org/x/", "https://code.google.com/p/go.", 1) + if _, err := b.run(b.gopath, "hg", "clone", repo, dest); err != nil { + return err + } + } else { + // Fetch the packages (without building/installing). + _, err := b.run(b.gopath, filepath.Join(b.root, "bin", "go"), + "get", "-d", repoPath+"/...") + if err != nil { + return err + } } // Update the repo to the specified revision. - p := filepath.Join(b.gopath, "src", filepath.FromSlash(repoPath)) - _, err = b.run(p, "hg", "update", revision) + var err error + switch { + case exists(filepath.Join(dest, ".git")): + _, err = b.run(dest, "git", "checkout", revision) + case exists(filepath.Join(dest, ".hg")): + _, err = b.run(dest, "hg", "update", revision) + default: + err = errors.New("unknown version control system") + } return err } @@ -721,7 +766,7 @@ type File struct { func setupOAuthClient() error { config := &oauth.Config{ ClientId: "999119582588-h7kpj5pcm6d9solh5lgrbusmvvk4m9dn.apps.googleusercontent.com", - ClientSecret: "8YLFgOhXIELWbO", + ClientSecret: "8YLFgOhXIELWbO-NtF3iqIQz", Scope: storage.DevstorageRead_writeScope, AuthURL: "https://accounts.google.com/o/oauth2/auth", TokenURL: "https://accounts.google.com/o/oauth2/token", |