@@ -32,9 +32,10 @@ import (
32
32
var (
33
33
tag = flag .String ("tag" , "release" , "mercurial tag to check out" )
34
34
toolTag = flag .String ("tool" , defaultToolTag , "go.tools tag to check out" )
35
+ tourTag = flag .String ("tour" , defaultTourTag , "go-tour tag to check out" )
35
36
repo = flag .String ("repo" , "https://code.google.com/p/go" , "repo URL" )
36
37
verbose = flag .Bool ("v" , false , "verbose output" )
37
- upload = flag .Bool ("upload" , true , "upload resulting files to Google Code" )
38
+ upload = flag .Bool ("upload" , false , "upload resulting files to Google Code" )
38
39
wxsFile = flag .String ("wxs" , "" , "path to custom installer.wxs" )
39
40
addLabel = flag .String ("label" , "" , "additional label to apply to file when uploading" )
40
41
includeRace = flag .Bool ("race" , true , "build race detector packages" )
@@ -50,6 +51,7 @@ const (
50
51
toolPath = "code.google.com/p/go.tools"
51
52
tourPath = "code.google.com/p/go-tour"
52
53
defaultToolTag = "release-branch.go1.2"
54
+ defaultTourTag = "release-branch.go1.2"
53
55
)
54
56
55
57
// Import paths for tool commands.
@@ -267,15 +269,7 @@ func (b *Build) Do() error {
267
269
if err != nil {
268
270
return err
269
271
}
270
- err = b .tools ()
271
- if err != nil {
272
- return err
273
- }
274
- err = b .blog ()
275
- if err != nil {
276
- return err
277
- }
278
- err = b .tour ()
272
+ err = b .extras ()
279
273
}
280
274
if err != nil {
281
275
return err
@@ -286,13 +280,13 @@ func (b *Build) Do() error {
286
280
version string // "weekly.2012-03-04"
287
281
fullVersion []byte // "weekly.2012-03-04 9353aa1efdf3"
288
282
)
289
- pat := filepath .Join (b .root , "pkg/tool/*/makerelease *" ) // trailing * for .exe
283
+ pat := filepath .Join (b .root , "pkg/tool/*/dist *" ) // trailing * for .exe
290
284
m , err := filepath .Glob (pat )
291
285
if err != nil {
292
286
return err
293
287
}
294
288
if len (m ) == 0 {
295
- return fmt .Errorf ("couldn't find makerelease in %q" , pat )
289
+ return fmt .Errorf ("couldn't find dist in %q" , pat )
296
290
}
297
291
fullVersion , err = b .run ("" , m [0 ], "version" )
298
292
if err != nil {
@@ -349,9 +343,11 @@ func (b *Build) Do() error {
349
343
err = makeTar (targ , work )
350
344
targs = append (targs , targ )
351
345
346
+ makerelease := filepath .Join (runtime .GOROOT (), "misc/makerelease" )
347
+
352
348
// build pkg
353
349
// arrange work so it's laid out as the dest filesystem
354
- etc := filepath .Join (b . root , "misc/makerelease/ darwin/etc" )
350
+ etc := filepath .Join (makerelease , "darwin/etc" )
355
351
_ , err = b .run (work , "cp" , "-r" , etc , "." )
356
352
if err != nil {
357
353
return err
@@ -371,7 +367,6 @@ func (b *Build) Do() error {
371
367
return err
372
368
}
373
369
defer os .RemoveAll (pkgdest )
374
- makerelease := filepath .Join (runtime .GOROOT (), "misc/makerelease" )
375
370
_ , err = b .run ("" , "pkgbuild" ,
376
371
"--identifier" , "com.googlecode.go" ,
377
372
"--version" , version ,
@@ -460,26 +455,44 @@ func (b *Build) Do() error {
460
455
return err
461
456
}
462
457
463
- func (b * Build ) tools () error {
458
+ // extras fetches the go.tools, go.blog, and go-tour repositories,
459
+ // builds them and copies the resulting binaries and static assets
460
+ // to the new GOROOT.
461
+ func (b * Build ) extras () error {
464
462
defer b .cleanGopath ()
465
463
466
- // Fetch the tool packages (without building/installing).
467
- args := append ([] string { "get" , "-d" }, toolPaths ... )
468
- _ , err := b . run ( b . gopath , filepath . Join ( b . root , "bin" , "go" ), args ... )
469
- if err != nil {
464
+ if err := b . tools (); err != nil {
465
+ return err
466
+ }
467
+ if err := b . blog (); err != nil {
470
468
return err
471
469
}
470
+ return b .tour ()
471
+ }
472
472
473
- // Update the repo to the revision specified by -tool.
474
- repoPath := filepath .Join (b .gopath , "src" , filepath .FromSlash (toolPath ))
475
- _ , err = b .run (repoPath , "hg" , "update" , * toolTag )
473
+ func (b * Build ) get (repoPath , revision string ) error {
474
+ // Fetch the packages (without building/installing).
475
+ _ , err := b .run (b .gopath , filepath .Join (b .root , "bin" , "go" ),
476
+ "get" , "-d" , repoPath + "/..." )
476
477
if err != nil {
477
478
return err
478
479
}
479
480
481
+ // Update the repo to the specified revision.
482
+ p := filepath .Join (b .gopath , "src" , filepath .FromSlash (repoPath ))
483
+ _ , err = b .run (p , "hg" , "update" , revision )
484
+ return err
485
+ }
486
+
487
+ func (b * Build ) tools () error {
488
+ // Fetch the go.tools repository.
489
+ if err := b .get (toolPath , * toolTag ); err != nil {
490
+ return err
491
+ }
492
+
480
493
// Install tools.
481
- args = append ([]string {"install" }, toolPaths ... )
482
- _ , err = b .run (b .gopath , filepath .Join (b .root , "bin" , "go" ), args ... )
494
+ args : = append ([]string {"install" }, toolPaths ... )
495
+ _ , err : = b .run (b .gopath , filepath .Join (b .root , "bin" , "go" ), args ... )
483
496
if err != nil {
484
497
return err
485
498
}
@@ -508,8 +521,6 @@ func (b *Build) tools() error {
508
521
}
509
522
510
523
func (b * Build ) blog () error {
511
- defer b .cleanGopath ()
512
-
513
524
// Fetch the blog repository.
514
525
_ , err := b .run (b .gopath , filepath .Join (b .root , "bin" , "go" ), "get" , "-d" , blogPath + "/blog" )
515
526
if err != nil {
@@ -523,10 +534,14 @@ func (b *Build) blog() error {
523
534
}
524
535
525
536
func (b * Build ) tour () error {
526
- defer b .cleanGopath ()
537
+ // Fetch the go-tour repository.
538
+ if err := b .get (tourPath , * tourTag ); err != nil {
539
+ return err
540
+ }
527
541
528
- // go get the gotour package.
529
- _ , err := b .run (b .gopath , filepath .Join (b .root , "bin" , "go" ), "get" , tourPath + "/gotour" )
542
+ // Build tour binary.
543
+ _ , err := b .run (b .gopath , filepath .Join (b .root , "bin" , "go" ),
544
+ "install" , tourPath + "/gotour" )
530
545
if err != nil {
531
546
return err
532
547
}
0 commit comments