util/scrips/maintainers.go: Allow file to appear in multiple components

Without this change, the tool only reports the first hit. We want to see
all of them.

Change-Id: Ib59b13c50b61c48e3cb200bf57e28c9453590819
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/29602
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
This commit is contained in:
Patrick Georgi 2018-11-12 17:29:49 +01:00
parent cca1f371d2
commit 2e5d6a8153
1 changed files with 12 additions and 4 deletions

View File

@ -177,6 +177,8 @@ func match_file(fname string, files []string) (bool, error) {
} }
func find_maintainer(fname string) { func find_maintainer(fname string) {
var success bool
for _, subsystem := range subsystems { for _, subsystem := range subsystems {
matched, err := match_file(fname, subsystem.file) matched, err := match_file(fname, subsystem.file)
if err != nil { if err != nil {
@ -184,16 +186,20 @@ func find_maintainer(fname string) {
return return
} }
if matched && subsystem.name != "THE REST" { if matched && subsystem.name != "THE REST" {
success = true
fmt.Println(fname, "is in subsystem", fmt.Println(fname, "is in subsystem",
subsystem.name) subsystem.name)
fmt.Println("Maintainers: ", subsystem.maintainer) fmt.Println("Maintainers: ", subsystem.maintainer)
return
} }
} }
fmt.Println(fname, "has no subsystem defined in MAINTAINERS") if !success {
fmt.Println(fname, "has no subsystem defined in MAINTAINERS")
}
} }
func find_unmaintained(fname string) { func find_unmaintained(fname string) {
var success bool
for _, subsystem := range subsystems { for _, subsystem := range subsystems {
matched, err := match_file(fname, subsystem.file) matched, err := match_file(fname, subsystem.file)
if err != nil { if err != nil {
@ -201,12 +207,14 @@ func find_unmaintained(fname string) {
return return
} }
if matched && subsystem.name != "THE REST" { if matched && subsystem.name != "THE REST" {
success = true
fmt.Println(fname, "is in subsystem", fmt.Println(fname, "is in subsystem",
subsystem.name) subsystem.name)
return
} }
} }
fmt.Println(fname, "has no subsystem defined in MAINTAINERS") if !success {
fmt.Println(fname, "has no subsystem defined in MAINTAINERS")
}
} }
func main() { func main() {