diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-09-08 11:36:03 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-09-08 12:36:43 +0000 |
| commit | 1df6c94250b7558c1016ec24dadb97c447213e16 (patch) | |
| tree | 90c0eacd5b4e06954873e64c927ddaf4ec8cc556 /pkg/subsystem/linux/subsystems.go | |
| parent | 723248446556f80ee1e869fe7569fe4a7ed4feca (diff) | |
pkg/subsystem: do not reuse customly grouped records
If a record was specified in a custom subsystem list, do not consider it
while grouping records by mailing list.
Diffstat (limited to 'pkg/subsystem/linux/subsystems.go')
| -rw-r--r-- | pkg/subsystem/linux/subsystems.go | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/pkg/subsystem/linux/subsystems.go b/pkg/subsystem/linux/subsystems.go index 1d1d84ed2..38473c901 100644 --- a/pkg/subsystem/linux/subsystems.go +++ b/pkg/subsystem/linux/subsystems.go @@ -29,12 +29,11 @@ func listFromRepoInner(root fs.FS, rules *customRules) ([]*subsystem.Subsystem, rawRecords: records, extraRules: rules, } - list := ctx.groupByList() extraList, err := ctx.groupByRules() if err != nil { return nil, err } - list = append(list, extraList...) + list := append(ctx.groupByList(), extraList...) matrix, err := BuildCoincidenceMatrix(root, list, dropPatterns) if err != nil { return nil, err @@ -108,19 +107,31 @@ func (ctx *linuxCtx) groupByRules() ([]*subsystem.Subsystem, error) { for _, item := range ctx.rawRecords { perName[item.name] = item } - ret := []*subsystem.Subsystem{} + var ret []*subsystem.Subsystem + exclude := map[*maintainersRecord]struct{}{} for name, recordNames := range ctx.extraRules.extraSubsystems { matching := []*maintainersRecord{} for _, recordName := range recordNames { - if perName[recordName] == nil { + record := perName[recordName] + if record == nil { return nil, fmt.Errorf("MAINTAINERS record not found: %#v", recordName) } - matching = append(matching, perName[recordName]) + exclude[record] = struct{}{} + matching = append(matching, record) } s := mergeRawRecords(matching, "") s.Name = name ret = append(ret, s) } + // Exclude rawRecords from further consideration. + var newRecords []*maintainersRecord + for _, record := range ctx.rawRecords { + if _, ok := exclude[record]; ok { + continue + } + newRecords = append(newRecords, record) + } + ctx.rawRecords = newRecords return ret, nil } |
