From 364e485e5134843c9f6abc0ff51096bb4c8655c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 22 Jul 2019 12:16:51 +0300 Subject: [PATCH] build: update license exclusions, case insensitive author list --- build/update-license.go | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/build/update-license.go b/build/update-license.go index 0ce829233..1bad7585d 100644 --- a/build/update-license.go +++ b/build/update-license.go @@ -62,16 +62,22 @@ var ( skipPrefixes = []string{ // boring stuff "vendor/", "tests/testdata/", "build/", + // don't relicense vendored sources "cmd/internal/browser", + "common/bitutil/bitutil", + "common/prque/", "consensus/ethash/xor.go", "crypto/bn256/", "crypto/ecies/", - "crypto/secp256k1/curve.go", - "crypto/sha3/", + "graphql/graphiql.go", "internal/jsre/deps", "log/", - "common/bitutil/bitutil", + "metrics/", + "signer/rules/deps", + + // skip special licenses + "crypto/secp256k1", // Relicensed to BSD-3 via https://github.com/ethereum/go-ethereum/pull/17225 } // paths with this prefix are licensed as GPL. all other files are LGPL. @@ -144,6 +150,13 @@ func (i info) gpl() bool { return false } +// authors implements the sort.Interface for strings in case-insensitive mode. +type authors []string + +func (as authors) Len() int { return len(as) } +func (as authors) Less(i, j int) bool { return strings.ToLower(as[i]) < strings.ToLower(as[j]) } +func (as authors) Swap(i, j int) { as[i], as[j] = as[j], as[i] } + func main() { var ( files = getFiles() @@ -263,7 +276,7 @@ func mailmapLookup(authors []string) []string { func writeAuthors(files []string) { merge := make(map[string]bool) - // Add authors that Git reports as contributorxs. + // Add authors that Git reports as contributors. // This is the primary source of author information. for _, a := range gitAuthors(files) { merge[a] = true @@ -279,7 +292,7 @@ func writeAuthors(files []string) { for a := range merge { result = append(result, a) } - sort.Strings(result) + sort.Sort(authors(result)) content := new(bytes.Buffer) content.WriteString(authorsFileHeader) for _, a := range result {