@@ -58,6 +58,7 @@ import (
58
58
"strings"
59
59
"time"
60
60
61
+ "github.com/ethereum/go-ethereum/common/hexutil"
61
62
"github.com/ethereum/go-ethereum/internal/build"
62
63
"github.com/ethereum/go-ethereum/params"
63
64
)
@@ -138,7 +139,18 @@ var (
138
139
// Note: zesty is unsupported because it was officially deprecated on Launchpad.
139
140
// Note: artful is unsupported because it was officially deprecated on Launchpad.
140
141
// Note: cosmic is unsupported because it was officially deprecated on Launchpad.
141
- debDistros = []string {"trusty" , "xenial" , "bionic" , "disco" , "eoan" }
142
+ debDistroGoBoots = map [string ]string {
143
+ "trusty" : "golang-1.11" ,
144
+ "xenial" : "golang-go" ,
145
+ "bionic" : "golang-go" ,
146
+ "disco" : "golang-go" ,
147
+ "eoan" : "golang-go" ,
148
+ }
149
+
150
+ debGoBootPaths = map [string ]string {
151
+ "golang-1.11" : "/usr/lib/go-1.11" ,
152
+ "golang-go" : "/usr/lib/go" ,
153
+ }
142
154
)
143
155
144
156
var GOBIN , _ = filepath .Abs (filepath .Join ("build" , "bin" ))
@@ -459,11 +471,14 @@ func maybeSkipArchive(env build.Environment) {
459
471
// Debian Packaging
460
472
func doDebianSource (cmdline []string ) {
461
473
var (
462
- signer = flag .String ("signer" , "" , `Signing key name, also used as package author` )
463
- upload = flag .String ("upload" , "" , `Where to upload the source package (usually "ethereum/ethereum")` )
464
- sshUser = flag .String ("sftp-user" , "" , `Username for SFTP upload (usually "geth-ci")` )
465
- workdir = flag .String ("workdir" , "" , `Output directory for packages (uses temp dir if unset)` )
466
- now = time .Now ()
474
+ goversion = flag .String ("goversion" , "" , `Go version to build with (will be included in the source package)` )
475
+ gobundle = flag .String ("gobundle" , "/tmp/go.tar.gz" , `Filesystem path to cache the downloaded Go bundles at` )
476
+ gohash = flag .String ("gohash" , "" , `SHA256 checksum of the Go sources requested to build with` )
477
+ signer = flag .String ("signer" , "" , `Signing key name, also used as package author` )
478
+ upload = flag .String ("upload" , "" , `Where to upload the source package (usually "ethereum/ethereum")` )
479
+ sshUser = flag .String ("sftp-user" , "" , `Username for SFTP upload (usually "geth-ci")` )
480
+ workdir = flag .String ("workdir" , "" , `Output directory for packages (uses temp dir if unset)` )
481
+ now = time .Now ()
467
482
)
468
483
flag .CommandLine .Parse (cmdline )
469
484
* workdir = makeWorkdir (* workdir )
@@ -476,12 +491,25 @@ func doDebianSource(cmdline []string) {
476
491
gpg .Stdin = bytes .NewReader (key )
477
492
build .MustRun (gpg )
478
493
}
479
-
494
+ // Download and verify the Go source package
495
+ if err := build .EnsureGoSources (* goversion , hexutil .MustDecode ("0x" + * gohash ), * gobundle ); err != nil {
496
+ log .Fatalf ("Failed to ensure Go source package: %v" , err )
497
+ }
480
498
// Create Debian packages and upload them
481
499
for _ , pkg := range debPackages {
482
- for _ , distro := range debDistros {
483
- meta := newDebMetadata (distro , * signer , env , now , pkg .Name , pkg .Version , pkg .Executables )
500
+ for distro , goboot := range debDistroGoBoots {
501
+ // Prepare the debian package with the go-ethereum sources
502
+ meta := newDebMetadata (distro , goboot , * signer , env , now , pkg .Name , pkg .Version , pkg .Executables )
484
503
pkgdir := stageDebianSource (* workdir , meta )
504
+
505
+ // Ship the Go sources along so we have a proper thing to build with
506
+ if err := build .ExtractTarballArchive (* gobundle , pkgdir ); err != nil {
507
+ log .Fatalf ("Failed to extract Go sources: %v" , err )
508
+ }
509
+ if err := os .Rename (filepath .Join (pkgdir , "go" ), filepath .Join (pkgdir , ".go" )); err != nil {
510
+ log .Fatalf ("Failed to rename Go source folder: %v" , err )
511
+ }
512
+ // Run the packaging and upload to the PPA
485
513
debuild := exec .Command ("debuild" , "-S" , "-sa" , "-us" , "-uc" , "-d" , "-Zxz" )
486
514
debuild .Dir = pkgdir
487
515
build .MustRun (debuild )
@@ -561,7 +589,9 @@ type debPackage struct {
561
589
}
562
590
563
591
type debMetadata struct {
564
- Env build.Environment
592
+ Env build.Environment
593
+ GoBootPackage string
594
+ GoBootPath string
565
595
566
596
PackageName string
567
597
@@ -590,19 +620,21 @@ func (d debExecutable) Package() string {
590
620
return d .BinaryName
591
621
}
592
622
593
- func newDebMetadata (distro , author string , env build.Environment , t time.Time , name string , version string , exes []debExecutable ) debMetadata {
623
+ func newDebMetadata (distro , goboot , author string , env build.Environment , t time.Time , name string , version string , exes []debExecutable ) debMetadata {
594
624
if author == "" {
595
625
// No signing key, use default author.
596
626
author = "Ethereum Builds <[email protected] >"
597
627
}
598
628
return debMetadata {
599
- PackageName : name ,
600
- Env : env ,
601
- Author : author ,
602
- Distro : distro ,
603
- Version : version ,
604
- Time : t .Format (time .RFC1123Z ),
605
- Executables : exes ,
629
+ GoBootPackage : goboot ,
630
+ GoBootPath : debGoBootPaths [goboot ],
631
+ PackageName : name ,
632
+ Env : env ,
633
+ Author : author ,
634
+ Distro : distro ,
635
+ Version : version ,
636
+ Time : t .Format (time .RFC1123Z ),
637
+ Executables : exes ,
606
638
}
607
639
}
608
640
@@ -667,7 +699,6 @@ func stageDebianSource(tmpdir string, meta debMetadata) (pkgdir string) {
667
699
if err := os .Mkdir (pkgdir , 0755 ); err != nil {
668
700
log .Fatal (err )
669
701
}
670
-
671
702
// Copy the source code.
672
703
build .MustRunCommand ("git" , "checkout-index" , "-a" , "--prefix" , pkgdir + string (filepath .Separator ))
673
704
@@ -685,7 +716,6 @@ func stageDebianSource(tmpdir string, meta debMetadata) (pkgdir string) {
685
716
build .Render ("build/deb/" + meta .PackageName + "/deb.install" , install , 0644 , exe )
686
717
build .Render ("build/deb/" + meta .PackageName + "/deb.docs" , docs , 0644 , exe )
687
718
}
688
-
689
719
return pkgdir
690
720
}
691
721
0 commit comments