aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-09-08 11:36:03 +0200
committerAleksandr Nogikh <nogikh@google.com>2023-09-08 12:36:43 +0000
commit1df6c94250b7558c1016ec24dadb97c447213e16 (patch)
tree90c0eacd5b4e06954873e64c927ddaf4ec8cc556 /pkg/subsystem
parent723248446556f80ee1e869fe7569fe4a7ed4feca (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')
-rw-r--r--pkg/subsystem/linux/subsystems.go21
-rw-r--r--pkg/subsystem/linux/subsystems_test.go16
-rw-r--r--pkg/subsystem/lists/linux.go10
3 files changed, 31 insertions, 16 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
}
diff --git a/pkg/subsystem/linux/subsystems_test.go b/pkg/subsystem/linux/subsystems_test.go
index f60f6d70f..7e6869161 100644
--- a/pkg/subsystem/linux/subsystems_test.go
+++ b/pkg/subsystem/linux/subsystems_test.go
@@ -27,9 +27,10 @@ func TestGroupLinuxSubsystems(t *testing.T) {
}
expected := []*subsystem.Subsystem{
{
- Name: "fs",
- Lists: []string{"linux-fsdevel@vger.kernel.org"},
- Maintainers: []string{"email_vfs@email.com"},
+ Name: "fs",
+ Lists: []string{"linux-fsdevel@vger.kernel.org"},
+ // Two different subsystems point to linux-fsdevel@vger.kernel.org, so
+ // we do not include maintainers.
},
{
Name: "ext4",
@@ -73,7 +74,15 @@ func TestCustomCallRules(t *testing.T) {
assert.Contains(t, subsystems, &subsystem.Subsystem{
Name: "udf",
Maintainers: []string{"email_udf@email.com"},
+ Lists: []string{"linux-fsdevel@vger.kernel.org"},
})
+ // Now that udf is excluded, it becomes possible to generate a maintainer list for vfs.
+ assert.Contains(t, subsystems, &subsystem.Subsystem{
+ Name: "fs",
+ Lists: []string{"linux-fsdevel@vger.kernel.org"},
+ Maintainers: []string{"email_vfs@email.com"},
+ })
+
expectCalls := map[string][]string{
"ext4": {"syz_mount_image$ext4"},
"tmpfs": {"syz_mount_image$tmpfs"},
@@ -275,6 +284,7 @@ F: mm/shmem*
UDF FILESYSTEM
M: email_udf <email_udf@email.com>
+L: linux-fsdevel@vger.kernel.org
S: Maintained
F: Documentation/filesystems/udf.rst
F: fs/udf/
diff --git a/pkg/subsystem/lists/linux.go b/pkg/subsystem/lists/linux.go
index 9de1c4ffb..b94c52cb2 100644
--- a/pkg/subsystem/lists/linux.go
+++ b/pkg/subsystem/lists/linux.go
@@ -168,7 +168,6 @@ func init() {
// - net-drivers
// - netfilter
// - lvs
-// - nfc
// - openvswitch
// - openwrt
// - oss-drivers
@@ -182,6 +181,7 @@ func init() {
// - wireguard
// - wpan
// - x25
+// - nfc
// - nitro
// - ntb
// - nvdimm
@@ -1392,14 +1392,9 @@ func subsystems_linux() []*Subsystem {
PathRules: []PathRule{
{IncludeRegexp: "^fs/affs/"},
{IncludeRegexp: "^fs/dax\\.c$|^include/linux/dax\\.h$|^include/trace/events/fs_dax\\.h$"},
- {IncludeRegexp: "^fs/exfat/"},
{IncludeRegexp: "^fs/fcntl\\.c$|^fs/locks\\.c$|^include/linux/fcntl\\.h$|^include/uapi/linux/fcntl\\.h$"},
{IncludeRegexp: "^fs/fuse/virtio_fs\\.c$|^include/uapi/linux/virtio_fs\\.h$"},
- {IncludeRegexp: "^fs/fuse/|^include/uapi/linux/fuse\\.h$"},
- {IncludeRegexp: "^fs/hfs/"},
- {IncludeRegexp: "^fs/hfsplus/"},
{IncludeRegexp: "^fs/iomap/|^include/linux/iomap\\.h$"},
- {IncludeRegexp: "^fs/isofs/"},
{IncludeRegexp: "^fs/notify/dnotify/|^include/linux/dnotify\\.h$"},
{IncludeRegexp: "^fs/notify/fanotify/|^include/linux/fanotify\\.h$|^include/uapi/linux/fanotify\\.h$"},
{IncludeRegexp: "^fs/notify/inotify/|^include/linux/inotify\\.h$|^include/uapi/linux/inotify\\.h$"},
@@ -3139,7 +3134,6 @@ func subsystems_linux() []*Subsystem {
{IncludeRegexp: "^drivers/net/wwan/|^include/linux/wwan\\.h$|^include/uapi/linux/wwan\\.h$"},
{IncludeRegexp: "^drivers/net/xen-netback/"},
{IncludeRegexp: "^drivers/nfc/virtual_ncidev\\.c$"},
- {IncludeRegexp: "^drivers/nfc/|^include/net/nfc/|^include/uapi/linux/nfc\\.h$|^net/nfc/"},
{IncludeRegexp: "^drivers/phy/freescale/phy-fsl-lynx-28g\\.c$"},
{IncludeRegexp: "^drivers/ptp/ptp_dfl_tod\\.c$"},
{IncludeRegexp: "^drivers/ptp/ptp_ocp\\.c$"},
@@ -3210,7 +3204,7 @@ func subsystems_linux() []*Subsystem {
Name: "nfc",
Lists: []string{"netdev@vger.kernel.org"},
Maintainers: []string{"krzysztof.kozlowski@linaro.org"},
- Parents: []*Subsystem{&net},
+ Parents: []*Subsystem{&kernel},
PathRules: []PathRule{
{IncludeRegexp: "^drivers/nfc/|^include/net/nfc/|^include/uapi/linux/nfc\\.h$|^net/nfc/"},
},