mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
build, internal, swarm: enhance build/release process
This commit is contained in:
parent
fd5138140a
commit
8635fc1fed
15 changed files with 150 additions and 51 deletions
115
build/ci.go
115
build/ci.go
|
|
@ -62,6 +62,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
gethVersionFile = "VERSION"
|
||||||
|
swarmVersionFile = "swarm/VERSION"
|
||||||
|
|
||||||
// Files that end up in the geth*.zip archive.
|
// Files that end up in the geth*.zip archive.
|
||||||
gethArchiveFiles = []string{
|
gethArchiveFiles = []string{
|
||||||
"COPYING",
|
"COPYING",
|
||||||
|
|
@ -77,10 +80,15 @@ var (
|
||||||
executablePath("geth"),
|
executablePath("geth"),
|
||||||
executablePath("puppeth"),
|
executablePath("puppeth"),
|
||||||
executablePath("rlpdump"),
|
executablePath("rlpdump"),
|
||||||
executablePath("swarm"),
|
|
||||||
executablePath("wnode"),
|
executablePath("wnode"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Files that end up in the swarm*.zip archive.
|
||||||
|
swarmArchiveFiles = []string{
|
||||||
|
"COPYING",
|
||||||
|
executablePath("swarm"),
|
||||||
|
}
|
||||||
|
|
||||||
// A debian package is created for all executables listed here.
|
// A debian package is created for all executables listed here.
|
||||||
debExecutables = []debExecutable{
|
debExecutables = []debExecutable{
|
||||||
{
|
{
|
||||||
|
|
@ -107,15 +115,37 @@ var (
|
||||||
BinaryName: "rlpdump",
|
BinaryName: "rlpdump",
|
||||||
Description: "Developer utility tool that prints RLP structures.",
|
Description: "Developer utility tool that prints RLP structures.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
BinaryName: "wnode",
|
||||||
|
Description: "Ethereum Whisper diagnostic tool",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// A debian package is created for all executables listed here.
|
||||||
|
debSwarmExecutables = []debExecutable{
|
||||||
{
|
{
|
||||||
BinaryName: "swarm",
|
BinaryName: "swarm",
|
||||||
PackageName: "ethereum-swarm",
|
PackageName: "ethereum-swarm",
|
||||||
Description: "Ethereum Swarm daemon and tools",
|
Description: "Ethereum Swarm daemon and tools",
|
||||||
},
|
},
|
||||||
{
|
}
|
||||||
BinaryName: "wnode",
|
|
||||||
Description: "Ethereum Whisper diagnostic tool",
|
debSwarm = debPackage{
|
||||||
},
|
Name: "ethereum-swarm",
|
||||||
|
VersionFilePath: "swarm/VERSION",
|
||||||
|
Executables: debSwarmExecutables,
|
||||||
|
}
|
||||||
|
|
||||||
|
debEthereum = debPackage{
|
||||||
|
Name: "ethereum",
|
||||||
|
VersionFilePath: "VERSION",
|
||||||
|
Executables: debExecutables,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debian meta packages to build and push to Ubuntu PPA
|
||||||
|
debPackages = []debPackage{
|
||||||
|
debSwarm,
|
||||||
|
debEthereum,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Distros for which packages are created.
|
// Distros for which packages are created.
|
||||||
|
|
@ -352,7 +382,6 @@ func doLint(cmdline []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release Packaging
|
// Release Packaging
|
||||||
|
|
||||||
func doArchive(cmdline []string) {
|
func doArchive(cmdline []string) {
|
||||||
var (
|
var (
|
||||||
arch = flag.String("arch", runtime.GOARCH, "Architecture cross packaging")
|
arch = flag.String("arch", runtime.GOARCH, "Architecture cross packaging")
|
||||||
|
|
@ -373,9 +402,13 @@ func doArchive(cmdline []string) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
env = build.Env()
|
env = build.Env()
|
||||||
base = archiveBasename(*arch, env)
|
|
||||||
geth = "geth-" + base + ext
|
basegeth = archiveBasename(*arch, env, gethVersionFile)
|
||||||
alltools = "geth-alltools-" + base + ext
|
geth = "geth-" + basegeth + ext
|
||||||
|
alltools = "geth-alltools-" + basegeth + ext
|
||||||
|
|
||||||
|
baseswarm = archiveBasename(*arch, env, swarmVersionFile)
|
||||||
|
swarm = "swarm-" + baseswarm + ext
|
||||||
)
|
)
|
||||||
maybeSkipArchive(env)
|
maybeSkipArchive(env)
|
||||||
if err := build.WriteArchive(geth, gethArchiveFiles); err != nil {
|
if err := build.WriteArchive(geth, gethArchiveFiles); err != nil {
|
||||||
|
|
@ -384,14 +417,17 @@ func doArchive(cmdline []string) {
|
||||||
if err := build.WriteArchive(alltools, allToolsArchiveFiles); err != nil {
|
if err := build.WriteArchive(alltools, allToolsArchiveFiles); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
for _, archive := range []string{geth, alltools} {
|
if err := build.WriteArchive(swarm, swarmArchiveFiles); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, archive := range []string{geth, alltools, swarm} {
|
||||||
if err := archiveUpload(archive, *upload, *signer); err != nil {
|
if err := archiveUpload(archive, *upload, *signer); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func archiveBasename(arch string, env build.Environment) string {
|
func archiveBasename(arch string, env build.Environment, versionFilePath string) string {
|
||||||
platform := runtime.GOOS + "-" + arch
|
platform := runtime.GOOS + "-" + arch
|
||||||
if arch == "arm" {
|
if arch == "arm" {
|
||||||
platform += os.Getenv("GOARM")
|
platform += os.Getenv("GOARM")
|
||||||
|
|
@ -402,11 +438,11 @@ func archiveBasename(arch string, env build.Environment) string {
|
||||||
if arch == "ios" {
|
if arch == "ios" {
|
||||||
platform = "ios-all"
|
platform = "ios-all"
|
||||||
}
|
}
|
||||||
return platform + "-" + archiveVersion(env)
|
return platform + "-" + archiveVersion(env, versionFilePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func archiveVersion(env build.Environment) string {
|
func archiveVersion(env build.Environment, versionFilePath string) string {
|
||||||
version := build.VERSION()
|
version := build.VERSION(versionFilePath)
|
||||||
if isUnstableBuild(env) {
|
if isUnstableBuild(env) {
|
||||||
version += "-unstable"
|
version += "-unstable"
|
||||||
}
|
}
|
||||||
|
|
@ -463,7 +499,6 @@ func maybeSkipArchive(env build.Environment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debian Packaging
|
// Debian Packaging
|
||||||
|
|
||||||
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`)
|
||||||
|
|
@ -487,9 +522,10 @@ func doDebianSource(cmdline []string) {
|
||||||
build.MustRun(gpg)
|
build.MustRun(gpg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the packages.
|
// Create Debian packages and upload them
|
||||||
|
for _, pkg := range debPackages {
|
||||||
for _, distro := range debDistros {
|
for _, distro := range debDistros {
|
||||||
meta := newDebMetadata(distro, *signer, env, now)
|
meta := newDebMetadata(distro, *signer, env, now, pkg.Name, build.VERSION(pkg.VersionFilePath), pkg.Executables)
|
||||||
pkgdir := stageDebianSource(*workdir, meta)
|
pkgdir := stageDebianSource(*workdir, meta)
|
||||||
debuild := exec.Command("debuild", "-S", "-sa", "-us", "-uc")
|
debuild := exec.Command("debuild", "-S", "-sa", "-us", "-uc")
|
||||||
debuild.Dir = pkgdir
|
debuild.Dir = pkgdir
|
||||||
|
|
@ -504,6 +540,7 @@ func doDebianSource(cmdline []string) {
|
||||||
build.MustRunCommand("dput", *upload, changes)
|
build.MustRunCommand("dput", *upload, changes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeWorkdir(wdflag string) string {
|
func makeWorkdir(wdflag string) string {
|
||||||
|
|
@ -526,9 +563,17 @@ func isUnstableBuild(env build.Environment) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type debPackage struct {
|
||||||
|
Name string // the name of the Debian package to produce, e.g. "ethereum", or "ethereum-swarm"
|
||||||
|
VersionFilePath string // the relative path to the version file to be used for the package, e.g. "VERSION", or "swarm/VERSION"
|
||||||
|
Executables []debExecutable // executables to be included in the package
|
||||||
|
}
|
||||||
|
|
||||||
type debMetadata struct {
|
type debMetadata struct {
|
||||||
Env build.Environment
|
Env build.Environment
|
||||||
|
|
||||||
|
PackageName string
|
||||||
|
|
||||||
// go-ethereum version being built. Note that this
|
// go-ethereum version being built. Note that this
|
||||||
// is not the debian package version. The package version
|
// is not the debian package version. The package version
|
||||||
// is constructed by VersionString.
|
// is constructed by VersionString.
|
||||||
|
|
@ -554,18 +599,19 @@ func (d debExecutable) Package() string {
|
||||||
return d.BinaryName
|
return d.BinaryName
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDebMetadata(distro, author string, env build.Environment, t time.Time) debMetadata {
|
func newDebMetadata(distro, author string, env build.Environment, t time.Time, name string, version string, exes []debExecutable) debMetadata {
|
||||||
if author == "" {
|
if author == "" {
|
||||||
// No signing key, use default author.
|
// No signing key, use default author.
|
||||||
author = "Ethereum Builds <fjl@ethereum.org>"
|
author = "Ethereum Builds <fjl@ethereum.org>"
|
||||||
}
|
}
|
||||||
return debMetadata{
|
return debMetadata{
|
||||||
|
PackageName: name,
|
||||||
Env: env,
|
Env: env,
|
||||||
Author: author,
|
Author: author,
|
||||||
Distro: distro,
|
Distro: distro,
|
||||||
Version: build.VERSION(),
|
Version: version,
|
||||||
Time: t.Format(time.RFC1123Z),
|
Time: t.Format(time.RFC1123Z),
|
||||||
Executables: debExecutables,
|
Executables: exes,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -573,9 +619,9 @@ func newDebMetadata(distro, author string, env build.Environment, t time.Time) d
|
||||||
// on all executable packages.
|
// on all executable packages.
|
||||||
func (meta debMetadata) Name() string {
|
func (meta debMetadata) Name() string {
|
||||||
if isUnstableBuild(meta.Env) {
|
if isUnstableBuild(meta.Env) {
|
||||||
return "ethereum-unstable"
|
return meta.PackageName + "-unstable"
|
||||||
}
|
}
|
||||||
return "ethereum"
|
return meta.PackageName
|
||||||
}
|
}
|
||||||
|
|
||||||
// VersionString returns the debian version of the packages.
|
// VersionString returns the debian version of the packages.
|
||||||
|
|
@ -636,24 +682,23 @@ func stageDebianSource(tmpdir string, meta debMetadata) (pkgdir string) {
|
||||||
|
|
||||||
// Put the debian build files in place.
|
// Put the debian build files in place.
|
||||||
debian := filepath.Join(pkgdir, "debian")
|
debian := filepath.Join(pkgdir, "debian")
|
||||||
build.Render("build/deb.rules", filepath.Join(debian, "rules"), 0755, meta)
|
build.Render("build/deb/"+meta.PackageName+"/deb.rules", filepath.Join(debian, "rules"), 0755, meta)
|
||||||
build.Render("build/deb.changelog", filepath.Join(debian, "changelog"), 0644, meta)
|
build.Render("build/deb/"+meta.PackageName+"/deb.changelog", filepath.Join(debian, "changelog"), 0644, meta)
|
||||||
build.Render("build/deb.control", filepath.Join(debian, "control"), 0644, meta)
|
build.Render("build/deb/"+meta.PackageName+"/deb.control", filepath.Join(debian, "control"), 0644, meta)
|
||||||
build.Render("build/deb.copyright", filepath.Join(debian, "copyright"), 0644, meta)
|
build.Render("build/deb/"+meta.PackageName+"/deb.copyright", filepath.Join(debian, "copyright"), 0644, meta)
|
||||||
build.RenderString("8\n", filepath.Join(debian, "compat"), 0644, meta)
|
build.RenderString("8\n", filepath.Join(debian, "compat"), 0644, meta)
|
||||||
build.RenderString("3.0 (native)\n", filepath.Join(debian, "source/format"), 0644, meta)
|
build.RenderString("3.0 (native)\n", filepath.Join(debian, "source/format"), 0644, meta)
|
||||||
for _, exe := range meta.Executables {
|
for _, exe := range meta.Executables {
|
||||||
install := filepath.Join(debian, meta.ExeName(exe)+".install")
|
install := filepath.Join(debian, meta.ExeName(exe)+".install")
|
||||||
docs := filepath.Join(debian, meta.ExeName(exe)+".docs")
|
docs := filepath.Join(debian, meta.ExeName(exe)+".docs")
|
||||||
build.Render("build/deb.install", install, 0644, exe)
|
build.Render("build/deb/"+meta.PackageName+"/deb.install", install, 0644, exe)
|
||||||
build.Render("build/deb.docs", docs, 0644, exe)
|
build.Render("build/deb/"+meta.PackageName+"/deb.docs", docs, 0644, exe)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkgdir
|
return pkgdir
|
||||||
}
|
}
|
||||||
|
|
||||||
// Windows installer
|
// Windows installer
|
||||||
|
|
||||||
func doWindowsInstaller(cmdline []string) {
|
func doWindowsInstaller(cmdline []string) {
|
||||||
// Parse the flags and make skip installer generation on PRs
|
// Parse the flags and make skip installer generation on PRs
|
||||||
var (
|
var (
|
||||||
|
|
@ -703,11 +748,11 @@ func doWindowsInstaller(cmdline []string) {
|
||||||
// Build the installer. This assumes that all the needed files have been previously
|
// Build the installer. This assumes that all the needed files have been previously
|
||||||
// built (don't mix building and packaging to keep cross compilation complexity to a
|
// built (don't mix building and packaging to keep cross compilation complexity to a
|
||||||
// minimum).
|
// minimum).
|
||||||
version := strings.Split(build.VERSION(), ".")
|
version := strings.Split(build.VERSION(gethVersionFile), ".")
|
||||||
if env.Commit != "" {
|
if env.Commit != "" {
|
||||||
version[2] += "-" + env.Commit[:8]
|
version[2] += "-" + env.Commit[:8]
|
||||||
}
|
}
|
||||||
installer, _ := filepath.Abs("geth-" + archiveBasename(*arch, env) + ".exe")
|
installer, _ := filepath.Abs("geth-" + archiveBasename(*arch, env, gethVersionFile) + ".exe")
|
||||||
build.MustRunCommand("makensis.exe",
|
build.MustRunCommand("makensis.exe",
|
||||||
"/DOUTPUTFILE="+installer,
|
"/DOUTPUTFILE="+installer,
|
||||||
"/DMAJORVERSION="+version[0],
|
"/DMAJORVERSION="+version[0],
|
||||||
|
|
@ -759,7 +804,7 @@ func doAndroidArchive(cmdline []string) {
|
||||||
maybeSkipArchive(env)
|
maybeSkipArchive(env)
|
||||||
|
|
||||||
// Sign and upload the archive to Azure
|
// Sign and upload the archive to Azure
|
||||||
archive := "geth-" + archiveBasename("android", env) + ".aar"
|
archive := "geth-" + archiveBasename("android", env, gethVersionFile) + ".aar"
|
||||||
os.Rename("geth.aar", archive)
|
os.Rename("geth.aar", archive)
|
||||||
|
|
||||||
if err := archiveUpload(archive, *upload, *signer); err != nil {
|
if err := archiveUpload(archive, *upload, *signer); err != nil {
|
||||||
|
|
@ -844,7 +889,7 @@ func newMavenMetadata(env build.Environment) mavenMetadata {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Render the version and package strings
|
// Render the version and package strings
|
||||||
version := build.VERSION()
|
version := build.VERSION(gethVersionFile)
|
||||||
if isUnstableBuild(env) {
|
if isUnstableBuild(env) {
|
||||||
version += "-SNAPSHOT"
|
version += "-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
|
@ -879,7 +924,7 @@ func doXCodeFramework(cmdline []string) {
|
||||||
build.MustRun(bind)
|
build.MustRun(bind)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
archive := "geth-" + archiveBasename("ios", env)
|
archive := "geth-" + archiveBasename("ios", env, gethVersionFile)
|
||||||
if err := os.Mkdir(archive, os.ModePerm); err != nil {
|
if err := os.Mkdir(archive, os.ModePerm); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -935,7 +980,7 @@ func newPodMetadata(env build.Environment, archive string) podMetadata {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
version := build.VERSION()
|
version := build.VERSION(gethVersionFile)
|
||||||
if isUnstableBuild(env) {
|
if isUnstableBuild(env) {
|
||||||
version += "-unstable." + env.Buildnum
|
version += "-unstable." + env.Buildnum
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
build/deb/ethereum-swarm/deb.control
Normal file
19
build/deb/ethereum-swarm/deb.control
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
Source: {{.Name}}
|
||||||
|
Section: science
|
||||||
|
Priority: extra
|
||||||
|
Maintainer: {{.Author}}
|
||||||
|
Build-Depends: debhelper (>= 8.0.0), golang-1.10
|
||||||
|
Standards-Version: 3.9.5
|
||||||
|
Homepage: https://ethereum.org
|
||||||
|
Vcs-Git: git://github.com/ethereum/go-ethereum.git
|
||||||
|
Vcs-Browser: https://github.com/ethereum/go-ethereum
|
||||||
|
|
||||||
|
{{range .Executables}}
|
||||||
|
Package: {{$.ExeName .}}
|
||||||
|
Conflicts: {{$.ExeConflicts .}}
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
|
Built-Using: ${misc:Built-Using}
|
||||||
|
Description: {{.Description}}
|
||||||
|
{{.Description}}
|
||||||
|
{{end}}
|
||||||
5
build/deb/ethereum/deb.changelog
Normal file
5
build/deb/ethereum/deb.changelog
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{{.Name}} ({{.VersionString}}) {{.Distro}}; urgency=low
|
||||||
|
|
||||||
|
* git build of {{.Env.Commit}}
|
||||||
|
|
||||||
|
-- {{.Author}} {{.Time}}
|
||||||
14
build/deb/ethereum/deb.copyright
Normal file
14
build/deb/ethereum/deb.copyright
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
Copyright 2018 The go-ethereum Authors
|
||||||
|
|
||||||
|
go-ethereum is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
go-ethereum is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||||
1
build/deb/ethereum/deb.docs
Normal file
1
build/deb/ethereum/deb.docs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
AUTHORS
|
||||||
1
build/deb/ethereum/deb.install
Normal file
1
build/deb/ethereum/deb.install
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
build/bin/{{.BinaryName}} usr/bin
|
||||||
13
build/deb/ethereum/deb.rules
Normal file
13
build/deb/ethereum/deb.rules
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/make -f
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
# Uncomment this to turn on verbose mode.
|
||||||
|
#export DH_VERBOSE=1
|
||||||
|
|
||||||
|
override_dh_auto_build:
|
||||||
|
build/env.sh /usr/lib/go-1.10/bin/go run build/ci.go install -git-commit={{.Env.Commit}} -git-branch={{.Env.Branch}} -git-tag={{.Env.Tag}} -buildnum={{.Env.Buildnum}} -pull-request={{.Env.IsPullRequest}}
|
||||||
|
|
||||||
|
override_dh_auto_test:
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
@ -60,9 +60,9 @@ func GOPATH() string {
|
||||||
return os.Getenv("GOPATH")
|
return os.Getenv("GOPATH")
|
||||||
}
|
}
|
||||||
|
|
||||||
// VERSION returns the content of the VERSION file.
|
// VERSION returns the content of a VERSION file.
|
||||||
func VERSION() string {
|
func VERSION(path string) string {
|
||||||
version, err := ioutil.ReadFile("VERSION")
|
version, err := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
swarm/VERSION
Normal file
1
swarm/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
0.3.1
|
||||||
Loading…
Reference in a new issue