diff --git a/build/checksums.txt b/build/checksums.txt
deleted file mode 100644
index b9d322aa1a..0000000000
--- a/build/checksums.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-# This file contains sha256 checksums of optional build dependencies.
-
-# version:spec-tests 1.0.6
-# https://github.com/ethereum/execution-spec-tests/releases
-# https://github.com/ethereum/execution-spec-tests/releases/download/v1.0.6/
-485af7b66cf41eb3a8c1bd46632913b8eb95995df867cf665617bbc9b4beedd1 fixtures_develop.tar.gz
-
-# version:golang 1.21.5
-# https://go.dev/dl/
-285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19 go1.21.5.src.tar.gz
-a2e1d5743e896e5fe1e7d96479c0a769254aed18cf216cf8f4c3a2300a9b3923 go1.21.5.darwin-amd64.tar.gz
-d0f8ac0c4fb3efc223a833010901d02954e3923cfe2c9a2ff0e4254a777cc9cc go1.21.5.darwin-arm64.tar.gz
-2c05bbe0dc62456b90b7ddd354a54f373b7c377a98f8b22f52ab694b4f6cca58 go1.21.5.freebsd-386.tar.gz
-30b6c64e9a77129605bc12f836422bf09eec577a8c899ee46130aeff81567003 go1.21.5.freebsd-amd64.tar.gz
-8f4dba9cf5c61757bbd7e9ebdb93b6a30a1b03f4a636a1ba0cc2f27b907ab8e1 go1.21.5.linux-386.tar.gz
-e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e go1.21.5.linux-amd64.tar.gz
-841cced7ecda9b2014f139f5bab5ae31785f35399f236b8b3e75dff2a2978d96 go1.21.5.linux-arm64.tar.gz
-837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe go1.21.5.linux-armv6l.tar.gz
-907b8c6ec4be9b184952e5d3493be66b1746442394a8bc78556c56834cd7c38b go1.21.5.linux-ppc64le.tar.gz
-9c4a81b72ebe44368813cd03684e1080a818bf915d84163abae2ed325a1b2dc0 go1.21.5.linux-s390x.tar.gz
-6da2418889dfb37763d0eb149c4a8d728c029e12f0cd54fbca0a31ae547e2d34 go1.21.5.windows-386.zip
-bbe603cde7c9dee658f45164b4d06de1eff6e6e6b800100824e7c00d56a9a92f go1.21.5.windows-amd64.zip
-9b7acca50e674294e43202df4fbc26d5af4d8bc3170a3342a1514f09a2dab5e9 go1.21.5.windows-arm64.zip
-
-# version:golangci 1.55.2
-# https://github.com/golangci/golangci-lint/releases/
-# https://github.com/golangci/golangci-lint/releases/download/v1.55.2/
-632e96e6d5294fbbe7b2c410a49c8fa01c60712a0af85a567de85bcc1623ea21 golangci-lint-1.55.2-darwin-amd64.tar.gz
-234463f059249f82045824afdcdd5db5682d0593052f58f6a3039a0a1c3899f6 golangci-lint-1.55.2-darwin-arm64.tar.gz
-2bdd105e2d4e003a9058c33a22bb191a1e0f30fa0790acca0d8fbffac1d6247c golangci-lint-1.55.2-freebsd-386.tar.gz
-e75056e8b082386676ce23eba455cf893931a792c0d87e1e3743c0aec33c7fb5 golangci-lint-1.55.2-freebsd-amd64.tar.gz
-5789b933facaf6136bd23f1d50add67b79bbcf8dfdfc9069a37f729395940a66 golangci-lint-1.55.2-freebsd-armv6.tar.gz
-7f21ab1008d05f32c954f99470fc86a83a059e530fe2add1d0b7d8ed4d8992a7 golangci-lint-1.55.2-freebsd-armv7.tar.gz
-33ab06139b9219a28251f10821da94423db30285cc2af97494cbb2a281927de9 golangci-lint-1.55.2-illumos-amd64.tar.gz
-57ce6f8ce3ad6ee45d7cc3d9a047545a851c2547637834a3fcb086c7b40b1e6b golangci-lint-1.55.2-linux-386.tar.gz
-ca21c961a33be3bc15e4292dc40c98c8dcc5463a7b6768a3afc123761630c09c golangci-lint-1.55.2-linux-amd64.tar.gz
-8eb0cee9b1dbf0eaa49871798c7f8a5b35f2960c52d776a5f31eb7d886b92746 golangci-lint-1.55.2-linux-arm64.tar.gz
-3195f3e0f37d353fd5bd415cabcd4e263f5c29d3d0ffb176c26ff3d2c75eb3bb golangci-lint-1.55.2-linux-armv6.tar.gz
-c823ee36eb1a719e171de1f2f5ca3068033dce8d9817232fd10ed71fd6650406 golangci-lint-1.55.2-linux-armv7.tar.gz
-758a5d2a356dc494bd13ed4c0d4bf5a54a4dc91267ea5ecdd87b86c7ca0624e7 golangci-lint-1.55.2-linux-loong64.tar.gz
-2c7b9abdce7cae802a67d583cd7c6dca520bff6d0e17c8535a918e2f2b437aa0 golangci-lint-1.55.2-linux-mips64.tar.gz
-024e0a15b85352cc27271285526e16a4ab66d3e67afbbe446c9808c06cb8dbed golangci-lint-1.55.2-linux-mips64le.tar.gz
-6b00f89ba5506c1de1efdd9fa17c54093013a294fefd8b9b31534db626a672ee golangci-lint-1.55.2-linux-ppc64le.tar.gz
-0faa0d047d9bf7b703ed3ea65b6117043c93504f9ca1de25ae929d3901c73d4a golangci-lint-1.55.2-linux-riscv64.tar.gz
-30dec9b22e7d5bb4e9d5ccea96da20f71cd7db3c8cf30b8ddc7cb9174c4d742a golangci-lint-1.55.2-linux-s390x.tar.gz
-5a0ede48f79ad707902fdb29be8cd2abd8302dc122b65ebae3fdfc86751c7698 golangci-lint-1.55.2-netbsd-386.tar.gz
-95af20a2e617126dd5b08122ece7819101070e1582a961067ce8c41172f901ad golangci-lint-1.55.2-netbsd-amd64.tar.gz
-94fb7dacb7527847cc95d7120904e19a2a0a81a0d50d61766c9e0251da72ab9d golangci-lint-1.55.2-netbsd-armv6.tar.gz
-ca906bce5fee9619400e4a321c56476fe4a4efb6ac4fc989d340eb5563348873 golangci-lint-1.55.2-netbsd-armv7.tar.gz
-45b442f69fc8915c4500201c0247b7f3f69544dbc9165403a61f9095f2c57355 golangci-lint-1.55.2-windows-386.zip
-f57d434d231d43417dfa631587522f8c1991220b43c8ffadb9c7bd279508bf81 golangci-lint-1.55.2-windows-amd64.zip
-fd7dc8f4c6829ee6fafb252a4d81d2155cd35da7833665cbb25d53ce7cecd990 golangci-lint-1.55.2-windows-arm64.zip
-1892c3c24f9e7ef44b02f6750c703864b6dc350129f3ec39510300007b2376f1 golangci-lint-1.55.2-windows-armv6.zip
-a5e68ae73d38748b5269fad36ac7575e3c162a5dc63ef58abdea03cc5da4522a golangci-lint-1.55.2-windows-armv7.zip
-
-# This is the builder on PPA that will build Go itself (inception-y), don't modify!
-#
-# This version is fine to be old and full of security holes, we just use it
-# to build the latest Go. Don't change it. If it ever becomes insufficient,
-# we need to switch over to a recursive builder to jump across supported
-# versions.
-#
-# version:ppa-builder 1.19.6
-# https://go.dev/dl/
-d7f0013f82e6d7f862cc6cb5c8cdb48eef5f2e239b35baa97e2f1a7466043767 go1.19.6.src.tar.gz
diff --git a/build/ci-notes.md b/build/ci-notes.md
deleted file mode 100644
index edd9adc1c2..0000000000
--- a/build/ci-notes.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Debian Packaging
-
-Tagged releases and develop branch commits are available as installable Debian packages
-for Ubuntu. Packages are built for the all Ubuntu versions which are supported by
-Canonical.
-
-Packages of develop branch commits have suffix -unstable and cannot be installed alongside
-the stable version. Switching between release streams requires user intervention.
-
-## Launchpad
-
-The packages are built and served by launchpad.net. We generate a Debian source package
-for each distribution and upload it. Their builder picks up the source package, builds it
-and installs the new version into the PPA repository. Launchpad requires a valid signature
-by a team member for source package uploads.
-
-The signing key is stored in an environment variable which Travis CI makes available to
-certain builds. Since Travis CI doesn't support FTP, SFTP is used to transfer the
-packages. To set this up yourself, you need to create a Launchpad user and add a GPG key
-and SSH key to it. Then encode both keys as base64 and configure 'secret' environment
-variables `PPA_SIGNING_KEY` and `PPA_SSH_KEY` on Travis.
-
-We want to build go-ethereum with the most recent version of Go, irrespective of the Go
-version that is available in the main Ubuntu repository. In order to make this possible,
-we bundle the entire Go sources into our own source archive and start the built job by
-compiling Go and then using that to build go-ethereum. On Trusty we have a special case
-requiring the `~gophers/ubuntu/archive` PPA since Trusty can't even build Go itself. PPA
-deps are set at https://launchpad.net/%7Eethereum/+archive/ubuntu/ethereum/+edit-dependencies
-
-## Building Packages Locally (for testing)
-
-You need to run Ubuntu to do test packaging.
-
-Install any version of Go and Debian packaging tools:
-
- $ sudo apt-get install build-essential golang-go devscripts debhelper python-bzrlib python-paramiko
-
-Create the source packages:
-
- $ go run build/ci.go debsrc -workdir dist
-
-Then go into the source package directory for your running distribution and build the package:
-
- $ cd dist/ethereum-unstable-1.9.6+bionic
- $ dpkg-buildpackage
-
-Built packages are placed in the dist/ directory.
-
- $ cd ..
- $ dpkg-deb -c geth-unstable_1.9.6+bionic_amd64.deb
diff --git a/build/ci.go b/build/ci.go
deleted file mode 100644
index 1ffbf3074d..0000000000
--- a/build/ci.go
+++ /dev/null
@@ -1,1111 +0,0 @@
-// Copyright 2016 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library 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 Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see .
-
-//go:build none
-// +build none
-
-/*
-The ci command is called from Continuous Integration scripts.
-
-Usage: go run build/ci.go
-
-Available commands are:
-
- install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables
- test [ -coverage ] [ packages... ] -- runs the tests
- lint -- runs certain pre-selected linters
- archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts
- importkeys -- imports signing keys from env
- debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
- nsis -- creates a Windows NSIS installer
- purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore
-
-For all commands, -n prevents execution of external programs (dry run mode).
-*/
-package main
-
-import (
- "bytes"
- "encoding/base64"
- "flag"
- "fmt"
- "log"
- "os"
- "os/exec"
- "path"
- "path/filepath"
- "runtime"
- "strconv"
- "strings"
- "time"
-
- "github.com/cespare/cp"
- "github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/crypto/signify"
- "github.com/ethereum/go-ethereum/internal/build"
- "github.com/ethereum/go-ethereum/params"
-)
-
-var (
- // Files that end up in the geth*.zip archive.
- gethArchiveFiles = []string{
- "COPYING",
- executablePath("geth"),
- }
-
- // Files that end up in the geth-alltools*.zip archive.
- allToolsArchiveFiles = []string{
- "COPYING",
- executablePath("abigen"),
- executablePath("bootnode"),
- executablePath("evm"),
- executablePath("geth"),
- executablePath("rlpdump"),
- executablePath("clef"),
- }
-
- // A debian package is created for all executables listed here.
- debExecutables = []debExecutable{
- {
- BinaryName: "abigen",
- Description: "Source code generator to convert Ethereum contract definitions into easy to use, compile-time type-safe Go packages.",
- },
- {
- BinaryName: "bootnode",
- Description: "Ethereum bootnode.",
- },
- {
- 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.",
- },
- {
- BinaryName: "geth",
- Description: "Ethereum CLI client.",
- },
- {
- BinaryName: "rlpdump",
- Description: "Developer utility tool that prints RLP structures.",
- },
- {
- BinaryName: "clef",
- Description: "Ethereum account management tool.",
- },
- }
-
- // A debian package is created for all executables listed here.
- debEthereum = debPackage{
- Name: "ethereum",
- Version: params.Version,
- Executables: debExecutables,
- }
-
- // Debian meta packages to build and push to Ubuntu PPA
- debPackages = []debPackage{
- debEthereum,
- }
-
- // Distros for which packages are created.
- // Note: vivid is unsupported because there is no golang-1.6 package for it.
- // Note: the following Ubuntu releases have been officially deprecated on Launchpad:
- // wily, yakkety, zesty, artful, cosmic, disco, eoan, groovy, hirsuite, impish,
- // kinetic
- debDistroGoBoots = map[string]string{
- "trusty": "golang-1.11", // 14.04, EOL: 04/2024
- "xenial": "golang-go", // 16.04, EOL: 04/2026
- "bionic": "golang-go", // 18.04, EOL: 04/2028
- "focal": "golang-go", // 20.04, EOL: 04/2030
- "jammy": "golang-go", // 22.04, EOL: 04/2032
- "lunar": "golang-go", // 23.04, EOL: 01/2024
- "mantic": "golang-go", // 23.10, EOL: 07/2024
- }
-
- debGoBootPaths = map[string]string{
- "golang-1.11": "/usr/lib/go-1.11",
- "golang-go": "/usr/lib/go",
- }
-
- // This is where the tests should be unpacked.
- executionSpecTestsDir = "tests/spec-tests"
-)
-
-var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))
-
-func executablePath(name string) string {
- if runtime.GOOS == "windows" {
- name += ".exe"
- }
- return filepath.Join(GOBIN, name)
-}
-
-func main() {
- log.SetFlags(log.Lshortfile)
-
- if !common.FileExist(filepath.Join("build", "ci.go")) {
- log.Fatal("this script must be run from the root of the repository")
- }
- if len(os.Args) < 2 {
- log.Fatal("need subcommand as first argument")
- }
- switch os.Args[1] {
- case "install":
- doInstall(os.Args[2:])
- case "test":
- doTest(os.Args[2:])
- case "lint":
- doLint(os.Args[2:])
- case "archive":
- doArchive(os.Args[2:])
- case "docker":
- doDocker(os.Args[2:])
- case "debsrc":
- doDebianSource(os.Args[2:])
- case "nsis":
- doWindowsInstaller(os.Args[2:])
- case "purge":
- doPurge(os.Args[2:])
- case "sanitycheck":
- doSanityCheck()
- default:
- log.Fatal("unknown command ", os.Args[1])
- }
-}
-
-// Compiling
-
-func doInstall(cmdline []string) {
- var (
- dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
- arch = flag.String("arch", "", "Architecture to cross build for")
- cc = flag.String("cc", "", "C compiler to cross build with")
- staticlink = flag.Bool("static", false, "Create statically-linked executable")
- )
- flag.CommandLine.Parse(cmdline)
- env := build.Env()
-
- // Configure the toolchain.
- tc := build.GoToolchain{GOARCH: *arch, CC: *cc}
- if *dlgo {
- csdb := build.MustLoadChecksums("build/checksums.txt")
- tc.Root = build.DownloadGo(csdb)
- }
- // Disable CLI markdown doc generation in release builds.
- buildTags := []string{"urfave_cli_no_docs"}
-
- // Enable linking the CKZG library since we can make it work with additional flags.
- if env.UbuntuVersion != "trusty" {
- buildTags = append(buildTags, "ckzg")
- }
-
- // Configure the build.
- gobuild := tc.Go("build", buildFlags(env, *staticlink, buildTags)...)
-
- // arm64 CI builders are memory-constrained and can't handle concurrent builds,
- // better disable it. This check isn't the best, it should probably
- // check for something in env instead.
- if env.CI && runtime.GOARCH == "arm64" {
- gobuild.Args = append(gobuild.Args, "-p", "1")
- }
- // We use -trimpath to avoid leaking local paths into the built executables.
- gobuild.Args = append(gobuild.Args, "-trimpath")
-
- // Show packages during build.
- gobuild.Args = append(gobuild.Args, "-v")
-
- // Now we choose what we're even building.
- // Default: collect all 'main' packages in cmd/ and build those.
- packages := flag.Args()
- if len(packages) == 0 {
- packages = build.FindMainPackages("./cmd")
- }
-
- // Do the build!
- for _, pkg := range packages {
- args := make([]string, len(gobuild.Args))
- copy(args, gobuild.Args)
- args = append(args, "-o", executablePath(path.Base(pkg)))
- args = append(args, pkg)
- build.MustRun(&exec.Cmd{Path: gobuild.Path, Args: args, Env: gobuild.Env})
- }
-}
-
-// buildFlags returns the go tool flags for building.
-func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (flags []string) {
- var ld []string
- if env.Commit != "" {
- ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitCommit="+env.Commit)
- ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitDate="+env.Date)
- }
- // Strip DWARF on darwin. This used to be required for certain things,
- // and there is no downside to this, so we just keep doing it.
- if runtime.GOOS == "darwin" {
- ld = append(ld, "-s")
- }
- if runtime.GOOS == "linux" {
- // Enforce the stacksize to 8M, which is the case on most platforms apart from
- // alpine Linux.
- extld := []string{"-Wl,-z,stack-size=0x800000"}
- if staticLinking {
- extld = append(extld, "-static")
- // Under static linking, use of certain glibc features must be
- // disabled to avoid shared library dependencies.
- buildTags = append(buildTags, "osusergo", "netgo")
- }
- ld = append(ld, "-extldflags", "'"+strings.Join(extld, " ")+"'")
- }
- if len(ld) > 0 {
- flags = append(flags, "-ldflags", strings.Join(ld, " "))
- }
- if len(buildTags) > 0 {
- flags = append(flags, "-tags", strings.Join(buildTags, ","))
- }
- return flags
-}
-
-// Running The Tests
-//
-// "tests" also includes static analysis tools such as vet.
-
-func doTest(cmdline []string) {
- var (
- dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
- arch = flag.String("arch", "", "Run tests for given architecture")
- cc = flag.String("cc", "", "Sets C compiler binary")
- coverage = flag.Bool("coverage", false, "Whether to record code coverage")
- verbose = flag.Bool("v", false, "Whether to log verbosely")
- race = flag.Bool("race", false, "Execute the race detector")
- short = flag.Bool("short", false, "Pass the 'short'-flag to go test")
- cachedir = flag.String("cachedir", "./build/cache", "directory for caching downloads")
- )
- flag.CommandLine.Parse(cmdline)
-
- // Get test fixtures.
- csdb := build.MustLoadChecksums("build/checksums.txt")
- downloadSpecTestFixtures(csdb, *cachedir)
-
- // Configure the toolchain.
- tc := build.GoToolchain{GOARCH: *arch, CC: *cc}
- if *dlgo {
- tc.Root = build.DownloadGo(csdb)
- }
- gotest := tc.Go("test")
-
- // CI needs a bit more time for the statetests (default 10m).
- gotest.Args = append(gotest.Args, "-timeout=20m")
-
- // Enable CKZG backend in CI.
- gotest.Args = append(gotest.Args, "-tags=ckzg")
-
- // Enable integration-tests
- gotest.Args = append(gotest.Args, "-tags=integrationtests")
-
- // Test a single package at a time. CI builders are slow
- // and some tests run into timeouts under load.
- gotest.Args = append(gotest.Args, "-p", "1")
- if *coverage {
- gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover")
- }
- if *verbose {
- gotest.Args = append(gotest.Args, "-v")
- }
- if *race {
- gotest.Args = append(gotest.Args, "-race")
- }
- if *short {
- gotest.Args = append(gotest.Args, "-short")
- }
-
- packages := []string{"./..."}
- if len(flag.CommandLine.Args()) > 0 {
- packages = flag.CommandLine.Args()
- }
- gotest.Args = append(gotest.Args, packages...)
- build.MustRun(gotest)
-}
-
-// downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures.
-func downloadSpecTestFixtures(csdb *build.ChecksumDB, cachedir string) string {
- executionSpecTestsVersion, err := build.Version(csdb, "spec-tests")
- if err != nil {
- log.Fatal(err)
- }
- ext := ".tar.gz"
- base := "fixtures_develop" // TODO(MariusVanDerWijden) rename once the version becomes part of the filename
- url := fmt.Sprintf("https://github.com/ethereum/execution-spec-tests/releases/download/v%s/%s%s", executionSpecTestsVersion, base, ext)
- archivePath := filepath.Join(cachedir, base+ext)
- if err := csdb.DownloadFile(url, archivePath); err != nil {
- log.Fatal(err)
- }
- if err := build.ExtractArchive(archivePath, executionSpecTestsDir); err != nil {
- log.Fatal(err)
- }
- return filepath.Join(cachedir, base)
-}
-
-// doLint runs golangci-lint on requested packages.
-func doLint(cmdline []string) {
- var (
- cachedir = flag.String("cachedir", "./build/cache", "directory for caching golangci-lint binary.")
- )
- flag.CommandLine.Parse(cmdline)
- packages := []string{"./..."}
- if len(flag.CommandLine.Args()) > 0 {
- packages = flag.CommandLine.Args()
- }
-
- linter := downloadLinter(*cachedir)
- lflags := []string{"run", "--config", ".golangci.yml"}
- build.MustRunCommandWithOutput(linter, append(lflags, packages...)...)
- fmt.Println("You have achieved perfection.")
-}
-
-// downloadLinter downloads and unpacks golangci-lint.
-func downloadLinter(cachedir string) string {
- csdb := build.MustLoadChecksums("build/checksums.txt")
- version, err := build.Version(csdb, "golangci")
- if err != nil {
- log.Fatal(err)
- }
- arch := runtime.GOARCH
- ext := ".tar.gz"
-
- if runtime.GOOS == "windows" {
- ext = ".zip"
- }
- if arch == "arm" {
- arch += "v" + os.Getenv("GOARM")
- }
- base := fmt.Sprintf("golangci-lint-%s-%s-%s", version, runtime.GOOS, arch)
- url := fmt.Sprintf("https://github.com/golangci/golangci-lint/releases/download/v%s/%s%s", version, base, ext)
- archivePath := filepath.Join(cachedir, base+ext)
- if err := csdb.DownloadFile(url, archivePath); err != nil {
- log.Fatal(err)
- }
- if err := build.ExtractArchive(archivePath, cachedir); err != nil {
- log.Fatal(err)
- }
- return filepath.Join(cachedir, base, "golangci-lint")
-}
-
-// Release Packaging
-func doArchive(cmdline []string) {
- var (
- arch = flag.String("arch", runtime.GOARCH, "Architecture cross packaging")
- atype = flag.String("type", "zip", "Type of archive to write (zip|tar)")
- signer = flag.String("signer", "", `Environment variable holding the signing key (e.g. LINUX_SIGNING_KEY)`)
- signify = flag.String("signify", "", `Environment variable holding the signify key (e.g. LINUX_SIGNIFY_KEY)`)
- upload = flag.String("upload", "", `Destination to upload the archives (usually "gethstore/builds")`)
- ext string
- )
- flag.CommandLine.Parse(cmdline)
- switch *atype {
- case "zip":
- ext = ".zip"
- case "tar":
- ext = ".tar.gz"
- default:
- log.Fatal("unknown archive type: ", atype)
- }
-
- var (
- env = build.Env()
- basegeth = archiveBasename(*arch, params.ArchiveVersion(env.Commit))
- geth = "geth-" + basegeth + ext
- alltools = "geth-alltools-" + basegeth + ext
- )
- maybeSkipArchive(env)
- if err := build.WriteArchive(geth, gethArchiveFiles); err != nil {
- log.Fatal(err)
- }
- if err := build.WriteArchive(alltools, allToolsArchiveFiles); err != nil {
- log.Fatal(err)
- }
- for _, archive := range []string{geth, alltools} {
- if err := archiveUpload(archive, *upload, *signer, *signify); err != nil {
- log.Fatal(err)
- }
- }
-}
-
-func archiveBasename(arch string, archiveVersion string) string {
- platform := runtime.GOOS + "-" + arch
- if arch == "arm" {
- platform += os.Getenv("GOARM")
- }
- if arch == "android" {
- platform = "android-all"
- }
- if arch == "ios" {
- platform = "ios-all"
- }
- return platform + "-" + archiveVersion
-}
-
-func archiveUpload(archive string, blobstore string, signer string, signifyVar string) error {
- // If signing was requested, generate the signature files
- if signer != "" {
- key := getenvBase64(signer)
- if err := build.PGPSignFile(archive, archive+".asc", string(key)); err != nil {
- return err
- }
- }
- if signifyVar != "" {
- key := os.Getenv(signifyVar)
- untrustedComment := "verify with geth-release.pub"
- trustedComment := fmt.Sprintf("%s (%s)", archive, time.Now().UTC().Format(time.RFC1123))
- if err := signify.SignFile(archive, archive+".sig", key, untrustedComment, trustedComment); err != nil {
- return err
- }
- }
- // If uploading to Azure was requested, push the archive possibly with its signature
- if blobstore != "" {
- auth := build.AzureBlobstoreConfig{
- Account: strings.Split(blobstore, "/")[0],
- Token: os.Getenv("AZURE_BLOBSTORE_TOKEN"),
- Container: strings.SplitN(blobstore, "/", 2)[1],
- }
- if err := build.AzureBlobstoreUpload(archive, filepath.Base(archive), auth); err != nil {
- return err
- }
- if signer != "" {
- if err := build.AzureBlobstoreUpload(archive+".asc", filepath.Base(archive+".asc"), auth); err != nil {
- return err
- }
- }
- if signifyVar != "" {
- if err := build.AzureBlobstoreUpload(archive+".sig", filepath.Base(archive+".sig"), auth); err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-// skips archiving for some build configurations.
-func maybeSkipArchive(env build.Environment) {
- if env.IsPullRequest {
- log.Printf("skipping archive creation because this is a PR build")
- os.Exit(0)
- }
- if env.Branch != "master" && !strings.HasPrefix(env.Tag, "v1.") {
- log.Printf("skipping archive creation because branch %q, tag %q is not on the inclusion list", env.Branch, env.Tag)
- os.Exit(0)
- }
-}
-
-// Builds the docker images and optionally uploads them to Docker Hub.
-func doDocker(cmdline []string) {
- var (
- image = flag.Bool("image", false, `Whether to build and push an arch specific docker image`)
- manifest = flag.String("manifest", "", `Push a multi-arch docker image for the specified architectures (usually "amd64,arm64")`)
- upload = flag.String("upload", "", `Where to upload the docker image (usually "ethereum/client-go")`)
- )
- flag.CommandLine.Parse(cmdline)
-
- // Skip building and pushing docker images for PR builds
- env := build.Env()
- maybeSkipArchive(env)
-
- // Retrieve the upload credentials and authenticate
- user := getenvBase64("DOCKER_HUB_USERNAME")
- pass := getenvBase64("DOCKER_HUB_PASSWORD")
-
- if len(user) > 0 && len(pass) > 0 {
- auther := exec.Command("docker", "login", "-u", string(user), "--password-stdin")
- auther.Stdin = bytes.NewReader(pass)
- build.MustRun(auther)
- }
- // Retrieve the version infos to build and push to the following paths:
- // - ethereum/client-go:latest - Pushes to the master branch, Geth only
- // - ethereum/client-go:stable - Version tag publish on GitHub, Geth only
- // - ethereum/client-go:alltools-latest - Pushes to the master branch, Geth & tools
- // - ethereum/client-go:alltools-stable - Version tag publish on GitHub, Geth & tools
- // - ethereum/client-go:release-. - Version tag publish on GitHub, Geth only
- // - ethereum/client-go:alltools-release-. - Version tag publish on GitHub, Geth & tools
- // - ethereum/client-go:v.. - Version tag publish on GitHub, Geth only
- // - ethereum/client-go:alltools-v.. - Version tag publish on GitHub, Geth & tools
- var tags []string
-
- switch {
- case env.Branch == "master":
- tags = []string{"latest"}
- case strings.HasPrefix(env.Tag, "v1."):
- tags = []string{"stable", fmt.Sprintf("release-1.%d", params.VersionMinor), "v" + params.Version}
- }
- // If architecture specific image builds are requested, build and push them
- if *image {
- build.MustRunCommand("docker", "build", "--build-arg", "COMMIT="+env.Commit, "--build-arg", "VERSION="+params.VersionWithMeta, "--build-arg", "BUILDNUM="+env.Buildnum, "--tag", fmt.Sprintf("%s:TAG", *upload), ".")
- build.MustRunCommand("docker", "build", "--build-arg", "COMMIT="+env.Commit, "--build-arg", "VERSION="+params.VersionWithMeta, "--build-arg", "BUILDNUM="+env.Buildnum, "--tag", fmt.Sprintf("%s:alltools-TAG", *upload), "-f", "Dockerfile.alltools", ".")
-
- // Tag and upload the images to Docker Hub
- for _, tag := range tags {
- gethImage := fmt.Sprintf("%s:%s-%s", *upload, tag, runtime.GOARCH)
- toolImage := fmt.Sprintf("%s:alltools-%s-%s", *upload, tag, runtime.GOARCH)
-
- // If the image already exists (non version tag), check the build
- // number to prevent overwriting a newer commit if concurrent builds
- // are running. This is still a tiny bit racey if two published are
- // done at the same time, but that's extremely unlikely even on the
- // master branch.
- for _, img := range []string{gethImage, toolImage} {
- if exec.Command("docker", "pull", img).Run() != nil {
- continue // Generally the only failure is a missing image, which is good
- }
- buildnum, err := exec.Command("docker", "inspect", "--format", "{{index .Config.Labels \"buildnum\"}}", img).CombinedOutput()
- if err != nil {
- log.Fatalf("Failed to inspect container: %v\nOutput: %s", err, string(buildnum))
- }
- buildnum = bytes.TrimSpace(buildnum)
-
- if len(buildnum) > 0 && len(env.Buildnum) > 0 {
- oldnum, err := strconv.Atoi(string(buildnum))
- if err != nil {
- log.Fatalf("Failed to parse old image build number: %v", err)
- }
- newnum, err := strconv.Atoi(env.Buildnum)
- if err != nil {
- log.Fatalf("Failed to parse current build number: %v", err)
- }
- if oldnum > newnum {
- log.Fatalf("Current build number %d not newer than existing %d", newnum, oldnum)
- } else {
- log.Printf("Updating %s from build %d to %d", img, oldnum, newnum)
- }
- }
- }
- build.MustRunCommand("docker", "image", "tag", fmt.Sprintf("%s:TAG", *upload), gethImage)
- build.MustRunCommand("docker", "image", "tag", fmt.Sprintf("%s:alltools-TAG", *upload), toolImage)
- build.MustRunCommand("docker", "push", gethImage)
- build.MustRunCommand("docker", "push", toolImage)
- }
- }
- // If multi-arch image manifest push is requested, assemble it
- if len(*manifest) != 0 {
- // Since different architectures are pushed by different builders, wait
- // until all required images are updated.
- var mismatch bool
- for i := 0; i < 2; i++ { // 2 attempts, second is race check
- mismatch = false // hope there's no mismatch now
-
- for _, tag := range tags {
- for _, arch := range strings.Split(*manifest, ",") {
- gethImage := fmt.Sprintf("%s:%s-%s", *upload, tag, arch)
- toolImage := fmt.Sprintf("%s:alltools-%s-%s", *upload, tag, arch)
-
- for _, img := range []string{gethImage, toolImage} {
- if out, err := exec.Command("docker", "pull", img).CombinedOutput(); err != nil {
- log.Printf("Required image %s unavailable: %v\nOutput: %s", img, err, out)
- mismatch = true
- break
- }
- buildnum, err := exec.Command("docker", "inspect", "--format", "{{index .Config.Labels \"buildnum\"}}", img).CombinedOutput()
- if err != nil {
- log.Fatalf("Failed to inspect container: %v\nOutput: %s", err, string(buildnum))
- }
- buildnum = bytes.TrimSpace(buildnum)
-
- if string(buildnum) != env.Buildnum {
- log.Printf("Build number mismatch on %s: want %s, have %s", img, env.Buildnum, buildnum)
- mismatch = true
- break
- }
- }
- if mismatch {
- break
- }
- }
- if mismatch {
- break
- }
- }
- if mismatch {
- // Build numbers mismatching, retry in a short time to
- // avoid concurrent fails in both publisher images. If
- // however the retry failed too, it means the concurrent
- // builder is still crunching, let that do the publish.
- if i == 0 {
- time.Sleep(30 * time.Second)
- }
- continue
- }
- break
- }
- if mismatch {
- log.Println("Relinquishing publish to other builder")
- return
- }
- // Assemble and push the Geth manifest image
- for _, tag := range tags {
- gethImage := fmt.Sprintf("%s:%s", *upload, tag)
-
- var gethSubImages []string
- for _, arch := range strings.Split(*manifest, ",") {
- gethSubImages = append(gethSubImages, gethImage+"-"+arch)
- }
- build.MustRunCommand("docker", append([]string{"manifest", "create", gethImage}, gethSubImages...)...)
- build.MustRunCommand("docker", "manifest", "push", gethImage)
- }
- // Assemble and push the alltools manifest image
- for _, tag := range tags {
- toolImage := fmt.Sprintf("%s:alltools-%s", *upload, tag)
-
- var toolSubImages []string
- for _, arch := range strings.Split(*manifest, ",") {
- toolSubImages = append(toolSubImages, toolImage+"-"+arch)
- }
- build.MustRunCommand("docker", append([]string{"manifest", "create", toolImage}, toolSubImages...)...)
- build.MustRunCommand("docker", "manifest", "push", toolImage)
- }
- }
-}
-
-// Debian Packaging
-func doDebianSource(cmdline []string) {
- var (
- cachedir = flag.String("cachedir", "./build/cache", `Filesystem path to cache the downloaded Go bundles at`)
- signer = flag.String("signer", "", `Signing key name, also used as package author`)
- upload = flag.String("upload", "", `Where to upload the source package (usually "ethereum/ethereum")`)
- sshUser = flag.String("sftp-user", "", `Username for SFTP upload (usually "geth-ci")`)
- workdir = flag.String("workdir", "", `Output directory for packages (uses temp dir if unset)`)
- now = time.Now()
- )
- flag.CommandLine.Parse(cmdline)
- *workdir = makeWorkdir(*workdir)
- env := build.Env()
- tc := new(build.GoToolchain)
- maybeSkipArchive(env)
-
- // Import the signing key.
- if key := getenvBase64("PPA_SIGNING_KEY"); len(key) > 0 {
- gpg := exec.Command("gpg", "--import")
- gpg.Stdin = bytes.NewReader(key)
- build.MustRun(gpg)
- }
- // Download and verify the Go source packages.
- var (
- gobootbundle = downloadGoBootstrapSources(*cachedir)
- gobundle = downloadGoSources(*cachedir)
- )
- // Download all the dependencies needed to build the sources and run the ci script
- srcdepfetch := tc.Go("mod", "download")
- srcdepfetch.Env = append(srcdepfetch.Env, "GOPATH="+filepath.Join(*workdir, "modgopath"))
- build.MustRun(srcdepfetch)
-
- cidepfetch := tc.Go("run", "./build/ci.go")
- cidepfetch.Env = append(cidepfetch.Env, "GOPATH="+filepath.Join(*workdir, "modgopath"))
- cidepfetch.Run() // Command fails, don't care, we only need the deps to start it
-
- // Create Debian packages and upload them.
- for _, pkg := range debPackages {
- for distro, goboot := range debDistroGoBoots {
- // Prepare the debian package with the go-ethereum sources.
- meta := newDebMetadata(distro, goboot, *signer, env, now, pkg.Name, pkg.Version, pkg.Executables)
- pkgdir := stageDebianSource(*workdir, meta)
-
- // Add bootstrapper Go source code
- if err := build.ExtractArchive(gobootbundle, pkgdir); err != nil {
- log.Fatalf("Failed to extract bootstrapper Go sources: %v", err)
- }
- if err := os.Rename(filepath.Join(pkgdir, "go"), filepath.Join(pkgdir, ".goboot")); err != nil {
- log.Fatalf("Failed to rename bootstrapper Go source folder: %v", err)
- }
- // Add builder Go source code
- if err := build.ExtractArchive(gobundle, pkgdir); err != nil {
- log.Fatalf("Failed to extract builder Go sources: %v", err)
- }
- if err := os.Rename(filepath.Join(pkgdir, "go"), filepath.Join(pkgdir, ".go")); err != nil {
- log.Fatalf("Failed to rename builder Go source folder: %v", err)
- }
- // Add all dependency modules in compressed form
- os.MkdirAll(filepath.Join(pkgdir, ".mod", "cache"), 0755)
- if err := cp.CopyAll(filepath.Join(pkgdir, ".mod", "cache", "download"), filepath.Join(*workdir, "modgopath", "pkg", "mod", "cache", "download")); err != nil {
- log.Fatalf("Failed to copy Go module dependencies: %v", err)
- }
- // Run the packaging and upload to the PPA
- debuild := exec.Command("debuild", "-S", "-sa", "-us", "-uc", "-d", "-Zxz", "-nc")
- debuild.Dir = pkgdir
- build.MustRun(debuild)
-
- var (
- basename = fmt.Sprintf("%s_%s", meta.Name(), meta.VersionString())
- source = filepath.Join(*workdir, basename+".tar.xz")
- dsc = filepath.Join(*workdir, basename+".dsc")
- changes = filepath.Join(*workdir, basename+"_source.changes")
- buildinfo = filepath.Join(*workdir, basename+"_source.buildinfo")
- )
- if *signer != "" {
- build.MustRunCommand("debsign", changes)
- }
- if *upload != "" {
- ppaUpload(*workdir, *upload, *sshUser, []string{source, dsc, changes, buildinfo})
- }
- }
- }
-}
-
-// downloadGoBootstrapSources downloads the Go source tarball that will be used
-// to bootstrap the builder Go.
-func downloadGoBootstrapSources(cachedir string) string {
- csdb := build.MustLoadChecksums("build/checksums.txt")
- gobootVersion, err := build.Version(csdb, "ppa-builder")
- if err != nil {
- log.Fatal(err)
- }
- file := fmt.Sprintf("go%s.src.tar.gz", gobootVersion)
- url := "https://dl.google.com/go/" + file
- dst := filepath.Join(cachedir, file)
- if err := csdb.DownloadFile(url, dst); err != nil {
- log.Fatal(err)
- }
- return dst
-}
-
-// downloadGoSources downloads the Go source tarball.
-func downloadGoSources(cachedir string) string {
- csdb := build.MustLoadChecksums("build/checksums.txt")
- dlgoVersion, err := build.Version(csdb, "golang")
- if err != nil {
- log.Fatal(err)
- }
- file := fmt.Sprintf("go%s.src.tar.gz", dlgoVersion)
- url := "https://dl.google.com/go/" + file
- dst := filepath.Join(cachedir, file)
- if err := csdb.DownloadFile(url, dst); err != nil {
- log.Fatal(err)
- }
- return dst
-}
-
-func ppaUpload(workdir, ppa, sshUser string, files []string) {
- p := strings.Split(ppa, "/")
- if len(p) != 2 {
- log.Fatal("-upload PPA name must contain single /")
- }
- if sshUser == "" {
- sshUser = p[0]
- }
- incomingDir := fmt.Sprintf("~%s/ubuntu/%s", p[0], p[1])
- // Create the SSH identity file if it doesn't exist.
- var idfile string
- if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 {
- idfile = filepath.Join(workdir, "sshkey")
- if !common.FileExist(idfile) {
- os.WriteFile(idfile, sshkey, 0600)
- }
- }
- // Upload
- dest := sshUser + "@ppa.launchpad.net"
- if err := build.UploadSFTP(idfile, dest, incomingDir, files); err != nil {
- log.Fatal(err)
- }
-}
-
-func getenvBase64(variable string) []byte {
- dec, err := base64.StdEncoding.DecodeString(os.Getenv(variable))
- if err != nil {
- log.Fatal("invalid base64 " + variable)
- }
- return []byte(dec)
-}
-
-func makeWorkdir(wdflag string) string {
- var err error
- if wdflag != "" {
- err = os.MkdirAll(wdflag, 0744)
- } else {
- wdflag, err = os.MkdirTemp("", "geth-build-")
- }
- if err != nil {
- log.Fatal(err)
- }
- return wdflag
-}
-
-func isUnstableBuild(env build.Environment) bool {
- if env.Tag != "" {
- return false
- }
- return true
-}
-
-type debPackage struct {
- Name string // the name of the Debian package to produce, e.g. "ethereum"
- Version string // the clean version of the debPackage, e.g. 1.8.12, without any metadata
- Executables []debExecutable // executables to be included in the package
-}
-
-type debMetadata struct {
- Env build.Environment
- GoBootPackage string
- GoBootPath string
-
- PackageName string
-
- // go-ethereum version being built. Note that this
- // is not the debian package version. The package version
- // is constructed by VersionString.
- Version string
-
- Author string // "name ", also selects signing key
- Distro, Time string
- Executables []debExecutable
-}
-
-type debExecutable struct {
- 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, goboot, 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 "
- }
- return debMetadata{
- GoBootPackage: goboot,
- GoBootPath: debGoBootPaths[goboot],
- PackageName: name,
- Env: env,
- Author: author,
- Distro: distro,
- Version: version,
- Time: t.Format(time.RFC1123Z),
- Executables: exes,
- }
-}
-
-// Name returns the name of the metapackage that depends
-// on all executable packages.
-func (meta debMetadata) Name() string {
- if isUnstableBuild(meta.Env) {
- return meta.PackageName + "-unstable"
- }
- return meta.PackageName
-}
-
-// VersionString returns the debian version of the packages.
-func (meta debMetadata) VersionString() string {
- vsn := meta.Version
- if meta.Env.Buildnum != "" {
- vsn += "+build" + meta.Env.Buildnum
- }
- if meta.Distro != "" {
- vsn += "+" + meta.Distro
- }
- return vsn
-}
-
-// ExeList returns the list of all executable packages.
-func (meta debMetadata) ExeList() string {
- names := make([]string, len(meta.Executables))
- for i, e := range meta.Executables {
- names[i] = meta.ExeName(e)
- }
- return strings.Join(names, ", ")
-}
-
-// ExeName returns the package name of an executable package.
-func (meta debMetadata) ExeName(exe debExecutable) string {
- if isUnstableBuild(meta.Env) {
- return exe.Package() + "-unstable"
- }
- return exe.Package()
-}
-
-// ExeConflicts returns the content of the Conflicts field
-// for executable packages.
-func (meta debMetadata) ExeConflicts(exe debExecutable) string {
- if isUnstableBuild(meta.Env) {
- // Set up the conflicts list so that the *-unstable packages
- // cannot be installed alongside the regular version.
- //
- // https://www.debian.org/doc/debian-policy/ch-relationships.html
- // is very explicit about Conflicts: and says that Breaks: should
- // 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.Package()
- }
- return ""
-}
-
-func stageDebianSource(tmpdir string, meta debMetadata) (pkgdir string) {
- pkg := meta.Name() + "-" + meta.VersionString()
- pkgdir = filepath.Join(tmpdir, pkg)
- if err := os.Mkdir(pkgdir, 0755); err != nil {
- log.Fatal(err)
- }
- // Copy the source code.
- build.MustRunCommand("git", "checkout-index", "-a", "--prefix", pkgdir+string(filepath.Separator))
-
- // Put the debian build files in place.
- debian := filepath.Join(pkgdir, "debian")
- 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/"+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 (
- arch = flag.String("arch", runtime.GOARCH, "Architecture for cross build packaging")
- signer = flag.String("signer", "", `Environment variable holding the signing key (e.g. WINDOWS_SIGNING_KEY)`)
- signify = flag.String("signify key", "", `Environment variable holding the signify signing key (e.g. WINDOWS_SIGNIFY_KEY)`)
- upload = flag.String("upload", "", `Destination to upload the archives (usually "gethstore/builds")`)
- workdir = flag.String("workdir", "", `Output directory for packages (uses temp dir if unset)`)
- )
- flag.CommandLine.Parse(cmdline)
- *workdir = makeWorkdir(*workdir)
- env := build.Env()
- maybeSkipArchive(env)
-
- // Aggregate binaries that are included in the installer
- var (
- devTools []string
- allTools []string
- gethTool string
- )
- for _, file := range allToolsArchiveFiles {
- if file == "COPYING" { // license, copied later
- continue
- }
- allTools = append(allTools, filepath.Base(file))
- if filepath.Base(file) == "geth.exe" {
- gethTool = file
- } else {
- devTools = append(devTools, file)
- }
- }
-
- // Render NSIS scripts: Installer NSIS contains two installer sections,
- // first section contains the geth binary, second section holds the dev tools.
- templateData := map[string]interface{}{
- "License": "COPYING",
- "Geth": gethTool,
- "DevTools": devTools,
- }
- build.Render("build/nsis.geth.nsi", filepath.Join(*workdir, "geth.nsi"), 0644, nil)
- build.Render("build/nsis.install.nsh", filepath.Join(*workdir, "install.nsh"), 0644, templateData)
- build.Render("build/nsis.uninstall.nsh", filepath.Join(*workdir, "uninstall.nsh"), 0644, allTools)
- build.Render("build/nsis.pathupdate.nsh", filepath.Join(*workdir, "PathUpdate.nsh"), 0644, nil)
- build.Render("build/nsis.envvarupdate.nsh", filepath.Join(*workdir, "EnvVarUpdate.nsh"), 0644, nil)
- if err := cp.CopyFile(filepath.Join(*workdir, "SimpleFC.dll"), "build/nsis.simplefc.dll"); err != nil {
- log.Fatalf("Failed to copy SimpleFC.dll: %v", err)
- }
- if err := cp.CopyFile(filepath.Join(*workdir, "COPYING"), "COPYING"); err != nil {
- log.Fatalf("Failed to copy copyright note: %v", err)
- }
- // 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(params.Version, ".")
- if env.Commit != "" {
- version[2] += "-" + env.Commit[:8]
- }
- installer, err := filepath.Abs("geth-" + archiveBasename(*arch, params.ArchiveVersion(env.Commit)) + ".exe")
- if err != nil {
- log.Fatalf("Failed to convert installer file path: %v", err)
- }
- build.MustRunCommand("makensis.exe",
- "/DOUTPUTFILE="+installer,
- "/DMAJORVERSION="+version[0],
- "/DMINORVERSION="+version[1],
- "/DBUILDVERSION="+version[2],
- "/DARCH="+*arch,
- filepath.Join(*workdir, "geth.nsi"),
- )
- // Sign and publish installer.
- if err := archiveUpload(installer, *upload, *signer, *signify); err != nil {
- log.Fatal(err)
- }
-}
-
-// Binary distribution cleanups
-
-func doPurge(cmdline []string) {
- var (
- store = flag.String("store", "", `Destination from where to purge archives (usually "gethstore/builds")`)
- limit = flag.Int("days", 30, `Age threshold above which to delete unstable archives`)
- )
- flag.CommandLine.Parse(cmdline)
-
- if env := build.Env(); !env.IsCronJob {
- log.Printf("skipping because not a cron job")
- os.Exit(0)
- }
- // Create the azure authentication and list the current archives
- auth := build.AzureBlobstoreConfig{
- Account: strings.Split(*store, "/")[0],
- Token: os.Getenv("AZURE_BLOBSTORE_TOKEN"),
- Container: strings.SplitN(*store, "/", 2)[1],
- }
- blobs, err := build.AzureBlobstoreList(auth)
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("Found %d blobs\n", len(blobs))
-
- // Iterate over the blobs, collect and sort all unstable builds
- for i := 0; i < len(blobs); i++ {
- if !strings.Contains(*blobs[i].Name, "unstable") {
- blobs = append(blobs[:i], blobs[i+1:]...)
- i--
- }
- }
- for i := 0; i < len(blobs); i++ {
- for j := i + 1; j < len(blobs); j++ {
- if blobs[i].Properties.LastModified.After(*blobs[j].Properties.LastModified) {
- blobs[i], blobs[j] = blobs[j], blobs[i]
- }
- }
- }
- // Filter out all archives more recent that the given threshold
- for i, blob := range blobs {
- if time.Since(*blob.Properties.LastModified) < time.Duration(*limit)*24*time.Hour {
- blobs = blobs[:i]
- break
- }
- }
- fmt.Printf("Deleting %d blobs\n", len(blobs))
- // Delete all marked as such and return
- if err := build.AzureBlobstoreDelete(auth, blobs); err != nil {
- log.Fatal(err)
- }
-}
-
-func doSanityCheck() {
- build.DownloadAndVerifyChecksums(build.MustLoadChecksums("build/checksums.txt"))
-}
diff --git a/build/goimports.sh b/build/goimports.sh
deleted file mode 100755
index 1fcace6a4b..0000000000
--- a/build/goimports.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-find_files() {
- find . ! \( \
- \( \
- -path '.github' \
- -o -path './build/_workspace' \
- -o -path './build/bin' \
- -o -path './crypto/bn256' \
- -o -path '*/vendor/*' \
- \) -prune \
- \) -name '*.go'
-}
-
-GOFMT="gofmt -s -w"
-GOIMPORTS="goimports -w"
-find_files | xargs $GOFMT
-find_files | xargs $GOIMPORTS
diff --git a/build/nsis.envvarupdate.nsh b/build/nsis.envvarupdate.nsh
deleted file mode 100644
index 95c2f1f639..0000000000
--- a/build/nsis.envvarupdate.nsh
+++ /dev/null
@@ -1,327 +0,0 @@
-/**
- * EnvVarUpdate.nsh
- * : Environmental Variables: append, prepend, and remove entries
- *
- * WARNING: If you use StrFunc.nsh header then include it before this file
- * with all required definitions. This is to avoid conflicts
- *
- * Usage:
- * ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
- *
- * Credits:
- * Version 1.0
- * * Cal Turney (turnec2)
- * * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
- * function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
- * WriteEnvStr, and un.DeleteEnvStr
- * * Diego Pedroso (deguix) for StrTok
- * * Kevin English (kenglish_hi) for StrContains
- * * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry
- * (dandaman32) for StrReplace
- *
- * Version 1.1 (compatibility with StrFunc.nsh)
- * * techtonik
- *
- * http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
- *
- */
-
-
-!ifndef ENVVARUPDATE_FUNCTION
-!define ENVVARUPDATE_FUNCTION
-!verbose push
-!verbose 3
-!include "LogicLib.nsh"
-!include "WinMessages.NSH"
-!include "StrFunc.nsh"
-
-; ---- Fix for conflict if StrFunc.nsh is already includes in main file -----------------------
-!macro _IncludeStrFunction StrFuncName
- !ifndef ${StrFuncName}_INCLUDED
- ${${StrFuncName}}
- !endif
- !ifndef Un${StrFuncName}_INCLUDED
- ${Un${StrFuncName}}
- !endif
- !define un.${StrFuncName} '${Un${StrFuncName}}'
-!macroend
-
-!insertmacro _IncludeStrFunction StrTok
-!insertmacro _IncludeStrFunction StrStr
-!insertmacro _IncludeStrFunction StrRep
-
-; ---------------------------------- Macro Definitions ----------------------------------------
-!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
- Push "${EnvVarName}"
- Push "${Action}"
- Push "${RegLoc}"
- Push "${PathString}"
- Call EnvVarUpdate
- Pop "${ResultVar}"
-!macroend
-!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
-
-!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
- Push "${EnvVarName}"
- Push "${Action}"
- Push "${RegLoc}"
- Push "${PathString}"
- Call un.EnvVarUpdate
- Pop "${ResultVar}"
-!macroend
-!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
-; ---------------------------------- Macro Definitions end-------------------------------------
-
-;----------------------------------- EnvVarUpdate start----------------------------------------
-!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
-!define hkcu_current_user 'HKCU "Environment"'
-
-!macro EnvVarUpdate UN
-
-Function ${UN}EnvVarUpdate
-
- Push $0
- Exch 4
- Exch $1
- Exch 3
- Exch $2
- Exch 2
- Exch $3
- Exch
- Exch $4
- Push $5
- Push $6
- Push $7
- Push $8
- Push $9
- Push $R0
-
- /* After this point:
- -------------------------
- $0 = ResultVar (returned)
- $1 = EnvVarName (input)
- $2 = Action (input)
- $3 = RegLoc (input)
- $4 = PathString (input)
- $5 = Orig EnvVar (read from registry)
- $6 = Len of $0 (temp)
- $7 = tempstr1 (temp)
- $8 = Entry counter (temp)
- $9 = tempstr2 (temp)
- $R0 = tempChar (temp) */
-
- ; Step 1: Read contents of EnvVarName from RegLoc
- ;
- ; Check for empty EnvVarName
- ${If} $1 == ""
- SetErrors
- DetailPrint "ERROR: EnvVarName is blank"
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ; Check for valid Action
- ${If} $2 != "A"
- ${AndIf} $2 != "P"
- ${AndIf} $2 != "R"
- SetErrors
- DetailPrint "ERROR: Invalid Action - must be A, P, or R"
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ${If} $3 == HKLM
- ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users into $5
- ${ElseIf} $3 == HKCU
- ReadRegStr $5 ${hkcu_current_user} $1 ; Read EnvVarName from current user into $5
- ${Else}
- SetErrors
- DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ; Check for empty PathString
- ${If} $4 == ""
- SetErrors
- DetailPrint "ERROR: PathString is blank"
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ; Make sure we've got some work to do
- ${If} $5 == ""
- ${AndIf} $2 == "R"
- SetErrors
- DetailPrint "$1 is empty - Nothing to remove"
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ; Step 2: Scrub EnvVar
- ;
- StrCpy $0 $5 ; Copy the contents to $0
- ; Remove spaces around semicolons (NOTE: spaces before the 1st entry or
- ; after the last one are not removed here but instead in Step 3)
- ${If} $0 != "" ; If EnvVar is not empty ...
- ${Do}
- ${${UN}StrStr} $7 $0 " ;"
- ${If} $7 == ""
- ${ExitDo}
- ${EndIf}
- ${${UN}StrRep} $0 $0 " ;" ";" ; Remove ';'
- ${Loop}
- ${Do}
- ${${UN}StrStr} $7 $0 "; "
- ${If} $7 == ""
- ${ExitDo}
- ${EndIf}
- ${${UN}StrRep} $0 $0 "; " ";" ; Remove ';'
- ${Loop}
- ${Do}
- ${${UN}StrStr} $7 $0 ";;"
- ${If} $7 == ""
- ${ExitDo}
- ${EndIf}
- ${${UN}StrRep} $0 $0 ";;" ";"
- ${Loop}
-
- ; Remove a leading or trailing semicolon from EnvVar
- StrCpy $7 $0 1 0
- ${If} $7 == ";"
- StrCpy $0 $0 "" 1 ; Change ';' to ''
- ${EndIf}
- StrLen $6 $0
- IntOp $6 $6 - 1
- StrCpy $7 $0 1 $6
- ${If} $7 == ";"
- StrCpy $0 $0 $6 ; Change ';' to ''
- ${EndIf}
- ; DetailPrint "Scrubbed $1: [$0]" ; Uncomment to debug
- ${EndIf}
-
- /* Step 3. Remove all instances of the target path/string (even if "A" or "P")
- $6 = bool flag (1 = found and removed PathString)
- $7 = a string (e.g. path) delimited by semicolon(s)
- $8 = entry counter starting at 0
- $9 = copy of $0
- $R0 = tempChar */
-
- ${If} $5 != "" ; If EnvVar is not empty ...
- StrCpy $9 $0
- StrCpy $0 ""
- StrCpy $8 0
- StrCpy $6 0
-
- ${Do}
- ${${UN}StrTok} $7 $9 ";" $8 "0" ; $7 = next entry, $8 = entry counter
-
- ${If} $7 == "" ; If we've run out of entries,
- ${ExitDo} ; were done
- ${EndIf} ;
-
- ; Remove leading and trailing spaces from this entry (critical step for Action=Remove)
- ${Do}
- StrCpy $R0 $7 1
- ${If} $R0 != " "
- ${ExitDo}
- ${EndIf}
- StrCpy $7 $7 "" 1 ; Remove leading space
- ${Loop}
- ${Do}
- StrCpy $R0 $7 1 -1
- ${If} $R0 != " "
- ${ExitDo}
- ${EndIf}
- StrCpy $7 $7 -1 ; Remove trailing space
- ${Loop}
- ${If} $7 == $4 ; If string matches, remove it by not appending it
- StrCpy $6 1 ; Set 'found' flag
- ${ElseIf} $7 != $4 ; If string does NOT match
- ${AndIf} $0 == "" ; and the 1st string being added to $0,
- StrCpy $0 $7 ; copy it to $0 without a prepended semicolon
- ${ElseIf} $7 != $4 ; If string does NOT match
- ${AndIf} $0 != "" ; and this is NOT the 1st string to be added to $0,
- StrCpy $0 $0;$7 ; append path to $0 with a prepended semicolon
- ${EndIf} ;
-
- IntOp $8 $8 + 1 ; Bump counter
- ${Loop} ; Check for duplicates until we run out of paths
- ${EndIf}
-
- ; Step 4: Perform the requested Action
- ;
- ${If} $2 != "R" ; If Append or Prepend
- ${If} $6 == 1 ; And if we found the target
- DetailPrint "Target is already present in $1. It will be removed and"
- ${EndIf}
- ${If} $0 == "" ; If EnvVar is (now) empty
- StrCpy $0 $4 ; just copy PathString to EnvVar
- ${If} $6 == 0 ; If found flag is either 0
- ${OrIf} $6 == "" ; or blank (if EnvVarName is empty)
- DetailPrint "$1 was empty and has been updated with the target"
- ${EndIf}
- ${ElseIf} $2 == "A" ; If Append (and EnvVar is not empty),
- StrCpy $0 $0;$4 ; append PathString
- ${If} $6 == 1
- DetailPrint "appended to $1"
- ${Else}
- DetailPrint "Target was appended to $1"
- ${EndIf}
- ${Else} ; If Prepend (and EnvVar is not empty),
- StrCpy $0 $4;$0 ; prepend PathString
- ${If} $6 == 1
- DetailPrint "prepended to $1"
- ${Else}
- DetailPrint "Target was prepended to $1"
- ${EndIf}
- ${EndIf}
- ${Else} ; If Action = Remove
- ${If} $6 == 1 ; and we found the target
- DetailPrint "Target was found and removed from $1"
- ${Else}
- DetailPrint "Target was NOT found in $1 (nothing to remove)"
- ${EndIf}
- ${If} $0 == ""
- DetailPrint "$1 is now empty"
- ${EndIf}
- ${EndIf}
-
- ; Step 5: Update the registry at RegLoc with the updated EnvVar and announce the change
- ;
- ClearErrors
- ${If} $3 == HKLM
- WriteRegExpandStr ${hklm_all_users} $1 $0 ; Write it in all users section
- ${ElseIf} $3 == HKCU
- WriteRegExpandStr ${hkcu_current_user} $1 $0 ; Write it to current user section
- ${EndIf}
-
- IfErrors 0 +4
- MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3"
- DetailPrint "Could not write updated $1 to $3"
- Goto EnvVarUpdate_Restore_Vars
-
- ; "Export" our change
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- EnvVarUpdate_Restore_Vars:
- ;
- ; Restore the user's variables and return ResultVar
- Pop $R0
- Pop $9
- Pop $8
- Pop $7
- Pop $6
- Pop $5
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Push $0 ; Push my $0 (ResultVar)
- Exch
- Pop $0 ; Restore his $0
-
-FunctionEnd
-
-!macroend ; EnvVarUpdate UN
-!insertmacro EnvVarUpdate ""
-!insertmacro EnvVarUpdate "un."
-;----------------------------------- EnvVarUpdate end----------------------------------------
-
-!verbose pop
-!endif
\ No newline at end of file
diff --git a/build/nsis.geth.nsi b/build/nsis.geth.nsi
deleted file mode 100644
index 1034f30235..0000000000
--- a/build/nsis.geth.nsi
+++ /dev/null
@@ -1,70 +0,0 @@
-# Builds a Windows installer with NSIS.
-# It expects the following command line arguments:
-# - OUTPUTFILE, filename of the installer (without extension)
-# - MAJORVERSION, major build version
-# - MINORVERSION, minor build version
-# - BUILDVERSION, build id version
-#
-# The created installer executes the following steps:
-# 1. install geth for all users
-# 2. install optional development tools such as abigen
-# 3. create an uninstaller
-# 4. configures the Windows firewall for geth
-# 5. create geth, attach and uninstall start menu entries
-# 6. configures the registry that allows Windows to manage the package through its platform tools
-# 7. adds the environment system wide variable ETHEREUM_SOCKET
-# 8. adds the install directory to %PATH%
-#
-# Requirements:
-# - NSIS, http://nsis.sourceforge.net/Main_Page
-# - NSIS Large Strings build, http://nsis.sourceforge.net/Special_Builds
-# - SFP, http://nsis.sourceforge.net/NSIS_Simple_Firewall_Plugin (put dll in NSIS\Plugins\x86-ansi)
-#
-# After intalling NSIS extra the NSIS Large Strings build zip and replace the makensis.exe and the
-# files found in Stub.
-#
-# based on: http://nsis.sourceforge.net/A_simple_installer_with_start_menu_shortcut_and_uninstaller
-#
-# TODO:
-# - sign installer
-CRCCheck on
-
-!define GROUPNAME "Ethereum"
-!define APPNAME "Geth"
-!define DESCRIPTION "Official Go implementation of the Ethereum protocol"
-!addplugindir .\
-
-# Require admin rights on NT6+ (When UAC is turned on)
-RequestExecutionLevel admin
-
-# Use LZMA compression
-SetCompressor /SOLID lzma
-
-!include LogicLib.nsh
-!include PathUpdate.nsh
-!include EnvVarUpdate.nsh
-
-!macro VerifyUserIsAdmin
-UserInfo::GetAccountType
-pop $0
-${If} $0 != "admin" # Require admin rights on NT4+
- messageBox mb_iconstop "Administrator rights required!"
- setErrorLevel 740 # ERROR_ELEVATION_REQUIRED
- quit
-${EndIf}
-!macroend
-
-function .onInit
- # make vars are global for all users since geth is installed global
- setShellVarContext all
- !insertmacro VerifyUserIsAdmin
-
- ${If} ${ARCH} == "amd64"
- StrCpy $InstDir "$PROGRAMFILES64\${APPNAME}"
- ${Else}
- StrCpy $InstDir "$PROGRAMFILES32\${APPNAME}"
- ${Endif}
-functionEnd
-
-!include install.nsh
-!include uninstall.nsh
diff --git a/build/nsis.install.nsh b/build/nsis.install.nsh
deleted file mode 100644
index 9b73148a44..0000000000
--- a/build/nsis.install.nsh
+++ /dev/null
@@ -1,103 +0,0 @@
-Name "geth ${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}" # VERSION variables set through command line arguments
-InstallDir "$InstDir"
-OutFile "${OUTPUTFILE}" # set through command line arguments
-
-# Links for "Add/Remove Programs"
-!define HELPURL "https://github.com/ethereum/go-ethereum/issues"
-!define UPDATEURL "https://github.com/ethereum/go-ethereum/releases"
-!define ABOUTURL "https://github.com/ethereum/go-ethereum#ethereum-go"
-!define /date NOW "%Y%m%d"
-
-PageEx license
- LicenseData {{.License}}
-PageExEnd
-
-# Install geth binary
-Section "Geth" GETH_IDX
- SetOutPath $INSTDIR
- file {{.Geth}}
-
- # Create start menu launcher
- createDirectory "$SMPROGRAMS\${APPNAME}"
- createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\geth.exe"
- createShortCut "$SMPROGRAMS\${APPNAME}\Attach.lnk" "$INSTDIR\geth.exe" "attach"
- createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
-
- # Firewall - remove rules (if exists)
- SimpleFC::AdvRemoveRule "Geth incoming peers (TCP:30303)"
- SimpleFC::AdvRemoveRule "Geth outgoing peers (TCP:30303)"
- SimpleFC::AdvRemoveRule "Geth UDP discovery (UDP:30303)"
-
- # Firewall - add rules
- SimpleFC::AdvAddRule "Geth incoming peers (TCP:30303)" "" 6 1 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" 30303 "" "" ""
- SimpleFC::AdvAddRule "Geth outgoing peers (TCP:30303)" "" 6 2 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" "" 30303 "" ""
- SimpleFC::AdvAddRule "Geth UDP discovery (UDP:30303)" "" 17 2 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" "" 30303 "" ""
-
- # Set default IPC endpoint (https://github.com/ethereum/EIPs/issues/147)
- ${EnvVarUpdate} $0 "ETHEREUM_SOCKET" "R" "HKLM" "\\.\pipe\geth.ipc"
- ${EnvVarUpdate} $0 "ETHEREUM_SOCKET" "A" "HKLM" "\\.\pipe\geth.ipc"
-
- # Add instdir to PATH
- Push "$INSTDIR"
- Call AddToPath
-SectionEnd
-
-# Install optional develop tools.
-Section /o "Development tools" DEV_TOOLS_IDX
- SetOutPath $INSTDIR
- {{range .DevTools}}file {{.}}
- {{end}}
-SectionEnd
-
-# Return on top of stack the total size (as DWORD) of the selected/installed sections.
-Var GetInstalledSize.total
-Function GetInstalledSize
- StrCpy $GetInstalledSize.total 0
-
- ${if} ${SectionIsSelected} ${GETH_IDX}
- SectionGetSize ${GETH_IDX} $0
- IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
- ${endif}
-
- ${if} ${SectionIsSelected} ${DEV_TOOLS_IDX}
- SectionGetSize ${DEV_TOOLS_IDX} $0
- IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
- ${endif}
-
- IntFmt $GetInstalledSize.total "0x%08X" $GetInstalledSize.total
- Push $GetInstalledSize.total
-FunctionEnd
-
-# Write registry, Windows uses these values in various tools such as add/remove program.
-# PowerShell: Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, InstallLocation, InstallDate | Format-Table –AutoSize
-function .onInstSuccess
- # Save information in registry in HKEY_LOCAL_MACHINE branch, Windows add/remove functionality depends on this
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayName" "${GROUPNAME} - ${APPNAME} - ${DESCRIPTION}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallLocation" "$INSTDIR"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallDate" "${NOW}"
- # Wait for Alex
- #WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\logo.ico$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "Publisher" "${GROUPNAME}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "HelpLink" "${HELPURL}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLUpdateInfo" "${UPDATEURL}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLInfoAbout" "${ABOUTURL}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayVersion" "${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}"
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMajor" ${MAJORVERSION}
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMinor" ${MINORVERSION}
- # There is no option for modifying or repairing the install
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoModify" 1
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoRepair" 1
-
- Call GetInstalledSize
- Pop $0
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "EstimatedSize" "$0"
-
- # Create uninstaller
- writeUninstaller "$INSTDIR\uninstall.exe"
-functionEnd
-
-Page components
-Page directory
-Page instfiles
diff --git a/build/nsis.pathupdate.nsh b/build/nsis.pathupdate.nsh
deleted file mode 100644
index f54b7e3e13..0000000000
--- a/build/nsis.pathupdate.nsh
+++ /dev/null
@@ -1,153 +0,0 @@
-!include "WinMessages.nsh"
-
-; see https://support.microsoft.com/en-us/kb/104011
-!define Environ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
-; HKEY_LOCAL_MACHINE = 0x80000002
-
-; AddToPath - Appends dir to PATH
-; (does not work on Win9x/ME)
-;
-; Usage:
-; Push "dir"
-; Call AddToPath
-Function AddToPath
- Exch $0
- Push $1
- Push $2
- Push $3
- Push $4
-
- ; NSIS ReadRegStr returns empty string on string overflow
- ; Native calls are used here to check actual length of PATH
- ; $4 = RegOpenKey(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager\Environment", &$3)
- System::Call "advapi32::RegOpenKey(i 0x80000002, t'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', *i.r3) i.r4"
- IntCmp $4 0 0 done done
-
- ; $4 = RegQueryValueEx($3, "PATH", (DWORD*)0, (DWORD*)0, &$1, ($2=NSIS_MAX_STRLEN, &$2))
- ; RegCloseKey($3)
- System::Call "advapi32::RegQueryValueEx(i $3, t'PATH', i 0, i 0, t.r1, *i ${NSIS_MAX_STRLEN} r2) i.r4"
- System::Call "advapi32::RegCloseKey(i $3)"
-
- IntCmp $4 234 0 +4 +4 ; $4 == ERROR_MORE_DATA
- DetailPrint "AddToPath: original length $2 > ${NSIS_MAX_STRLEN}"
- MessageBox MB_OK "PATH not updated, original length $2 > ${NSIS_MAX_STRLEN}"
- Goto done
-
- IntCmp $4 0 +5 ; $4 != NO_ERROR
- IntCmp $4 2 +3 ; $4 != ERROR_FILE_NOT_FOUND
- DetailPrint "AddToPath: unexpected error code $4"
- Goto done
- StrCpy $1 ""
-
- ; Check if already in PATH
- Push "$1;"
- Push "$0;"
- Call StrStr
- Pop $2
- StrCmp $2 "" 0 done
- Push "$1;"
- Push "$0\;"
- Call StrStr
- Pop $2
- StrCmp $2 "" 0 done
-
- ; Prevent NSIS string overflow
- StrLen $2 $0
- StrLen $3 $1
- IntOp $2 $2 + $3
- IntOp $2 $2 + 2 ; $2 = strlen(dir) + strlen(PATH) + sizeof(";")
- IntCmp $2 ${NSIS_MAX_STRLEN} +4 +4 0
- DetailPrint "AddToPath: new length $2 > ${NSIS_MAX_STRLEN}"
- MessageBox MB_OK "PATH not updated, new length $2 > ${NSIS_MAX_STRLEN}."
- Goto done
-
- ; Append dir to PATH
- DetailPrint "Add to PATH: $0"
- StrCpy $2 $1 1 -1
- StrCmp $2 ";" 0 +2
- StrCpy $1 $1 -1 ; remove trailing ';'
- StrCmp $1 "" +2 ; no leading ';'
- StrCpy $0 "$1;$0"
-
- WriteRegExpandStr ${Environ} "PATH" $0
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
-done:
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-
-
-; RemoveFromPath - Removes dir from PATH
-;
-; Usage:
-; Push "dir"
-; Call RemoveFromPath
-Function un.RemoveFromPath
- Exch $0
- Push $1
- Push $2
- Push $3
- Push $4
- Push $5
- Push $6
-
- ; NSIS ReadRegStr returns empty string on string overflow
- ; Native calls are used here to check actual length of PATH
- ; $4 = RegOpenKey(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager\Environment", &$3)
- System::Call "advapi32::RegOpenKey(i 0x80000002, t'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', *i.r3) i.r4"
- IntCmp $4 0 0 done done
-
- ; $4 = RegQueryValueEx($3, "PATH", (DWORD*)0, (DWORD*)0, &$1, ($2=NSIS_MAX_STRLEN, &$2))
- ; RegCloseKey($3)
- System::Call "advapi32::RegQueryValueEx(i $3, t'PATH', i 0, i 0, t.r1, *i ${NSIS_MAX_STRLEN} r2) i.r4"
- System::Call "advapi32::RegCloseKey(i $3)"
-
- IntCmp $4 234 0 +4 +4 ; $4 == ERROR_MORE_DATA
- DetailPrint "RemoveFromPath: original length $2 > ${NSIS_MAX_STRLEN}"
- MessageBox MB_OK "PATH not updated, original length $2 > ${NSIS_MAX_STRLEN}"
- Goto done
-
- IntCmp $4 0 +5 ; $4 != NO_ERROR
- IntCmp $4 2 +3 ; $4 != ERROR_FILE_NOT_FOUND
- DetailPrint "RemoveFromPath: unexpected error code $4"
- Goto done
- StrCpy $1 ""
-
- ; length < ${NSIS_MAX_STRLEN} -> ReadRegStr can be used
- ReadRegStr $1 ${Environ} "PATH"
- StrCpy $5 $1 1 -1
- StrCmp $5 ";" +2
- StrCpy $1 "$1;" ; ensure trailing ';'
- Push $1
- Push "$0;"
- Call un.StrStr
- Pop $2 ; pos of our dir
- StrCmp $2 "" done
-
- DetailPrint "Remove from PATH: $0"
- StrLen $3 "$0;"
- StrLen $4 $2
- StrCpy $5 $1 -$4 ; $5 is now the part before the path to remove
- StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
- StrCpy $3 "$5$6"
- StrCpy $5 $3 1 -1
- StrCmp $5 ";" 0 +2
- StrCpy $3 $3 -1 ; remove trailing ';'
- WriteRegExpandStr ${Environ} "PATH" $3
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
-done:
- Pop $6
- Pop $5
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-
-
diff --git a/build/nsis.simplefc.dll b/build/nsis.simplefc.dll
deleted file mode 100644
index 73b7d9634d..0000000000
Binary files a/build/nsis.simplefc.dll and /dev/null differ
diff --git a/build/nsis.simplefc.source.zip b/build/nsis.simplefc.source.zip
deleted file mode 100644
index d7476022ad..0000000000
Binary files a/build/nsis.simplefc.source.zip and /dev/null differ
diff --git a/build/nsis.uninstall.nsh b/build/nsis.uninstall.nsh
deleted file mode 100644
index 6358faa74e..0000000000
--- a/build/nsis.uninstall.nsh
+++ /dev/null
@@ -1,33 +0,0 @@
-Section "Uninstall"
- # uninstall for all users
- setShellVarContext all
-
- # Delete (optionally) installed files
- {{range $}}Delete $INSTDIR\{{.}}
- {{end}}
- Delete $INSTDIR\uninstall.exe
-
- # Delete install directory
- rmDir $INSTDIR
-
- # Delete start menu launcher
- Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
- Delete "$SMPROGRAMS\${APPNAME}\Attach.lnk"
- Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
- rmDir "$SMPROGRAMS\${APPNAME}"
-
- # Firewall - remove rules if exists
- SimpleFC::AdvRemoveRule "Geth incoming peers (TCP:30303)"
- SimpleFC::AdvRemoveRule "Geth outgoing peers (TCP:30303)"
- SimpleFC::AdvRemoveRule "Geth UDP discovery (UDP:30303)"
-
- # Remove IPC endpoint (https://github.com/ethereum/EIPs/issues/147)
- ${un.EnvVarUpdate} $0 "ETHEREUM_SOCKET" "R" "HKLM" "\\.\pipe\geth.ipc"
-
- # Remove install directory from PATH
- Push "$INSTDIR"
- Call un.RemoveFromPath
-
- # Cleanup registry (deletes all sub keys)
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}"
-SectionEnd
diff --git a/build/travis_keepalive.sh b/build/travis_keepalive.sh
deleted file mode 100755
index 77cc623eaf..0000000000
--- a/build/travis_keepalive.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env bash
-
-# travis_keepalive runs the given command and preserves its return value,
-# while it forks a child process what periodically produces a log line,
-# so that Travis won't abort the build after 10 minutes.
-
-# Why?
-# `t.Log()` in Go holds the buffer until the test does not pass or fail,
-# and `-race` can increase the execution time by 2-20x.
-
-set -euo pipefail
-
-readonly KEEPALIVE_INTERVAL=300 # seconds => 5m
-
-main() {
- keepalive
- $@
-}
-
-# Keepalive produces a log line in each KEEPALIVE_INTERVAL.
-keepalive() {
- local child_pid
- # Note: We fork here!
- repeat "keepalive" &
- child_pid=$!
- ensureChildOnEXIT "${child_pid}"
-}
-
-repeat() {
- local this="$1"
- while true; do
- echo "${this}"
- sleep "${KEEPALIVE_INTERVAL}"
- done
-}
-
-# Ensures that the child gets killed on normal program exit.
-ensureChildOnEXIT() {
- # Note: SIGINT and SIGTERM are forwarded to the child process by Bash
- # automatically, so we don't have to deal with signals.
-
- local child_pid="$1"
- trap "kill ${child_pid}" EXIT
-}
-
-main "$@"
diff --git a/build/update-license.go b/build/update-license.go
deleted file mode 100644
index 70e2de06c7..0000000000
--- a/build/update-license.go
+++ /dev/null
@@ -1,427 +0,0 @@
-// Copyright 2018 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library 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 Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see .
-
-//go:build none
-// +build none
-
-/*
-This command generates GPL license headers on top of all source files.
-You can run it once per month, before cutting a release or just
-whenever you feel like it.
-
- go run update-license.go
-
-All authors (people who have contributed code) are listed in the
-AUTHORS file. The author names are mapped and deduplicated using the
-.mailmap file. You can use .mailmap to set the canonical name and
-address for each author. See git-shortlog(1) for an explanation of the
-.mailmap format.
-
-Please review the resulting diff to check whether the correct
-copyright assignments are performed.
-*/
-
-package main
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "log"
- "os"
- "os/exec"
- "path/filepath"
- "regexp"
- "runtime"
- "strconv"
- "strings"
- "sync"
- "text/template"
- "time"
-
- "golang.org/x/exp/slices"
-)
-
-var (
- // only files with these extensions will be considered
- extensions = []string{".go", ".js", ".qml"}
-
- // paths with any of these prefixes will be skipped
- skipPrefixes = []string{
- // boring stuff
- "vendor/", "tests/testdata/", "build/",
-
- // don't relicense vendored sources
- "common/bitutil/bitutil",
- "common/prque/",
- "crypto/blake2b/",
- "crypto/bn256/",
- "crypto/bls12381/",
- "crypto/ecies/",
- "graphql/graphiql.go",
- "internal/jsre/deps",
- "log/",
- "metrics/",
- "signer/rules/deps",
- "internal/reexec",
-
- // skip special licenses
- "crypto/secp256k1", // Relicensed to BSD-3 via https://github.com/ethereum/go-ethereum/pull/17225
- }
-
- // paths with this prefix are licensed as GPL. all other files are LGPL.
- gplPrefixes = []string{"cmd/"}
-
- // this regexp must match the entire license comment at the
- // beginning of each file.
- licenseCommentRE = regexp.MustCompile(`^//\s*(Copyright|This file is part of).*?\n(?://.*?\n)*\n*`)
-
- // this text appears at the start of AUTHORS
- authorsFileHeader = "# This is the official list of go-ethereum authors for copyright purposes.\n\n"
-)
-
-// this template generates the license comment.
-// its input is an info structure.
-var licenseT = template.Must(template.New("").Parse(`
-// Copyright {{.Year}} The go-ethereum Authors
-// This file is part of {{.Whole false}}.
-//
-// {{.Whole true}} is free software: you can redistribute it and/or modify
-// it under the terms of the GNU {{.License}} as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// {{.Whole true}} 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 {{.License}} for more details.
-//
-// You should have received a copy of the GNU {{.License}}
-// along with {{.Whole false}}. If not, see .
-
-`[1:]))
-
-type info struct {
- file string
- Year int64
-}
-
-func (i info) License() string {
- if i.gpl() {
- return "General Public License"
- }
- return "Lesser General Public License"
-}
-
-func (i info) ShortLicense() string {
- if i.gpl() {
- return "GPL"
- }
- return "LGPL"
-}
-
-func (i info) Whole(startOfSentence bool) string {
- if i.gpl() {
- return "go-ethereum"
- }
- if startOfSentence {
- return "The go-ethereum library"
- }
- return "the go-ethereum library"
-}
-
-func (i info) gpl() bool {
- for _, p := range gplPrefixes {
- if strings.HasPrefix(i.file, p) {
- return true
- }
- }
- return false
-}
-
-func main() {
- var (
- files = getFiles()
- filec = make(chan string)
- infoc = make(chan *info, 20)
- wg sync.WaitGroup
- )
-
- writeAuthors(files)
-
- go func() {
- for _, f := range files {
- filec <- f
- }
- close(filec)
- }()
- for i := runtime.NumCPU(); i >= 0; i-- {
- // getting file info is slow and needs to be parallel.
- // it traverses git history for each file.
- wg.Add(1)
- go getInfo(filec, infoc, &wg)
- }
- go func() {
- wg.Wait()
- close(infoc)
- }()
- writeLicenses(infoc)
-}
-
-func skipFile(path string) bool {
- if strings.Contains(path, "/testdata/") {
- return true
- }
- for _, p := range skipPrefixes {
- if strings.HasPrefix(path, p) {
- return true
- }
- }
- return false
-}
-
-func getFiles() []string {
- cmd := exec.Command("git", "ls-tree", "-r", "--name-only", "HEAD")
- var files []string
- err := doLines(cmd, func(line string) {
- if skipFile(line) {
- return
- }
- ext := filepath.Ext(line)
- for _, wantExt := range extensions {
- if ext == wantExt {
- goto keep
- }
- }
- return
- keep:
- files = append(files, line)
- })
- if err != nil {
- log.Fatal("error getting files:", err)
- }
- return files
-}
-
-var authorRegexp = regexp.MustCompile(`\s*[0-9]+\s*(.*)`)
-
-func gitAuthors(files []string) []string {
- cmds := []string{"shortlog", "-s", "-n", "-e", "HEAD", "--"}
- cmds = append(cmds, files...)
- cmd := exec.Command("git", cmds...)
- var authors []string
- err := doLines(cmd, func(line string) {
- m := authorRegexp.FindStringSubmatch(line)
- if len(m) > 1 {
- authors = append(authors, m[1])
- }
- })
- if err != nil {
- log.Fatalln("error getting authors:", err)
- }
- return authors
-}
-
-func readAuthors() []string {
- content, err := os.ReadFile("AUTHORS")
- if err != nil && !os.IsNotExist(err) {
- log.Fatalln("error reading AUTHORS:", err)
- }
- var authors []string
- for _, a := range bytes.Split(content, []byte("\n")) {
- if len(a) > 0 && a[0] != '#' {
- authors = append(authors, string(a))
- }
- }
- // Retranslate existing authors through .mailmap.
- // This should catch email address changes.
- authors = mailmapLookup(authors)
- return authors
-}
-
-func mailmapLookup(authors []string) []string {
- if len(authors) == 0 {
- return nil
- }
- cmds := []string{"check-mailmap", "--"}
- cmds = append(cmds, authors...)
- cmd := exec.Command("git", cmds...)
- var translated []string
- err := doLines(cmd, func(line string) {
- translated = append(translated, line)
- })
- if err != nil {
- log.Fatalln("error translating authors:", err)
- }
- return translated
-}
-
-func writeAuthors(files []string) {
- var (
- dedup = make(map[string]bool)
- list []string
- )
- // Add authors that Git reports as contributors.
- // This is the primary source of author information.
- for _, a := range gitAuthors(files) {
- if la := strings.ToLower(a); !dedup[la] {
- list = append(list, a)
- dedup[la] = true
- }
- }
- // Add existing authors from the file. This should ensure that we
- // never lose authors, even if Git stops listing them. We can also
- // add authors manually this way.
- for _, a := range readAuthors() {
- if la := strings.ToLower(a); !dedup[la] {
- list = append(list, a)
- dedup[la] = true
- }
- }
- // Write sorted list of authors back to the file.
- slices.SortFunc(list, func(a, b string) bool {
- return strings.ToLower(a) < strings.ToLower(b)
- })
- content := new(bytes.Buffer)
- content.WriteString(authorsFileHeader)
- for _, a := range list {
- content.WriteString(a)
- content.WriteString("\n")
- }
- fmt.Println("writing AUTHORS")
- if err := os.WriteFile("AUTHORS", content.Bytes(), 0644); err != nil {
- log.Fatalln(err)
- }
-}
-
-func getInfo(files <-chan string, out chan<- *info, wg *sync.WaitGroup) {
- for file := range files {
- stat, err := os.Lstat(file)
- if err != nil {
- fmt.Printf("ERROR %s: %v\n", file, err)
- continue
- }
- if !stat.Mode().IsRegular() {
- continue
- }
- if isGenerated(file) {
- continue
- }
- info, err := fileInfo(file)
- if err != nil {
- fmt.Printf("ERROR %s: %v\n", file, err)
- continue
- }
- out <- info
- }
- wg.Done()
-}
-
-func isGenerated(file string) bool {
- fd, err := os.Open(file)
- if err != nil {
- return false
- }
- defer fd.Close()
- buf := make([]byte, 2048)
- n, err := fd.Read(buf)
- if err != nil {
- return false
- }
- buf = buf[:n]
- for _, l := range bytes.Split(buf, []byte("\n")) {
- if bytes.HasPrefix(l, []byte("// Code generated")) {
- return true
- }
- }
- return false
-}
-
-// fileInfo finds the lowest year in which the given file was committed.
-func fileInfo(file string) (*info, error) {
- info := &info{file: file, Year: int64(time.Now().Year())}
- cmd := exec.Command("git", "log", "--follow", "--find-renames=80", "--find-copies=80", "--pretty=format:%ai", "--", file)
- err := doLines(cmd, func(line string) {
- y, err := strconv.ParseInt(line[:4], 10, 64)
- if err != nil {
- fmt.Printf("cannot parse year: %q", line[:4])
- }
- if y < info.Year {
- info.Year = y
- }
- })
- return info, err
-}
-
-func writeLicenses(infos <-chan *info) {
- for i := range infos {
- writeLicense(i)
- }
-}
-
-func writeLicense(info *info) {
- fi, err := os.Stat(info.file)
- if os.IsNotExist(err) {
- fmt.Println("skipping (does not exist)", info.file)
- return
- }
- if err != nil {
- log.Fatalf("error stat'ing %s: %v\n", info.file, err)
- }
- content, err := os.ReadFile(info.file)
- if err != nil {
- log.Fatalf("error reading %s: %v\n", info.file, err)
- }
- // Construct new file content.
- buf := new(bytes.Buffer)
- licenseT.Execute(buf, info)
- if m := licenseCommentRE.FindIndex(content); m != nil && m[0] == 0 {
- buf.Write(content[:m[0]])
- buf.Write(content[m[1]:])
- } else {
- buf.Write(content)
- }
- // Write it to the file.
- if bytes.Equal(content, buf.Bytes()) {
- fmt.Println("skipping (no changes)", info.file)
- return
- }
- fmt.Println("writing", info.ShortLicense(), info.file)
- if err := os.WriteFile(info.file, buf.Bytes(), fi.Mode()); err != nil {
- log.Fatalf("error writing %s: %v", info.file, err)
- }
-}
-
-func doLines(cmd *exec.Cmd, f func(string)) error {
- stdout, err := cmd.StdoutPipe()
- if err != nil {
- return err
- }
- if err := cmd.Start(); err != nil {
- return err
- }
- s := bufio.NewScanner(stdout)
- for s.Scan() {
- f(s.Text())
- }
- if s.Err() != nil {
- return s.Err()
- }
- if err := cmd.Wait(); err != nil {
- return fmt.Errorf("%v (for %s)", err, strings.Join(cmd.Args, " "))
- }
- return nil
-}