Skip to content

Commit 5de71fd

Browse files
committed
cmd/release, cmd/releasebot: clean up unused code
+ The .pkg installer is now constructed by an internal process, since the binaries within the installer need to be signed using internal-only certs + 1.11 is no longer supported, so the tour is no longer shipped with the release Updates golang/go#34986 Change-Id: Ic05198dec2fdbfb26d9011944051a97c777e3898 Reviewed-on: https://go-review.googlesource.com/c/build/+/208266 Run-TryBot: Andrew Bonventre <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 99fc19b commit 5de71fd

File tree

4 files changed

+6
-198
lines changed

4 files changed

+6
-198
lines changed

cmd/release/release.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -519,18 +519,7 @@ func (b *Build) make() error {
519519
return filepath.Join(stagingDir, *version+"."+b.String()+ext+".untested")
520520
}
521521

522-
switch b.OS {
523-
case "darwin":
524-
untested := stagingFile(".pkg")
525-
if err := b.fetchFile(client, untested, "pkg"); err != nil {
526-
return err
527-
}
528-
releases = append(releases, releaseFile{
529-
Untested: untested,
530-
Final: *version + "." + b.String() + ".pkg",
531-
})
532-
cleanFiles = append(cleanFiles, "pkg")
533-
case "windows":
522+
if b.OS == "windows" {
534523
untested := stagingFile(".msi")
535524
if err := b.fetchFile(client, untested, "msi"); err != nil {
536525
return err

cmd/release/releaselet.go

Lines changed: 4 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ func main() {
3636
if err := godoc(); err != nil {
3737
log.Fatal(err)
3838
}
39-
if err := tour(); err != nil {
40-
log.Fatal(err)
41-
}
4239
if dir := archDir(); dir != "" {
4340
if err := cp("go/bin/go", "go/bin/"+dir+"/go"); err != nil {
4441
log.Fatal(err)
@@ -51,22 +48,17 @@ func main() {
5148
os.RemoveAll("go/pkg/tool/linux_amd64")
5249
}
5350
os.RemoveAll("go/pkg/obj")
54-
var err error
55-
switch runtime.GOOS {
56-
case "windows":
51+
if runtime.GOOS == "windows" {
5752
// Clean up .exe~ files; golang.org/issue/23894
5853
filepath.Walk("go", func(path string, fi os.FileInfo, err error) error {
5954
if strings.HasSuffix(path, ".exe~") {
6055
os.Remove(path)
6156
}
6257
return nil
6358
})
64-
err = windowsMSI()
65-
case "darwin":
66-
err = darwinPKG()
67-
}
68-
if err != nil {
69-
log.Fatal(err)
59+
if err := windowsMSI(); err != nil {
60+
log.Fatal(err)
61+
}
7062
}
7163
}
7264

@@ -109,51 +101,6 @@ func godoc() error {
109101
)
110102
}
111103

112-
const tourPath = "golang.org/x/tour"
113-
114-
var tourContent = []string{
115-
"content",
116-
"solutions",
117-
"static",
118-
"template",
119-
}
120-
121-
var tourPackages = []string{
122-
"pic",
123-
"reader",
124-
"tree",
125-
"wc",
126-
}
127-
128-
// TODO: Remove after Go 1.13 is released, and Go 1.11 is no longer supported.
129-
func tour() error {
130-
_, version, _ := environ()
131-
verMajor, verMinor, _ := splitVersion(version)
132-
if verMajor > 1 || verMinor >= 12 {
133-
return nil // Only include the tour in go1.11.x and earlier releases.
134-
}
135-
136-
tourSrc := filepath.Join("gopath/src", tourPath)
137-
contentDir := filepath.FromSlash("go/misc/tour")
138-
139-
// Copy all the tour content to $GOROOT/misc/tour.
140-
if err := cpAllDir(contentDir, tourSrc, tourContent...); err != nil {
141-
return err
142-
}
143-
144-
// Copy the tour source code so it's accessible with $GOPATH pointing to $GOROOT/misc/tour.
145-
tourPKGDir := filepath.Join(contentDir, "src", tourPath)
146-
if err := cpAllDir(tourPKGDir, tourSrc, tourPackages...); err != nil {
147-
return err
148-
}
149-
150-
// Copy the tour binary to the tool directory, invoked as "go tool tour".
151-
return cp(
152-
filepath.FromSlash("go/pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH+"/tour"+ext()),
153-
filepath.FromSlash("gopath/bin/"+archDir()+"/tour"+ext()),
154-
)
155-
}
156-
157104
func environ() (cwd, version string, err error) {
158105
cwd, err = os.Getwd()
159106
if err != nil {
@@ -168,75 +115,6 @@ func environ() (cwd, version string, err error) {
168115
return
169116
}
170117

171-
func darwinPKG() error {
172-
cwd, version, err := environ()
173-
if err != nil {
174-
return err
175-
}
176-
177-
// Write out darwin data that is used by the packaging process.
178-
defer os.RemoveAll("darwin")
179-
if err := writeDataFiles(darwinData, "darwin"); err != nil {
180-
return err
181-
}
182-
183-
// Create a work directory and place inside the files as they should
184-
// be on the destination file system.
185-
work := filepath.Join(cwd, "darwinpkg")
186-
if err := os.MkdirAll(work, 0755); err != nil {
187-
return err
188-
}
189-
defer os.RemoveAll(work)
190-
191-
// Write out /etc/paths.d/go.
192-
const pathsBody = "/usr/local/go/bin"
193-
pathsDir := filepath.Join(work, "etc/paths.d")
194-
pathsFile := filepath.Join(pathsDir, "go")
195-
if err := os.MkdirAll(pathsDir, 0755); err != nil {
196-
return err
197-
}
198-
if err = ioutil.WriteFile(pathsFile, []byte(pathsBody), 0644); err != nil {
199-
return err
200-
}
201-
202-
// Copy Go installation to /usr/local/go.
203-
goDir := filepath.Join(work, "usr/local/go")
204-
if err := os.MkdirAll(goDir, 0755); err != nil {
205-
return err
206-
}
207-
if err := cpDir(goDir, "go"); err != nil {
208-
return err
209-
}
210-
211-
// Build the package file.
212-
dest := "package"
213-
if err := os.Mkdir(dest, 0755); err != nil {
214-
return err
215-
}
216-
defer os.RemoveAll(dest)
217-
218-
if err := run("pkgbuild",
219-
"--identifier", "com.googlecode.go",
220-
"--version", version,
221-
"--scripts", "darwin/scripts",
222-
"--root", work,
223-
filepath.Join(dest, "com.googlecode.go.pkg"),
224-
); err != nil {
225-
return err
226-
}
227-
228-
const pkg = "pkg" // known to cmd/release
229-
if err := os.Mkdir(pkg, 0755); err != nil {
230-
return err
231-
}
232-
return run("productbuild",
233-
"--distribution", "darwin/Distribution",
234-
"--resources", "darwin/Resources",
235-
"--package-path", dest,
236-
filepath.Join(cwd, pkg, "go.pkg"), // file name irrelevant
237-
)
238-
}
239-
240118
func windowsMSI() error {
241119
cwd, version, err := environ()
242120
if err != nil {
@@ -527,63 +405,6 @@ func writeDataFiles(data map[string]string, base string) error {
527405
return nil
528406
}
529407

530-
var darwinData = map[string]string{
531-
532-
"scripts/postinstall": `#!/bin/bash
533-
GOROOT=/usr/local/go
534-
echo "Fixing permissions"
535-
cd $GOROOT
536-
find . -exec chmod ugo+r \{\} \;
537-
find bin -exec chmod ugo+rx \{\} \;
538-
find . -type d -exec chmod ugo+rx \{\} \;
539-
chmod o-w .
540-
`,
541-
542-
"scripts/preinstall": `#!/bin/bash
543-
GOROOT=/usr/local/go
544-
echo "Removing previous installation"
545-
if [ -d $GOROOT ]; then
546-
rm -r $GOROOT
547-
fi
548-
`,
549-
550-
"Distribution": `<?xml version="1.0" encoding="utf-8" standalone="no"?>
551-
<installer-script minSpecVersion="1.000000">
552-
<title>Go</title>
553-
<background mime-type="image/png" file="bg.png"/>
554-
<options customize="never" allow-external-scripts="no"/>
555-
<domains enable_localSystem="true" />
556-
<installation-check script="installCheck();"/>
557-
<script>
558-
function installCheck() {
559-
if(!(system.compareVersions(system.version.ProductVersion, '10.6.0') >= 0)) {
560-
my.result.title = 'Unable to install';
561-
my.result.message = 'Go requires Mac OS X 10.6 or later.';
562-
my.result.type = 'Fatal';
563-
return false;
564-
}
565-
if(system.files.fileExistsAtPath('/usr/local/go/bin/go')) {
566-
my.result.title = 'Previous Installation Detected';
567-
my.result.message = 'A previous installation of Go exists at /usr/local/go. This installer will remove the previous installation prior to installing. Please back up any data before proceeding.';
568-
my.result.type = 'Warning';
569-
return false;
570-
}
571-
return true;
572-
}
573-
</script>
574-
<choices-outline>
575-
<line choice="com.googlecode.go.choice"/>
576-
</choices-outline>
577-
<choice id="com.googlecode.go.choice" title="Go">
578-
<pkg-ref id="com.googlecode.go.pkg"/>
579-
</choice>
580-
<pkg-ref id="com.googlecode.go.pkg" auth="Root">com.googlecode.go.pkg</pkg-ref>
581-
</installer-script>
582-
`,
583-
584-
"Resources/bg.png": storageBase + "darwin/bg.png",
585-
}
586-
587408
// removeGodocShortcut removes the GODOC_SHORTCUT part out of the
588409
// installer.wxs file contents.
589410
func removeGodocShortcut() {

0 commit comments

Comments
 (0)