aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2018-07-30 16:56:40 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-07-30 16:56:40 +0800
commita5d5609e3810fd161e55950eb44d8314e3f1e169 (patch)
tree1b387f33124da896bd19430dc1dfda882abd101f /build
parent93c0f1715d1ce6e590811a659d20f0e80277ba6a (diff)
downloadgo-tangerine-a5d5609e3810fd161e55950eb44d8314e3f1e169.tar.gz
go-tangerine-a5d5609e3810fd161e55950eb44d8314e3f1e169.tar.zst
go-tangerine-a5d5609e3810fd161e55950eb44d8314e3f1e169.zip
build: rename swarm deb package to ethereum-swarm; change swarm deb version from 1.8.x to 0.3.x (#16988)
* build: add support for different package and binary names * build: bump up copyright date * build: change default PackageName to empty string * build, internal, swarm: enhance build/release process * build: hack ethereum-swarm as a "depends" in deb package * build/ci: remove redundant variables * build, cmd, mobile, params, swarm: remove VERSION file; rename Version to VersionMeta; * internal: remove VERSION() method which reads VERSION file * build: fix VersionFilePath to Version * Makefile: remove clean_go_build_cache.sh until it works * Makefile: revert removal of clean_go_build_cache.sh
Diffstat (limited to 'build')
-rw-r--r--build/ci.go190
-rw-r--r--build/deb.install1
-rw-r--r--build/deb/ethereum-swarm/deb.changelog (renamed from build/deb.changelog)0
-rw-r--r--build/deb/ethereum-swarm/deb.control19
-rw-r--r--build/deb/ethereum-swarm/deb.copyright (renamed from build/deb.copyright)2
-rw-r--r--build/deb/ethereum-swarm/deb.docs (renamed from build/deb.docs)0
-rw-r--r--build/deb/ethereum-swarm/deb.install1
-rw-r--r--build/deb/ethereum-swarm/deb.rules (renamed from build/deb.rules)0
-rw-r--r--build/deb/ethereum/deb.changelog5
-rw-r--r--build/deb/ethereum/deb.control (renamed from build/deb.control)6
-rw-r--r--build/deb/ethereum/deb.copyright14
-rw-r--r--build/deb/ethereum/deb.docs1
-rw-r--r--build/deb/ethereum/deb.install1
-rw-r--r--build/deb/ethereum/deb.rules13
14 files changed, 181 insertions, 72 deletions
diff --git a/build/ci.go b/build/ci.go
index 2aa85edb4..b3a986dca 100644
--- a/build/ci.go
+++ b/build/ci.go
@@ -59,6 +59,8 @@ import (
"time"
"github.com/ethereum/go-ethereum/internal/build"
+ "github.com/ethereum/go-ethereum/params"
+ sv "github.com/ethereum/go-ethereum/swarm/version"
)
var (
@@ -77,46 +79,74 @@ var (
executablePath("geth"),
executablePath("puppeth"),
executablePath("rlpdump"),
- executablePath("swarm"),
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.
debExecutables = []debExecutable{
{
- Name: "abigen",
+ BinaryName: "abigen",
Description: "Source code generator to convert Ethereum contract definitions into easy to use, compile-time type-safe Go packages.",
},
{
- Name: "bootnode",
+ BinaryName: "bootnode",
Description: "Ethereum bootnode.",
},
{
- Name: "evm",
+ BinaryName: "evm",
Description: "Developer utility version of the EVM (Ethereum Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode.",
},
{
- Name: "geth",
+ BinaryName: "geth",
Description: "Ethereum CLI client.",
},
{
- Name: "puppeth",
+ BinaryName: "puppeth",
Description: "Ethereum private network manager.",
},
{
- Name: "rlpdump",
+ BinaryName: "rlpdump",
Description: "Developer utility tool that prints RLP structures.",
},
{
- Name: "swarm",
- Description: "Ethereum Swarm daemon and tools",
+ BinaryName: "wnode",
+ Description: "Ethereum Whisper diagnostic tool",
},
+ }
+
+ // A debian package is created for all executables listed here.
+ debSwarmExecutables = []debExecutable{
{
- Name: "wnode",
- Description: "Ethereum Whisper diagnostic tool",
+ BinaryName: "swarm",
+ PackageName: "ethereum-swarm",
+ Description: "Ethereum Swarm daemon and tools",
},
}
+ debEthereum = debPackage{
+ Name: "ethereum",
+ Version: params.Version,
+ Executables: debExecutables,
+ }
+
+ debSwarm = debPackage{
+ Name: "ethereum-swarm",
+ Version: sv.Version,
+ Executables: debSwarmExecutables,
+ }
+
+ // Debian meta packages to build and push to Ubuntu PPA
+ debPackages = []debPackage{
+ debSwarm,
+ debEthereum,
+ }
+
// Distros for which packages are created.
// Note: vivid is unsupported because there is no golang-1.6 package for it.
// Note: wily is unsupported because it was officially deprecated on lanchpad.
@@ -351,7 +381,6 @@ func doLint(cmdline []string) {
}
// Release Packaging
-
func doArchive(cmdline []string) {
var (
arch = flag.String("arch", runtime.GOARCH, "Architecture cross packaging")
@@ -371,10 +400,14 @@ func doArchive(cmdline []string) {
}
var (
- env = build.Env()
- base = archiveBasename(*arch, env)
- geth = "geth-" + base + ext
- alltools = "geth-alltools-" + base + ext
+ env = build.Env()
+
+ basegeth = archiveBasename(*arch, params.ArchiveVersion(env.Commit))
+ geth = "geth-" + basegeth + ext
+ alltools = "geth-alltools-" + basegeth + ext
+
+ baseswarm = archiveBasename(*arch, sv.ArchiveVersion(env.Commit))
+ swarm = "swarm-" + baseswarm + ext
)
maybeSkipArchive(env)
if err := build.WriteArchive(geth, gethArchiveFiles); err != nil {
@@ -383,14 +416,17 @@ func doArchive(cmdline []string) {
if err := build.WriteArchive(alltools, allToolsArchiveFiles); err != nil {
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 {
log.Fatal(err)
}
}
}
-func archiveBasename(arch string, env build.Environment) string {
+func archiveBasename(arch string, archiveVersion string) string {
platform := runtime.GOOS + "-" + arch
if arch == "arm" {
platform += os.Getenv("GOARM")
@@ -401,18 +437,7 @@ func archiveBasename(arch string, env build.Environment) string {
if arch == "ios" {
platform = "ios-all"
}
- return platform + "-" + archiveVersion(env)
-}
-
-func archiveVersion(env build.Environment) string {
- version := build.VERSION()
- if isUnstableBuild(env) {
- version += "-unstable"
- }
- if env.Commit != "" {
- version += "-" + env.Commit[:8]
- }
- return version
+ return platform + "-" + archiveVersion
}
func archiveUpload(archive string, blobstore string, signer string) error {
@@ -462,7 +487,6 @@ func maybeSkipArchive(env build.Environment) {
}
// Debian Packaging
-
func doDebianSource(cmdline []string) {
var (
signer = flag.String("signer", "", `Signing key name, also used as package author`)
@@ -486,21 +510,23 @@ func doDebianSource(cmdline []string) {
build.MustRun(gpg)
}
- // Create the packages.
- for _, distro := range debDistros {
- meta := newDebMetadata(distro, *signer, env, now)
- pkgdir := stageDebianSource(*workdir, meta)
- debuild := exec.Command("debuild", "-S", "-sa", "-us", "-uc")
- debuild.Dir = pkgdir
- build.MustRun(debuild)
+ // Create Debian packages and upload them
+ for _, pkg := range debPackages {
+ for _, distro := range debDistros {
+ meta := newDebMetadata(distro, *signer, env, now, pkg.Name, pkg.Version, pkg.Executables)
+ pkgdir := stageDebianSource(*workdir, meta)
+ debuild := exec.Command("debuild", "-S", "-sa", "-us", "-uc")
+ debuild.Dir = pkgdir
+ build.MustRun(debuild)
- changes := fmt.Sprintf("%s_%s_source.changes", meta.Name(), meta.VersionString())
- changes = filepath.Join(*workdir, changes)
- if *signer != "" {
- build.MustRunCommand("debsign", changes)
- }
- if *upload != "" {
- build.MustRunCommand("dput", *upload, changes)
+ changes := fmt.Sprintf("%s_%s_source.changes", meta.Name(), meta.VersionString())
+ changes = filepath.Join(*workdir, changes)
+ if *signer != "" {
+ build.MustRunCommand("debsign", changes)
+ }
+ if *upload != "" {
+ build.MustRunCommand("dput", *upload, changes)
+ }
}
}
}
@@ -525,9 +551,17 @@ func isUnstableBuild(env build.Environment) bool {
return true
}
+type debPackage struct {
+ Name string // the name of the Debian package to produce, e.g. "ethereum", or "ethereum-swarm"
+ Version string // the clean version of the debPackage, e.g. 1.8.12 or 0.3.0, without any metadata
+ Executables []debExecutable // executables to be included in the package
+}
+
type debMetadata struct {
Env build.Environment
+ PackageName string
+
// go-ethereum version being built. Note that this
// is not the debian package version. The package version
// is constructed by VersionString.
@@ -539,21 +573,33 @@ type debMetadata struct {
}
type debExecutable struct {
- Name, Description string
+ PackageName string
+ BinaryName string
+ Description string
+}
+
+// Package returns the name of the package if present, or
+// fallbacks to BinaryName
+func (d debExecutable) Package() string {
+ if d.PackageName != "" {
+ return d.PackageName
+ }
+ 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 == "" {
// No signing key, use default author.
author = "Ethereum Builds <fjl@ethereum.org>"
}
return debMetadata{
+ PackageName: name,
Env: env,
Author: author,
Distro: distro,
- Version: build.VERSION(),
+ Version: version,
Time: t.Format(time.RFC1123Z),
- Executables: debExecutables,
+ Executables: exes,
}
}
@@ -561,9 +607,9 @@ func newDebMetadata(distro, author string, env build.Environment, t time.Time) d
// on all executable packages.
func (meta debMetadata) Name() string {
if isUnstableBuild(meta.Env) {
- return "ethereum-unstable"
+ return meta.PackageName + "-unstable"
}
- return "ethereum"
+ return meta.PackageName
}
// VersionString returns the debian version of the packages.
@@ -590,9 +636,20 @@ func (meta debMetadata) ExeList() string {
// ExeName returns the package name of an executable package.
func (meta debMetadata) ExeName(exe debExecutable) string {
if isUnstableBuild(meta.Env) {
- return exe.Name + "-unstable"
+ return exe.Package() + "-unstable"
}
- return exe.Name
+ return exe.Package()
+}
+
+// EthereumSwarmPackageName returns the name of the swarm package based on
+// environment, e.g. "ethereum-swarm-unstable", or "ethereum-swarm".
+// This is needed so that we make sure that "ethereum" package,
+// depends on and installs "ethereum-swarm"
+func (meta debMetadata) EthereumSwarmPackageName() string {
+ if isUnstableBuild(meta.Env) {
+ return debSwarm.Name + "-unstable"
+ }
+ return debSwarm.Name
}
// ExeConflicts returns the content of the Conflicts field
@@ -607,7 +664,7 @@ func (meta debMetadata) ExeConflicts(exe debExecutable) string {
// be preferred and the conflicting files should be handled via
// alternates. We might do this eventually but using a conflict is
// easier now.
- return "ethereum, " + exe.Name
+ return "ethereum, " + exe.Package()
}
return ""
}
@@ -624,24 +681,23 @@ func stageDebianSource(tmpdir string, meta debMetadata) (pkgdir string) {
// Put the debian build files in place.
debian := filepath.Join(pkgdir, "debian")
- build.Render("build/deb.rules", filepath.Join(debian, "rules"), 0755, meta)
- build.Render("build/deb.changelog", filepath.Join(debian, "changelog"), 0644, meta)
- build.Render("build/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.rules", filepath.Join(debian, "rules"), 0755, meta)
+ build.Render("build/deb/"+meta.PackageName+"/deb.changelog", filepath.Join(debian, "changelog"), 0644, meta)
+ build.Render("build/deb/"+meta.PackageName+"/deb.control", filepath.Join(debian, "control"), 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("3.0 (native)\n", filepath.Join(debian, "source/format"), 0644, meta)
for _, exe := range meta.Executables {
install := filepath.Join(debian, meta.ExeName(exe)+".install")
docs := filepath.Join(debian, meta.ExeName(exe)+".docs")
- build.Render("build/deb.install", install, 0644, exe)
- build.Render("build/deb.docs", docs, 0644, exe)
+ build.Render("build/deb/"+meta.PackageName+"/deb.install", install, 0644, exe)
+ build.Render("build/deb/"+meta.PackageName+"/deb.docs", docs, 0644, exe)
}
return pkgdir
}
// Windows installer
-
func doWindowsInstaller(cmdline []string) {
// Parse the flags and make skip installer generation on PRs
var (
@@ -691,11 +747,11 @@ func doWindowsInstaller(cmdline []string) {
// 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
// minimum).
- version := strings.Split(build.VERSION(), ".")
+ version := strings.Split(params.Version, ".")
if env.Commit != "" {
version[2] += "-" + env.Commit[:8]
}
- installer, _ := filepath.Abs("geth-" + archiveBasename(*arch, env) + ".exe")
+ installer, _ := filepath.Abs("geth-" + archiveBasename(*arch, params.ArchiveVersion(env.Commit)) + ".exe")
build.MustRunCommand("makensis.exe",
"/DOUTPUTFILE="+installer,
"/DMAJORVERSION="+version[0],
@@ -747,7 +803,7 @@ func doAndroidArchive(cmdline []string) {
maybeSkipArchive(env)
// Sign and upload the archive to Azure
- archive := "geth-" + archiveBasename("android", env) + ".aar"
+ archive := "geth-" + archiveBasename("android", params.ArchiveVersion(env.Commit)) + ".aar"
os.Rename("geth.aar", archive)
if err := archiveUpload(archive, *upload, *signer); err != nil {
@@ -832,7 +888,7 @@ func newMavenMetadata(env build.Environment) mavenMetadata {
}
}
// Render the version and package strings
- version := build.VERSION()
+ version := params.Version
if isUnstableBuild(env) {
version += "-SNAPSHOT"
}
@@ -867,7 +923,7 @@ func doXCodeFramework(cmdline []string) {
build.MustRun(bind)
return
}
- archive := "geth-" + archiveBasename("ios", env)
+ archive := "geth-" + archiveBasename("ios", params.ArchiveVersion(env.Commit))
if err := os.Mkdir(archive, os.ModePerm); err != nil {
log.Fatal(err)
}
@@ -923,7 +979,7 @@ func newPodMetadata(env build.Environment, archive string) podMetadata {
}
}
}
- version := build.VERSION()
+ version := params.Version
if isUnstableBuild(env) {
version += "-unstable." + env.Buildnum
}
diff --git a/build/deb.install b/build/deb.install
deleted file mode 100644
index 7dc76e1f5..000000000
--- a/build/deb.install
+++ /dev/null
@@ -1 +0,0 @@
-build/bin/{{.Name}} usr/bin
diff --git a/build/deb.changelog b/build/deb/ethereum-swarm/deb.changelog
index 83f804a83..83f804a83 100644
--- a/build/deb.changelog
+++ b/build/deb/ethereum-swarm/deb.changelog
diff --git a/build/deb/ethereum-swarm/deb.control b/build/deb/ethereum-swarm/deb.control
new file mode 100644
index 000000000..8cd325bf5
--- /dev/null
+++ b/build/deb/ethereum-swarm/deb.control
@@ -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}}
diff --git a/build/deb.copyright b/build/deb/ethereum-swarm/deb.copyright
index 513be45b1..fe6e36ad9 100644
--- a/build/deb.copyright
+++ b/build/deb/ethereum-swarm/deb.copyright
@@ -1,4 +1,4 @@
-Copyright 2016 The go-ethereum Authors
+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
diff --git a/build/deb.docs b/build/deb/ethereum-swarm/deb.docs
index 62deb0497..62deb0497 100644
--- a/build/deb.docs
+++ b/build/deb/ethereum-swarm/deb.docs
diff --git a/build/deb/ethereum-swarm/deb.install b/build/deb/ethereum-swarm/deb.install
new file mode 100644
index 000000000..e7666ce5f
--- /dev/null
+++ b/build/deb/ethereum-swarm/deb.install
@@ -0,0 +1 @@
+build/bin/{{.BinaryName}} usr/bin
diff --git a/build/deb.rules b/build/deb/ethereum-swarm/deb.rules
index 7f286569e..7f286569e 100644
--- a/build/deb.rules
+++ b/build/deb/ethereum-swarm/deb.rules
diff --git a/build/deb/ethereum/deb.changelog b/build/deb/ethereum/deb.changelog
new file mode 100644
index 000000000..83f804a83
--- /dev/null
+++ b/build/deb/ethereum/deb.changelog
@@ -0,0 +1,5 @@
+{{.Name}} ({{.VersionString}}) {{.Distro}}; urgency=low
+
+ * git build of {{.Env.Commit}}
+
+ -- {{.Author}} {{.Time}}
diff --git a/build/deb.control b/build/deb/ethereum/deb.control
index 33c1a779f..e693d1d04 100644
--- a/build/deb.control
+++ b/build/deb/ethereum/deb.control
@@ -10,9 +10,9 @@ Vcs-Browser: https://github.com/ethereum/go-ethereum
Package: {{.Name}}
Architecture: any
-Depends: ${misc:Depends}, {{.ExeList}}
-Description: Meta-package to install geth and other tools
- Meta-package to install geth and other tools
+Depends: ${misc:Depends}, {{.EthereumSwarmPackageName}}, {{.ExeList}}
+Description: Meta-package to install geth, swarm, and other tools
+ Meta-package to install geth, swarm and other tools
{{range .Executables}}
Package: {{$.ExeName .}}
diff --git a/build/deb/ethereum/deb.copyright b/build/deb/ethereum/deb.copyright
new file mode 100644
index 000000000..fe6e36ad9
--- /dev/null
+++ b/build/deb/ethereum/deb.copyright
@@ -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/>.
diff --git a/build/deb/ethereum/deb.docs b/build/deb/ethereum/deb.docs
new file mode 100644
index 000000000..62deb0497
--- /dev/null
+++ b/build/deb/ethereum/deb.docs
@@ -0,0 +1 @@
+AUTHORS
diff --git a/build/deb/ethereum/deb.install b/build/deb/ethereum/deb.install
new file mode 100644
index 000000000..e7666ce5f
--- /dev/null
+++ b/build/deb/ethereum/deb.install
@@ -0,0 +1 @@
+build/bin/{{.BinaryName}} usr/bin
diff --git a/build/deb/ethereum/deb.rules b/build/deb/ethereum/deb.rules
new file mode 100644
index 000000000..7f286569e
--- /dev/null
+++ b/build/deb/ethereum/deb.rules
@@ -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 $@