From 0cc492f81595c28caa24964a105446e362164539 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 14 Apr 2017 10:29:00 +0200 Subject: all: update license information --- build/update-license.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'build') diff --git a/build/update-license.go b/build/update-license.go index ee5281410..81b1a507d 100644 --- a/build/update-license.go +++ b/build/update-license.go @@ -49,11 +49,13 @@ var ( // don't relicense vendored sources "crypto/sha3/", "crypto/ecies/", "log/", "crypto/secp256k1/curve.go", + "consensus/ethash/xor.go", + "internal/jsre/deps", + "cmd/internal/browser", // don't license generated files "contracts/chequebook/contract/", "contracts/ens/contract/", "contracts/release/contract.go", - "p2p/discv5/nodeevent_string.go", } // paths with this prefix are licensed as GPL. all other files are LGPL. @@ -284,6 +286,9 @@ func getInfo(files <-chan string, out chan<- *info, wg *sync.WaitGroup) { if !stat.Mode().IsRegular() { continue } + if isGenerated(file) { + continue + } info, err := fileInfo(file) if err != nil { fmt.Printf("ERROR %s: %v\n", file, err) @@ -294,6 +299,23 @@ func getInfo(files <-chan string, out chan<- *info, wg *sync.WaitGroup) { 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, _ := fd.Read(buf) + 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())} -- cgit