From 6478a2601d47fa05aa5e6e9633006ea0ba3a25bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 28 Oct 2016 14:31:37 +0300 Subject: [PATCH] build, vendor: move context to special vendor folder --- .gitignore | 3 +- build/_vendor/src/golang.org/x/net/LICENSE | 27 ++++++++++ .../src}/golang.org/x/net/context/context.go | 0 .../src}/golang.org/x/net/context/go17.go | 0 .../src}/golang.org/x/net/context/pre_go17.go | 0 build/ci-notes.md | 15 ++++++ build/ci.go | 1 - internal/build/util.go | 10 +++- vendor.conf | 18 ++++--- vendor/github.com/fatih/color/color.go | 50 +++++++++---------- vendor/github.com/gizak/termui/linechart.go | 4 +- 11 files changed, 90 insertions(+), 38 deletions(-) create mode 100644 build/_vendor/src/golang.org/x/net/LICENSE rename {vendor => build/_vendor/src}/golang.org/x/net/context/context.go (100%) rename {vendor => build/_vendor/src}/golang.org/x/net/context/go17.go (100%) rename {vendor => build/_vendor/src}/golang.org/x/net/context/pre_go17.go (100%) diff --git a/.gitignore b/.gitignore index 21dbd28c56..e53e461dc6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,7 @@ .ethtest */**/*tx_database* */**/*dapps* -Godeps/_workspace/pkg -Godeps/_workspace/bin +build/_vendor/pkg #* .#* diff --git a/build/_vendor/src/golang.org/x/net/LICENSE b/build/_vendor/src/golang.org/x/net/LICENSE new file mode 100644 index 0000000000..6a66aea5ea --- /dev/null +++ b/build/_vendor/src/golang.org/x/net/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/net/context/context.go b/build/_vendor/src/golang.org/x/net/context/context.go similarity index 100% rename from vendor/golang.org/x/net/context/context.go rename to build/_vendor/src/golang.org/x/net/context/context.go diff --git a/vendor/golang.org/x/net/context/go17.go b/build/_vendor/src/golang.org/x/net/context/go17.go similarity index 100% rename from vendor/golang.org/x/net/context/go17.go rename to build/_vendor/src/golang.org/x/net/context/go17.go diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/build/_vendor/src/golang.org/x/net/context/pre_go17.go similarity index 100% rename from vendor/golang.org/x/net/context/pre_go17.go rename to build/_vendor/src/golang.org/x/net/context/pre_go17.go diff --git a/build/ci-notes.md b/build/ci-notes.md index 39375ff4c3..3fc2690b2c 100644 --- a/build/ci-notes.md +++ b/build/ci-notes.md @@ -1,3 +1,18 @@ +# Vendored Dependencies + +Dependencies are almost all vendored in at the standard Go `/vendor` path. This allows +people to build go-ethereum using the standard toolchain without any particular package +manager. It also plays nicely with `go get`, not requiring external code to be relied on. + +The one single dependent package missing from `vendor` is `golang.org/x/net/context`. As +this is a package exposed via public library APIs, it must not be vendored as dependent +code woulnd't be able to instantiate. + +To allow reproducible builds of go-ethereum nonetheless that don't need network access +during build time to fetch `golang.org/x/net/context`, a version was copied into our repo +at the very specific `/build/_vendor` path, which is added automatically by all CI build +scripts and the makefile too. + # Debian Packaging Tagged releases and develop branch commits are available as installable Debian packages diff --git a/build/ci.go b/build/ci.go index e28d98be74..3dca47fadf 100644 --- a/build/ci.go +++ b/build/ci.go @@ -141,7 +141,6 @@ func doInstall(cmdline []string) { log.Println("be compiled with an earlier version. Please upgrade your Go installation.") os.Exit(1) } - // Compile packages given as arguments, or everything if there are no arguments. packages := []string{"./..."} if flag.NArg() > 0 { diff --git a/internal/build/util.go b/internal/build/util.go index 2a4a975735..a821cd7f23 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -55,7 +55,15 @@ func GOPATH() string { if len(path) == 0 { log.Fatal("GOPATH is not set") } - return strings.Join(path, string(filepath.ListSeparator)) + // Ensure that our internal vendor folder in on GOPATH + vendor, _ := filepath.Abs(filepath.Join("build", "_vendor")) + for _, dir := range path { + if dir == vendor { + return strings.Join(path, string(filepath.ListSeparator)) + } + } + newpath := append(path[:1], append([]string{vendor}, path[1:]...)...) + return strings.Join(newpath, string(filepath.ListSeparator)) } // VERSION returns the content of the VERSION file. diff --git a/vendor.conf b/vendor.conf index 7adb06482f..58837ee383 100644 --- a/vendor.conf +++ b/vendor.conf @@ -1,14 +1,15 @@ # package github.com/ethereum/go-ethereum +# import github.com/cespare/cp 165db2f github.com/davecgh/go-spew v1.0.0-3-g6d21280 github.com/ethereum/ethash v23.1-249-g214d4c0 -github.com/fatih/color v1.1.0-1-ga360acf -github.com/gizak/termui a7e3aee +github.com/fatih/color v1.1.0-4-gbf82308 +github.com/gizak/termui d29684e github.com/golang/snappy d9eb7a3 github.com/hashicorp/golang-lru 0a025b7 -github.com/huin/goupnp d7ddae7 +github.com/huin/goupnp 97f671e github.com/jackpal/go-nat-pmp v1.0.1-4-g1fa385a github.com/mattn/go-colorable v0.0.6-6-g6c903ff github.com/mattn/go-isatty 66b8e73 @@ -23,14 +24,17 @@ github.com/robertkrimen/otto bf1c379 github.com/rs/cors v1.0 github.com/rs/xhandler v1.0-1-ged27b6f github.com/syndtr/goleveldb 6b4daa5 -golang.org/x/crypto 1150b8b -golang.org/x/net 65dfc08 +golang.org/x/crypto ca7e7f1 +golang.org/x/net b336a97 golang.org/x/sys c200b10 -golang.org/x/text 2556e84 -golang.org/x/tools 20055e0 +golang.org/x/text a8b3843 +golang.org/x/tools 0db92ca gopkg.in/check.v1 4f90aea gopkg.in/fatih/set.v0 v0.1.0-3-g27c4092 gopkg.in/karalabe/cookiejar.v2 8dcd6a7 gopkg.in/natefinch/npipe.v2 c1b8fa8 gopkg.in/sourcemap.v1 v1.0.3 gopkg.in/urfave/cli.v1 v1.18.1 + +# exclude +-golang.org/x/net/context diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go index ecf6300bbf..06f4867f7f 100644 --- a/vendor/github.com/fatih/color/color.go +++ b/vendor/github.com/fatih/color/color.go @@ -332,27 +332,25 @@ func getCachedColor(p Attribute) *Color { return c } -func printColor(format string, p Attribute, a ...interface{}) { +func colorPrint(format string, p Attribute, a ...interface{}) { c := getCachedColor(p) - if len(a) == 0 { - a = append(a, format) - format = "%s" - } - if !strings.HasSuffix(format, "\n") { format += "\n" } - c.Printf(format, a...) + if len(a) == 0 { + c.Print(format) + } else { + c.Printf(format, a...) + } } -func printString(format string, p Attribute, a ...interface{}) string { +func colorString(format string, p Attribute, a ...interface{}) string { c := getCachedColor(p) if len(a) == 0 { - a = append(a, format) - format = "%s" + return c.SprintFunc()(format) } return c.SprintfFunc()(format, a...) @@ -360,66 +358,66 @@ func printString(format string, p Attribute, a ...interface{}) string { // Black is an convenient helper function to print with black foreground. A // newline is appended to format by default. -func Black(format string, a ...interface{}) { printColor(format, FgBlack, a...) } +func Black(format string, a ...interface{}) { colorPrint(format, FgBlack, a...) } // Red is an convenient helper function to print with red foreground. A // newline is appended to format by default. -func Red(format string, a ...interface{}) { printColor(format, FgRed, a...) } +func Red(format string, a ...interface{}) { colorPrint(format, FgRed, a...) } // Green is an convenient helper function to print with green foreground. A // newline is appended to format by default. -func Green(format string, a ...interface{}) { printColor(format, FgGreen, a...) } +func Green(format string, a ...interface{}) { colorPrint(format, FgGreen, a...) } // Yellow is an convenient helper function to print with yellow foreground. // A newline is appended to format by default. -func Yellow(format string, a ...interface{}) { printColor(format, FgYellow, a...) } +func Yellow(format string, a ...interface{}) { colorPrint(format, FgYellow, a...) } // Blue is an convenient helper function to print with blue foreground. A // newline is appended to format by default. -func Blue(format string, a ...interface{}) { printColor(format, FgBlue, a...) } +func Blue(format string, a ...interface{}) { colorPrint(format, FgBlue, a...) } // Magenta is an convenient helper function to print with magenta foreground. // A newline is appended to format by default. -func Magenta(format string, a ...interface{}) { printColor(format, FgMagenta, a...) } +func Magenta(format string, a ...interface{}) { colorPrint(format, FgMagenta, a...) } // Cyan is an convenient helper function to print with cyan foreground. A // newline is appended to format by default. -func Cyan(format string, a ...interface{}) { printColor(format, FgCyan, a...) } +func Cyan(format string, a ...interface{}) { colorPrint(format, FgCyan, a...) } // White is an convenient helper function to print with white foreground. A // newline is appended to format by default. -func White(format string, a ...interface{}) { printColor(format, FgWhite, a...) } +func White(format string, a ...interface{}) { colorPrint(format, FgWhite, a...) } // BlackString is an convenient helper function to return a string with black // foreground. -func BlackString(format string, a ...interface{}) string { return printString(format, FgBlack, a...) } +func BlackString(format string, a ...interface{}) string { return colorString(format, FgBlack, a...) } // RedString is an convenient helper function to return a string with red // foreground. -func RedString(format string, a ...interface{}) string { return printString(format, FgRed, a...) } +func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) } // GreenString is an convenient helper function to return a string with green // foreground. -func GreenString(format string, a ...interface{}) string { return printString(format, FgGreen, a...) } +func GreenString(format string, a ...interface{}) string { return colorString(format, FgGreen, a...) } // YellowString is an convenient helper function to return a string with yellow // foreground. -func YellowString(format string, a ...interface{}) string { return printString(format, FgYellow, a...) } +func YellowString(format string, a ...interface{}) string { return colorString(format, FgYellow, a...) } // BlueString is an convenient helper function to return a string with blue // foreground. -func BlueString(format string, a ...interface{}) string { return printString(format, FgBlue, a...) } +func BlueString(format string, a ...interface{}) string { return colorString(format, FgBlue, a...) } // MagentaString is an convenient helper function to return a string with magenta // foreground. func MagentaString(format string, a ...interface{}) string { - return printString(format, FgMagenta, a...) + return colorString(format, FgMagenta, a...) } // CyanString is an convenient helper function to return a string with cyan // foreground. -func CyanString(format string, a ...interface{}) string { return printString(format, FgCyan, a...) } +func CyanString(format string, a ...interface{}) string { return colorString(format, FgCyan, a...) } // WhiteString is an convenient helper function to return a string with white // foreground. -func WhiteString(format string, a ...interface{}) string { return printString(format, FgWhite, a...) } +func WhiteString(format string, a ...interface{}) string { return colorString(format, FgWhite, a...) } diff --git a/vendor/github.com/gizak/termui/linechart.go b/vendor/github.com/gizak/termui/linechart.go index 43b57e1d6a..81834efdbc 100644 --- a/vendor/github.com/gizak/termui/linechart.go +++ b/vendor/github.com/gizak/termui/linechart.go @@ -69,6 +69,7 @@ type LineChart struct { labelYSpace int maxY float64 minY float64 + autoLabels bool } // NewLineChart returns a new LineChart with current theme. @@ -211,7 +212,8 @@ func (lc *LineChart) calcLabelY() { func (lc *LineChart) calcLayout() { // set datalabels if it is not provided - if lc.DataLabels == nil || len(lc.DataLabels) == 0 { + if (lc.DataLabels == nil || len(lc.DataLabels) == 0) || lc.autoLabels { + lc.autoLabels = true lc.DataLabels = make([]string, len(lc.Data)) for i := range lc.Data { lc.DataLabels[i] = fmt.Sprint(i)