Skip to content

Commit 364e485

Browse files
committed
build: update license exclusions, case insensitive author list
1 parent 57fc1d2 commit 364e485

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

build/update-license.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,22 @@ var (
6262
skipPrefixes = []string{
6363
// boring stuff
6464
"vendor/", "tests/testdata/", "build/",
65+
6566
// don't relicense vendored sources
6667
"cmd/internal/browser",
68+
"common/bitutil/bitutil",
69+
"common/prque/",
6770
"consensus/ethash/xor.go",
6871
"crypto/bn256/",
6972
"crypto/ecies/",
70-
"crypto/secp256k1/curve.go",
71-
"crypto/sha3/",
73+
"graphql/graphiql.go",
7274
"internal/jsre/deps",
7375
"log/",
74-
"common/bitutil/bitutil",
76+
"metrics/",
77+
"signer/rules/deps",
78+
79+
// skip special licenses
80+
"crypto/secp256k1", // Relicensed to BSD-3 via https://github.com/ethereum/go-ethereum/pull/17225
7581
}
7682

7783
// paths with this prefix are licensed as GPL. all other files are LGPL.
@@ -144,6 +150,13 @@ func (i info) gpl() bool {
144150
return false
145151
}
146152

153+
// authors implements the sort.Interface for strings in case-insensitive mode.
154+
type authors []string
155+
156+
func (as authors) Len() int { return len(as) }
157+
func (as authors) Less(i, j int) bool { return strings.ToLower(as[i]) < strings.ToLower(as[j]) }
158+
func (as authors) Swap(i, j int) { as[i], as[j] = as[j], as[i] }
159+
147160
func main() {
148161
var (
149162
files = getFiles()
@@ -263,7 +276,7 @@ func mailmapLookup(authors []string) []string {
263276

264277
func writeAuthors(files []string) {
265278
merge := make(map[string]bool)
266-
// Add authors that Git reports as contributorxs.
279+
// Add authors that Git reports as contributors.
267280
// This is the primary source of author information.
268281
for _, a := range gitAuthors(files) {
269282
merge[a] = true
@@ -279,7 +292,7 @@ func writeAuthors(files []string) {
279292
for a := range merge {
280293
result = append(result, a)
281294
}
282-
sort.Strings(result)
295+
sort.Sort(authors(result))
283296
content := new(bytes.Buffer)
284297
content.WriteString(authorsFileHeader)
285298
for _, a := range result {

0 commit comments

Comments
 (0)