go-ethereum: github.com/ethereum/go-ethereum/internal/build Index | Files

package build

import "github.com/ethereum/go-ethereum/internal/build"


Package Files

archive.go azure.go download.go env.go pgp.go util.go


var (
    // These flags override values in build env.
    GitCommitFlag   = flag.String("git-commit", "", `Overrides git commit hash embedded into executables`)
    GitBranchFlag   = flag.String("git-branch", "", `Overrides git branch being built`)
    GitTagFlag      = flag.String("git-tag", "", `Overrides git tag being built`)
    BuildnumFlag    = flag.String("buildnum", "", `Overrides CI build number`)
    PullRequestFlag = flag.Bool("pull-request", false, `Overrides pull request status of the build`)
    CronJobFlag     = flag.Bool("cron-job", false, `Overrides cron job status of the build`)
var DryRunFlag = flag.Bool("n", false, "dry run, don't execute commands")

func AddFile Uses

func AddFile(a Archive, file string) error

AddFile appends an existing file to an archive.

func AzureBlobstoreDelete Uses

func AzureBlobstoreDelete(config AzureBlobstoreConfig, blobs []azblob.BlobItem) error

AzureBlobstoreDelete iterates over a list of files to delete and removes them from the blobstore.

func AzureBlobstoreList Uses

func AzureBlobstoreList(config AzureBlobstoreConfig) ([]azblob.BlobItem, error)

AzureBlobstoreList lists all the files contained within an azure blobstore.

func AzureBlobstoreUpload Uses

func AzureBlobstoreUpload(path string, name string, config AzureBlobstoreConfig) error

AzureBlobstoreUpload uploads a local file to the Azure Blob Storage. Note, this method assumes a max file size of 64MB (Azure limitation). Larger files will need a multi API call approach implemented.

See: https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx#Anchor_3

func ExtractArchive Uses

func ExtractArchive(archive string, dest string) error

ExtractArchive unpacks a .zip or .tar.gz archive to the destination directory.

func FindMainPackages Uses

func FindMainPackages(dir string) []string

FindMainPackages finds all 'main' packages in the given directory and returns their package paths.

func GoTool Uses

func GoTool(tool string, args ...string) *exec.Cmd

GoTool returns the command that runs a go tool. This uses go from GOROOT instead of PATH so that go commands executed by build use the same version of Go as the 'host' that runs build code. e.g.

/usr/lib/go-1.12.1/bin/go run build/ci.go ...

runs using go 1.12.1 and invokes go 1.12.1 tools from the same GOROOT. This is also important because runtime.Version checks on the host should match the tools that are run.

func MustRun Uses

func MustRun(cmd *exec.Cmd)

MustRun executes the given command and exits the host process for any error.

func MustRunCommand Uses

func MustRunCommand(cmd string, args ...string)

func PGPKeyID Uses

func PGPKeyID(pgpkey string) (string, error)

PGPKeyID parses an armored key and returns the key ID.

func PGPSignFile Uses

func PGPSignFile(input string, output string, pgpkey string) error

PGPSignFile parses a PGP private key from the specified string and creates a signature file into the output parameter of the input file.

Note, this method assumes a single key will be container in the pgpkey arg, furthermore that it is in armored format.

func Render Uses

func Render(templateFile, outputFile string, outputPerm os.FileMode, x interface{})

Render renders the given template file into outputFile.

func RenderString Uses

func RenderString(templateContent, outputFile string, outputPerm os.FileMode, x interface{})

RenderString renders the given template string into outputFile.

func RunGit Uses

func RunGit(args ...string) string

RunGit runs a git subcommand and returns its output. The command must complete successfully.

func UploadSFTP Uses

func UploadSFTP(identityFile, host, dir string, files []string) error

UploadSFTP uploads files to a remote host using the sftp command line tool. The destination host may be specified either as [user@]host[: or as a URI in the form sftp://[user@]host[:port].

func WriteArchive Uses

func WriteArchive(name string, files []string) (err error)

WriteArchive creates an archive containing the given files.

type Archive Uses

type Archive interface {
    // Directory adds a new directory entry to the archive and sets the
    // directory for subsequent calls to Header.
    Directory(name string) error

    // Header adds a new file to the archive. The file is added to the directory
    // set by Directory. The content of the file must be written to the returned
    // writer.
    Header(os.FileInfo) (io.Writer, error)

    // Close flushes the archive and closes the underlying file.
    Close() error

func NewArchive Uses

func NewArchive(file *os.File) (Archive, string)

func NewTarballArchive Uses

func NewTarballArchive(w io.WriteCloser) Archive

func NewZipArchive Uses

func NewZipArchive(w io.WriteCloser) Archive

type AzureBlobstoreConfig Uses

type AzureBlobstoreConfig struct {
    Account   string // Account name to authorize API requests with
    Token     string // Access token for the above account
    Container string // Blob container to upload files into

AzureBlobstoreConfig is an authentication and configuration struct containing the data needed by the Azure SDK to interact with a specific container in the blobstore.

type ChecksumDB Uses

type ChecksumDB struct {
    // contains filtered or unexported fields

ChecksumDB keeps file checksums.

func MustLoadChecksums Uses

func MustLoadChecksums(file string) *ChecksumDB

MustLoadChecksums loads a file containing checksums.

func (*ChecksumDB) DownloadFile Uses

func (db *ChecksumDB) DownloadFile(url, dstPath string) error

DownloadFile downloads a file and verifies its checksum.

func (*ChecksumDB) Verify Uses

func (db *ChecksumDB) Verify(path string) error

Verify checks whether the given file is valid according to the checksum database.

type Environment Uses

type Environment struct {
    Name                      string // name of the environment
    Repo                      string // name of GitHub repo
    Commit, Date, Branch, Tag string // Git info
    Buildnum                  string
    IsPullRequest             bool
    IsCronJob                 bool

Environment contains metadata provided by the build environment.

func Env Uses

func Env() Environment

Env returns metadata about the current CI environment, falling back to LocalEnv if not running on CI.

func LocalEnv Uses

func LocalEnv() Environment

LocalEnv returns build environment metadata gathered from git.

func (Environment) String Uses

func (env Environment) String() string

type TarballArchive Uses

type TarballArchive struct {
    // contains filtered or unexported fields

func (*TarballArchive) Close Uses

func (a *TarballArchive) Close() error

func (*TarballArchive) Directory Uses

func (a *TarballArchive) Directory(name string) error

func (*TarballArchive) Header Uses

func (a *TarballArchive) Header(fi os.FileInfo) (io.Writer, error)

type ZipArchive Uses

type ZipArchive struct {
    // contains filtered or unexported fields

func (*ZipArchive) Close Uses

func (a *ZipArchive) Close() error

func (*ZipArchive) Directory Uses

func (a *ZipArchive) Directory(name string) error

func (*ZipArchive) Header Uses

func (a *ZipArchive) Header(fi os.FileInfo) (io.Writer, error)

Package build imports 29 packages (graph) and is imported by 2 packages. Updated 2020-11-16. Refresh now. Tools for package owners.