This commit is contained in:
Felix Lange 2018-03-28 08:20:40 +00:00 committed by GitHub
commit fdaf66fe1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 14 deletions

View file

@ -65,9 +65,11 @@ matrix:
- dput - dput
- gcc-multilib - gcc-multilib
- fakeroot - fakeroot
- python-bzrlib
- python-paramiko
script: script:
# Build for the primary platforms that Trusty can manage # Build for the primary platforms that Trusty can manage
- go run build/ci.go debsrc -signer "Go Ethereum Linux Builder <geth-ci@ethereum.org>" -upload ppa:ethereum/ethereum - go run build/ci.go debsrc -signer "Go Ethereum Linux Builder <geth-ci@ethereum.org>" -sftp-user geth-ci -upload ethereum/ethereum
- go run build/ci.go install - go run build/ci.go install
- go run build/ci.go archive -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds - go run build/ci.go archive -type tar -signer LINUX_SIGNING_KEY -upload gethstore/builds
- go run build/ci.go install -arch 386 - go run build/ci.go install -arch 386

View file

@ -27,7 +27,7 @@ Add the gophers PPA and install Go 1.10 and Debian packaging tools:
$ sudo apt-add-repository ppa:gophers/ubuntu/archive $ sudo apt-add-repository ppa:gophers/ubuntu/archive
$ sudo apt-get update $ sudo apt-get update
$ sudo apt-get install build-essential golang-1.10 devscripts debhelper $ sudo apt-get install build-essential golang-1.10 devscripts debhelper python-bzrlib python-paramiko
Create the source packages: Create the source packages:

View file

@ -461,7 +461,8 @@ func maybeSkipArchive(env build.Environment) {
func doDebianSource(cmdline []string) { func doDebianSource(cmdline []string) {
var ( var (
signer = flag.String("signer", "", `Signing key name, also used as package author`) signer = flag.String("signer", "", `Signing key name, also used as package author`)
upload = flag.String("upload", "", `Where to upload the source package (usually "ppa:ethereum/ethereum")`) upload = flag.String("upload", "", `Upload to a Launchpad PPA (usually "ethereum/ethereum")`)
sftpUser = flag.String("sftp-user", "", `Username for sftp upload`)
workdir = flag.String("workdir", "", `Output directory for packages (uses temp dir if unset)`) workdir = flag.String("workdir", "", `Output directory for packages (uses temp dir if unset)`)
now = time.Now() now = time.Now()
) )
@ -470,16 +471,35 @@ func doDebianSource(cmdline []string) {
env := build.Env() env := build.Env()
maybeSkipArchive(env) maybeSkipArchive(env)
// Import the signing key. // Import the GPG signing key and the SSH key for sftp.
if b64key := os.Getenv("PPA_SIGNING_KEY"); b64key != "" { if gpgkey := decodeEnvKey("PPA_SIGNING_KEY"); gpgkey != nil {
key, err := base64.StdEncoding.DecodeString(b64key)
if err != nil {
log.Fatal("invalid base64 PPA_SIGNING_KEY")
}
gpg := exec.Command("gpg", "--import") gpg := exec.Command("gpg", "--import")
gpg.Stdin = bytes.NewReader(key) gpg.Stdin = bytes.NewReader(gpgkey)
build.MustRun(gpg) build.MustRun(gpg)
} }
sshkeyFile := ""
if sshkey := decodeEnvKey("PPA_SSH_KEY"); sshkey != nil {
sshkeyFile = filepath.Join(*workdir, ".ssh-key")
ioutil.WriteFile(sshkeyFile, sshkey, 0600)
}
// Render dput.cf
dputConfig := filepath.Join(*workdir, "dput.cf")
if *upload != "" {
p := strings.Split(*upload, "/")
if len(p) != 2 {
log.Fatal("-upload PPA name must contain single /")
}
if *sftpUser == "" {
log.Fatal("-sftp-user is required for sftp upload")
}
build.Render("build/dput-launchpad.cf", dputConfig, 0644, map[string]string{
"LaunchpadUser": p[0],
"LaunchpadPPA": p[1],
"LaunchpadUserSSH": *sftpUser,
"IdentityFile": sshkeyFile,
})
}
// Create the packages. // Create the packages.
for _, distro := range debDistros { for _, distro := range debDistros {
@ -495,11 +515,25 @@ func doDebianSource(cmdline []string) {
build.MustRunCommand("debsign", changes) build.MustRunCommand("debsign", changes)
} }
if *upload != "" { if *upload != "" {
build.MustRunCommand("dput", *upload, changes) dput := exec.Command("dput", "--no-upload-log", "-c", dputConfig, *upload, changes)
dput.Stdin = strings.NewReader("yes\n") // accept SSH host key
build.MustRun(dput)
} }
} }
} }
func decodeEnvKey(variable string) []byte {
b64key := os.Getenv(variable)
if b64key == "" {
return nil
}
key, err := base64.StdEncoding.DecodeString(b64key)
if err != nil {
log.Fatal("invalid base64 " + variable)
}
return key
}
func makeWorkdir(wdflag string) string { func makeWorkdir(wdflag string) string {
var err error var err error
if wdflag != "" { if wdflag != "" {

7
build/dput-launchpad.cf Normal file
View file

@ -0,0 +1,7 @@
[{{.LaunchpadUser}}/{{.LaunchpadPPA}}]
fqdn = ppa.launchpad.net
method = sftp
incoming = ~{{.LaunchpadUser}}/ubuntu/{{.LaunchpadPPA}}/
login = {{.LaunchpadUserSSH}}
allow_unsigned_uploads = 0
{{if .IdentityFile}}ssh_config_options = IdentityFile {{.IdentityFile}}{{end}}