Explorar el Código

Merge pull request #7808 from heyitsanthony/auto-bom

CI BOM checking
Anthony Romano hace 8 años
padre
commit
2a3229c00a

+ 1 - 0
.travis.yml

@@ -42,6 +42,7 @@ addons:
 
 before_install:
  - go get -v -u github.com/chzchzchz/goword
+ - go get -v -u github.com/coreos/license-bill-of-materials
  - go get -v -u honnef.co/go/tools/cmd/gosimple
  - go get -v -u honnef.co/go/tools/cmd/unused
  - go get -v -u honnef.co/go/tools/cmd/staticcheck

+ 8 - 7
bill-of-materials.json

@@ -4,6 +4,11 @@
 		"license": "MIT License",
 		"confidence": 0.989
 	},
+	{
+		"project": "github.com/bgentry/speakeasy",
+		"license": "MIT License",
+		"confidence": 0.944
+	},
 	{
 		"project": "github.com/boltdb/bolt",
 		"license": "MIT License",
@@ -102,7 +107,7 @@
 	{
 		"project": "github.com/matttproud/golang_protobuf_extensions/pbutil",
 		"license": "Apache License 2.0",
-		"confidence": 0.999
+		"confidence": 1
 	},
 	{
 		"project": "github.com/olekukonko/tablewriter",
@@ -137,7 +142,7 @@
 	{
 		"project": "github.com/shurcooL/sanitized_anchor_name",
 		"license": "MIT License",
-		"confidence": 0.989
+		"confidence": 1
 	},
 	{
 		"project": "github.com/spf13/cobra",
@@ -157,7 +162,7 @@
 	{
 		"project": "github.com/urfave/cli",
 		"license": "MIT License",
-		"confidence": 0.995
+		"confidence": 1
 	},
 	{
 		"project": "github.com/xiang90/probing",
@@ -203,9 +208,5 @@
 		"project": "bitbucket.org/ww/goautoneg",
 		"license": "BSD 3-clause \"New\" or \"Revised\" License",
 		"confidence": 1
-	},
-	{
-		"project": "github.com/bgentry/speakeasy",
-		"error": "No license detected"
 	}
 ]

+ 24 - 0
cmd/vendor/github.com/bgentry/speakeasy/LICENSE

@@ -0,0 +1,24 @@
+MIT License
+
+Copyright (c) 2017 Blake Gentry
+
+This license applies to the non-Windows portions of this library. The Windows
+portion maintains its own Apache 2.0 license.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 8 - 6
cmd/vendor/github.com/bgentry/speakeasy/speakeasy.go

@@ -14,16 +14,18 @@ func Ask(prompt string) (password string, err error) {
 	return FAsk(os.Stdout, prompt)
 }
 
-// Same as the Ask function, except it is possible to specify the file to write
-// the prompt to.
-func FAsk(file *os.File, prompt string) (password string, err error) {
-	if prompt != "" {
-		fmt.Fprint(file, prompt) // Display the prompt.
+// FAsk is the same as Ask, except it is possible to specify the file to write
+// the prompt to. If 'nil' is passed as the writer, no prompt will be written.
+func FAsk(wr io.Writer, prompt string) (password string, err error) {
+	if wr != nil && prompt != "" {
+		fmt.Fprint(wr, prompt) // Display the prompt.
 	}
 	password, err = getPassword()
 
 	// Carriage return after the user input.
-	fmt.Fprintln(file, "")
+	if wr != nil {
+		fmt.Fprintln(wr, "")
+	}
 	return
 }
 

+ 1 - 1
cmd/vendor/github.com/bgentry/speakeasy/speakeasy_unix.go

@@ -4,7 +4,7 @@
 // Original code is based on code by RogerV in the golang-nuts thread:
 // https://groups.google.com/group/golang-nuts/browse_thread/thread/40cc41e9d9fc9247
 
-// +build darwin freebsd linux netbsd openbsd solaris
+// +build darwin dragonfly freebsd linux netbsd openbsd solaris
 
 package speakeasy
 

+ 3 - 5
cmd/vendor/github.com/bgentry/speakeasy/speakeasy_windows.go

@@ -3,7 +3,6 @@
 package speakeasy
 
 import (
-	"os"
 	"syscall"
 )
 
@@ -12,18 +11,17 @@ import (
 const ENABLE_ECHO_INPUT = 0x0004
 
 func getPassword() (password string, err error) {
-	hStdin := syscall.Handle(os.Stdin.Fd())
 	var oldMode uint32
 
-	err = syscall.GetConsoleMode(hStdin, &oldMode)
+	err = syscall.GetConsoleMode(syscall.Stdin, &oldMode)
 	if err != nil {
 		return
 	}
 
 	var newMode uint32 = (oldMode &^ ENABLE_ECHO_INPUT)
 
-	err = setConsoleMode(hStdin, newMode)
-	defer setConsoleMode(hStdin, oldMode)
+	err = setConsoleMode(syscall.Stdin, newMode)
+	defer setConsoleMode(syscall.Stdin, oldMode)
 	if err != nil {
 		return
 	}

+ 6 - 4
cmd/vendor/github.com/shurcooL/sanitized_anchor_name/LICENSE

@@ -1,3 +1,5 @@
+MIT License
+
 Copyright (c) 2015 Dmitri Shuralyov
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -7,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:
 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 4 - 4
glide.lock

@@ -1,12 +1,12 @@
-hash: 60bceef84b41089b86b05a4e3ddbf2ccf9b94e2e3ca9332a9d463cd837bee26e
-updated: 2017-04-22T18:32:32.564649649-07:00
+hash: 4248f4a610b399df10cab942b0b3ef8a6d7db9c942bafd115f25d05293571658
+updated: 2017-04-24T16:15:17.066493631-07:00
 imports:
 - name: github.com/beorn7/perks
   version: 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
   subpackages:
   - quantile
 - name: github.com/bgentry/speakeasy
-  version: 36e9cfdd690967f4f690c6edcc9ffacd006014a0
+  version: 4aabc24848ce5fd31929f7d1e4ea74d3709c14cd
 - name: github.com/boltdb/bolt
   version: 583e8937c61f1af6513608ccc75c97b6abdf4ff9
 - name: github.com/cockroachdb/cmux
@@ -96,7 +96,7 @@ imports:
 - name: github.com/russross/blackfriday
   version: b253417e1cb644d645a0a3bb1fa5034c8030127c
 - name: github.com/shurcooL/sanitized_anchor_name
-  version: 1dba4b3954bc059efc3991ec364f9f9a35f597d2
+  version: 79c90efaf01eddc01945af5bc1797859189b830b
 - name: github.com/spf13/cobra
   version: 1c44ec8d3f1552cac48999f9306da23c4d8a288b
 - name: github.com/spf13/pflag

+ 1 - 1
glide.yaml

@@ -1,7 +1,7 @@
 package: github.com/coreos/etcd
 import:
 - package: github.com/bgentry/speakeasy
-  version: 36e9cfdd690967f4f690c6edcc9ffacd006014a0
+  version: 4aabc24848ce5fd31929f7d1e4ea74d3709c14cd
 - package: github.com/boltdb/bolt
   version: v1.3.0
 - package: github.com/cockroachdb/cmux

+ 16 - 1
test

@@ -20,7 +20,7 @@ source ./build
 etcd_setup_gopath
 
 if [ -z "$PASSES" ]; then
-	PASSES="fmt dep compile build unit"
+	PASSES="fmt bom dep compile build unit"
 fi
 
 # Invoke ./cover for HTML output
@@ -329,6 +329,21 @@ function fmt_pass {
 	done
 }
 
+function bom_pass {
+	if ! which license-bill-of-materials >/dev/null; then
+		return
+	fi
+	echo "Checking bill of materials..."
+	license-bill-of-materials \
+		--override-file bill-of-materials.override.json \
+		github.com/coreos/etcd github.com/coreos/etcd/etcdctl >bom-now.json || true
+	if ! diff bill-of-materials.json bom-now.json; then
+		echo vendored licenses do not match given bill of materials
+		exit 255
+	fi
+	rm bom-now.json
+}
+
 function dep_pass {
 	echo "Checking package dependencies..."
 	# don't pull in etcdserver package