diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/update-license.go | 24 |
1 files changed, 23 insertions, 1 deletions
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())} |