[coreboot-gerrit] Change in coreboot[master]: util/scripts/maintainers.go: Add Gerrit reviewers config emitter
Patrick Georgi (Code Review)
gerrit at coreboot.org
Mon Nov 12 18:50:16 CET 2018
Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/29607
Change subject: util/scripts/maintainers.go: Add Gerrit reviewers config emitter
......................................................................
util/scripts/maintainers.go: Add Gerrit reviewers config emitter
The gerrit reviewers plugin has a certain configuration format. Teach
maintainers to emit it when called with -print-gerrit-rules.
Change-Id: I92cfc905e0c1b03b7cf793a4324c392140a22060
Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
M util/scripts/maintainers.go
1 file changed, 35 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/29607/1
diff --git a/util/scripts/maintainers.go b/util/scripts/maintainers.go
index 6d91b90..1204e95 100644
--- a/util/scripts/maintainers.go
+++ b/util/scripts/maintainers.go
@@ -286,10 +286,40 @@
return "^" + regex + "$"
}
+var is_email *regexp.Regexp
+
+func extract_maintainer(maintainer string) string {
+ if is_email == nil {
+ is_email = regexp.MustCompile("<[^>]*>")
+ }
+
+ if match := is_email.FindStringSubmatch(maintainer); match != nil {
+ return match[0][1 : len(match[0])-1]
+ }
+ return maintainer
+}
+
+func do_print_gerrit_rules() {
+ for _, subsystem := range subsystems {
+ if len(subsystem.paths) == 0 || len(subsystem.maintainer) == 0 {
+ continue
+ }
+ fmt.Println("#", subsystem.name)
+ for _, path := range subsystem.paths {
+ fmt.Println("[filter \"file:" + path_to_regexstr(path) + "\"]")
+ for _, maint := range subsystem.maintainer {
+ fmt.Println(" reviewer =", extract_maintainer(maint))
+ }
+ }
+ fmt.Println()
+ }
+}
+
func main() {
var files []string
var err error
+ var print_gerrit_rules = flag.Bool("print-gerrit-rules", false, "emit the MAINTAINERS rules in a format suitable for Gerrit's reviewers plugin")
var debug = flag.Bool("debug", false, "emit additional debug output")
flag.Parse()
@@ -305,6 +335,11 @@
print_maintainers()
}
+ if *print_gerrit_rules {
+ do_print_gerrit_rules()
+ return
+ }
+
args := flag.Args()
if len(args) == 0 {
/* get the filenames */
--
To view, visit https://review.coreboot.org/29607
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I92cfc905e0c1b03b7cf793a4324c392140a22060
Gerrit-Change-Number: 29607
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Georgi <pgeorgi at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181112/c3a00d39/attachment.html>
More information about the coreboot-gerrit
mailing list