Skip to content

Commit 7b4ea91

Browse files
davidbenpi-314159
authored andcommitted
Clean up "copyright consolidation" tools
Now that the change has been applied, we no longer need these. Bug: 364634028 Change-Id: I2979b62489d640807c6b2568227c015a05af4d4b Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/74767 Reviewed-by: Adam Langley <[email protected]> Commit-Queue: David Benjamin <[email protected]>
1 parent 1e27514 commit 7b4ea91

File tree

3 files changed

+0
-527
lines changed

3 files changed

+0
-527
lines changed

Diff for: util/copyright.pl

-111
This file was deleted.

Diff for: util/copyright_summary.go

-62
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,14 @@ import (
2626
"iter"
2727
"maps"
2828
"os"
29-
"path/filepath"
3029
"regexp"
3130
"slices"
3231
"strconv"
33-
"strings"
3432
)
3533

3634
var (
3735
outPath = flag.String("out", "", "The path to write the results in JSON format")
3836
comparePath = flag.String("compare", "", "The path to a JSON file to compare against")
39-
useMapping = flag.Bool("use-mapping", false, "Apply the mapping and look up files in OpenSSL instead")
4037
)
4138

4239
func sortedKeyValuePairs[K cmp.Ordered, V any](m map[K]V) iter.Seq2[K, V] {
@@ -69,35 +66,6 @@ var copyrightRE = regexp.MustCompile(
6966
// summary to double-check an otherwise mostly automated process.
7067
`([-a-zA-Z ]*[-a-zA-Z])`)
7168

72-
var fileMapping map[string][]string
73-
74-
//go:embed mapping.txt
75-
var fileMappingData string
76-
77-
func parseMapping() (map[string][]string, error) {
78-
ret := map[string][]string{}
79-
for _, line := range strings.Split(fileMappingData, "\n") {
80-
if idx := strings.IndexByte(line, '#'); idx >= 0 {
81-
line = line[:idx]
82-
}
83-
line = strings.TrimSpace(line)
84-
if len(line) == 0 {
85-
continue
86-
}
87-
colon := strings.IndexByte(line, ':')
88-
if colon < 0 {
89-
return nil, fmt.Errorf("could not parse %q", line)
90-
}
91-
from := strings.TrimSpace(line[:colon])
92-
to := strings.TrimSpace(line[colon+1:])
93-
if _, ok := ret[from]; ok {
94-
return nil, fmt.Errorf("duplicate mapping for %q", from)
95-
}
96-
ret[from] = strings.Fields(to)
97-
}
98-
return ret, nil
99-
}
100-
10169
type CopyrightInfo struct {
10270
Name string
10371
StartYear int
@@ -127,27 +95,6 @@ func summarize(info FileInfo) map[string]int {
12795
}
12896

12997
func process(path string) (info FileInfo, err error) {
130-
if !*useMapping {
131-
return processImpl(path)
132-
}
133-
134-
newPaths, ok := fileMapping[path]
135-
if !ok {
136-
err = fmt.Errorf("no mapping found for %q", path)
137-
return
138-
}
139-
for _, newPath := range newPaths {
140-
var newInfo FileInfo
141-
newInfo, err = processImpl(filepath.Join("../openssl", newPath))
142-
if err != nil {
143-
return
144-
}
145-
info.MergeFrom(newInfo)
146-
}
147-
return
148-
}
149-
150-
func processImpl(path string) (info FileInfo, err error) {
15198
f, err := os.Open(path)
15299
if err != nil {
153100
return
@@ -175,15 +122,6 @@ func processImpl(path string) (info FileInfo, err error) {
175122
func main() {
176123
flag.Parse()
177124

178-
if *useMapping {
179-
var err error
180-
fileMapping, err = parseMapping()
181-
if err != nil {
182-
fmt.Fprintf(os.Stderr, "Error parsing mapping file: %s\n", err)
183-
os.Exit(1)
184-
}
185-
}
186-
187125
infos := map[string]FileInfo{}
188126
for _, path := range flag.Args() {
189127
info, err := process(path)

0 commit comments

Comments
 (0)