aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-04-14 17:33:10 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-04-14 17:33:10 +0800
commit6876e92f8d467dbefd88bbd91df700883ab9c2af (patch)
tree1bf152b98887bd251ff124f09238dcab7bdddb62 /build
parent15f32a8d5758544b7993e46a7addf082994a5a3e (diff)
parent0cc492f81595c28caa24964a105446e362164539 (diff)
downloadgo-tangerine-6876e92f8d467dbefd88bbd91df700883ab9c2af.tar
go-tangerine-6876e92f8d467dbefd88bbd91df700883ab9c2af.tar.gz
go-tangerine-6876e92f8d467dbefd88bbd91df700883ab9c2af.tar.bz2
go-tangerine-6876e92f8d467dbefd88bbd91df700883ab9c2af.tar.lz
go-tangerine-6876e92f8d467dbefd88bbd91df700883ab9c2af.tar.xz
go-tangerine-6876e92f8d467dbefd88bbd91df700883ab9c2af.tar.zst
go-tangerine-6876e92f8d467dbefd88bbd91df700883ab9c2af.zip
Merge remote-tracking branch 'fjl/license-update-1.6'
Diffstat (limited to 'build')
-rw-r--r--build/update-license.go24
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())}