Skip to contentSkip to conversation

get_maintainer: Add the --for-tree argument

PATCH In review Palmer Dabbelt 2 participants 5 messages Oct 13, 2022 – Oct 14, 2022 GET_MAINTAINER script

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 get_maintainer: Add the --for-tree argument

I recently wanted to look up the maintainers for each tree path via a script, and I couldn't find a better way to do that than poking get_maintainer.pl to add a new argument. This lets folks run something like

    $ ./scripts/get_maintainer.pl --for-tree git://github.com/kvm-riscv/linux.git
    Anup Patel <[email protected]> (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))

to find out who owns a tree.

---
 scripts/get_maintainer.pl | 48 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)
scripts/get_maintainer.pl +46 -2
index ab123b498fd9..70abefadd295 100755
@@ -23,6 +23,7 @@ use File::Spec::Functions;
 
 my $cur_path = fastgetcwd() . '/';
 my $lk_path = "./";
+my $for_tree = undef;
 my $email = 1;
 my $email_usename = 1;
 my $email_maintainer = 1;
@@ -239,6 +240,7 @@ if ($#ARGV > 0) {
 
 if (!GetOptions(
 		'email!' => \$email,
+		'for-tree=s' => \$for_tree,
 		'git!' => \$email_git,
 		'git-all-signature-types!' => \$email_git_all_signature_types,
 		'git-blame!' => \$email_git_blame,
@@ -300,7 +302,7 @@ if (defined $self_test) {
     exit 0;
 }
 
-if (-t STDIN && !@ARGV) {
+if (-t STDIN && !@ARGV && !$for_tree) {
     # We're talking to a terminal, but have no command line arguments.
     die "$P: missing patchfile or -f file - use --help if necessary\n";
 }
@@ -527,7 +529,7 @@ sub read_mailmap {
 
 ## use the filenames on the command line or find the filenames in the patchfiles
 
-if (!@ARGV) {
+if (!@ARGV && !$for_tree) {
     push(@ARGV, "&STDIN");
 }
 
@@ -951,6 +953,47 @@ sub get_maintainers {
 	}
     }
 
+    if ($for_tree) {
+        my $tvi = find_first_section();
+        while ($tvi < @typevalue) {
+            my $start = find_starting_index($tvi);
+            my $end = find_ending_index($tvi);
+            $tvi = $end + 1;
+
+            my $i;
+            my $tree_match = 0;
+            for ($i = $start; $i < $end; $i++) {
+                my $line = $typevalue[$i];
+                if ($line =~ m/^([A-Z]):(.*)/) {
+                    my $type = $1;
+                    my $value = $2;
+
+                    if ($type eq 'T') {
+                        if ($for_tree eq $value || "git $for_tree" eq $value) {
+                            $tree_match = 1
+                        }
+                    }
+                }
+            }
+
+            if ($tree_match) {
+                for ($i = $start; $i < $end; $i++) {
+                    my $line = $typevalue[$i];
+                    if ($line =~ m/^([A-Z]):(.*)/) {
+                        my $type = $1;
+                        my $value = $2;
+
+                        if ($type eq 'M' || $type eq 'L') {
+                            my $role = get_maintainer_role($i);
+                            push_email_address($value, $role)
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
     foreach my $email (@email_to, @list_to) {
 	$email->[0] = deduplicate_email($email->[0]);
     }
@@ -1074,6 +1117,7 @@ Output type options:
   --multiline => print 1 entry per line
 
 Other options:
+  --for-tree => Get maintainers for the given tree
   --pattern-depth => Number of pattern directory traversals (default: 0 (all))
   --keywords => scan patch for keywords (default: $keywords)
   --sections => print all of the subsystem sections with pattern matches
Signature · 1 line
2.38.0
maintainer
#1 lore raw
Quoted 5 lines · Palmer Dabbelt

I recently wanted to look up the maintainers for each tree path via a script, and I couldn't find a better way to do that than poking get_maintainer.pl to add a new argument. This lets folks run something like

Quoted 7 lines
    $ ./scripts/get_maintainer.pl --for-tree git://github.com/kvm-riscv/linux.git
    Anup Patel <[email protected]> (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))

to find out who owns a tree.

I'm not sure this is useful.

It seems far simpler to grep the MAINTAINERS file for the repository.

And:

$ git grep "^T:" MAINTAINERS | sort | uniq -c | sort -rn | head -10
    153 MAINTAINERS:T:	git git://linuxtv.org/media_tree.git
     70 MAINTAINERS:T:	git git://anongit.freedesktop.org/drm/drm-misc
     33 MAINTAINERS:T:	git git://linuxtv.org/anttip/media_tree.git
      9 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
      6 MAINTAINERS:T:	git git://linuxtv.org/mkrufky/tuners.git
      6 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
      6 MAINTAINERS:T:	git git://github.com/broadcom/stblinux.git
      5 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
      5 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
      5 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev

I think I would not like to see the output for git repositories with 153 matches. (or even 5 matches)

For instance: (I've more comments below this too)

$ ./scripts/get_maintainer.pl --for-tree=git://linuxtv.org/media_tree.git
Hans Verkuil <[email protected]> (maintainer:AIMSLAB FM RADIO RECEIVER DRIVER)
[email protected] (maintainer:AIMSLAB FM RADIO RECEIVER DRIVER)
Maxime Ripard <[email protected]> (maintainer:ALLWINNER A10 CSI DRIVER)
Paul Kocialkowski <[email protected]> (maintainer:ALLWINNER A31 MIPI CSI-2 BRIDGE DRIVER)
Tianshu Qiu <[email protected]> (maintainer:ASAHI KASEI AK7375 LENS VOICE COIL DRIVER)
Mauro Carvalho Chehab <[email protected]> (maintainer:AZ6007 DVB DRIVER)
Fabien Dessenne <[email protected]> (supporter:BDISP ST MEDIA DRIVER)
Joe Tessler <[email protected]> (maintainer:CHRONTEL CH7322 CEC DRIVER)
Yong Deng <[email protected]> (maintainer:CSI DRIVERS FOR ALLWINNER V3s)
Andy Walls <[email protected]> (maintainer:CX18 VIDEO4LINUX DRIVER)
Jernej Skrabec <[email protected]> (maintainer:DEINTERLACE DRIVERS FOR ALLWINNER H3)
Hugues Fruchet <[email protected]> (supporter:DELTA ST MEDIA DRIVER)
Sakari Ailus <[email protected]> (maintainer:DONGWOON DW9714 LENS VOICE COIL DRIVER)
Dongchun Zhu <[email protected]> (maintainer:DONGWOON DW9768 LENS VOICE COIL DRIVER)
Alexey Klimov <[email protected]> (maintainer:DSBR100 USB FM RADIO DRIVER)
Michael Krufky <[email protected]> (maintainer:DVB_USB_CXUSB MEDIA DRIVER)
Charles-Antoine Couret <[email protected]> (maintainer:GS1662 VIDEO SERIALIZER)
Frank Zago <[email protected]> (maintainer:GSPCA FINEPIX SUBDRIVER)
Olivier Lorin <[email protected]> (maintainer:GSPCA GL860 SUBDRIVER)
Erik Andren <[email protected]> (maintainer:GSPCA M5602 SUBDRIVER)
Brian Johnson <[email protected]> (maintainer:GSPCA SN9C20X SUBDRIVER)
Leandro Costantino <[email protected]> (maintainer:GSPCA T613 SUBDRIVER)
Jean-Christophe Trotin <[email protected]> (supporter:HVA ST MEDIA DRIVER)
Shawn Tu <[email protected]> (maintainer:HYNIX HI556 SENSOR DRIVER)
Yong Zhi <[email protected]> (maintainer:INTEL IPU3 CSI-2 CIO2 DRIVER)
Bingbu Cao <[email protected]> (maintainer:INTEL IPU3 CSI-2 CIO2 DRIVER)
Dan Scally <[email protected]> (maintainer:INTEL IPU3 CSI-2 CIO2 DRIVER)
Ramesh Shanmugasundaram <[email protected]> (maintainer:MAX2175 SDR TUNER DRIVER)
Laurent Pinchart <[email protected]> (supporter:MEDIA CONTROLLER FRAMEWORK)
Philipp Zabel <[email protected]> (maintainer:MEDIA DRIVER FOR FREESCALE IMX PXP)
Sergey Kozlov <[email protected]> (supporter:MEDIA DRIVERS FOR ASCOT2E)
Abylay Ospan <[email protected]> (supporter:MEDIA DRIVERS FOR ASCOT2E)
Jasmin Jessich <[email protected]> (maintainer:MEDIA DRIVERS FOR CXD2099AR CI CONTROLLERS)
Yasunari Takiguchi <[email protected]> (supporter:MEDIA DRIVERS FOR CXD2880)
Steve Longerbeam <[email protected]> (maintainer:MEDIA DRIVERS FOR FREESCALE IMX)
Rui Miguel Silva <[email protected]> (maintainer:MEDIA DRIVERS FOR FREESCALE IMX7)
Dmitry Osipenko <[email protected]> (maintainer:MEDIA DRIVERS FOR NVIDIA TEGRA - VDE)
[email protected] (maintainer:MEDIA DRIVERS FOR NVIDIA TEGRA - VDE)
Jacopo Mondi <[email protected]> (supporter:MEDIA DRIVERS FOR RENESAS - CEU)
[email protected] (supporter:MEDIA DRIVERS FOR RENESAS - CEU)
Fabrizio Castro <[email protected]> (supporter:MEDIA DRIVERS FOR RENESAS - DRIF)
Kieran Bingham <[email protected]> (supporter:MEDIA DRIVERS FOR RENESAS - FDP1)
"Niklas Söderlund" <[email protected]> (supporter:MEDIA DRIVERS FOR RENESAS - VIN)
Neil Armstrong <[email protected]> (supporter:MESON AO CEC DRIVER FOR AMLOGIC SOCS)
[email protected] (supporter:MESON AO CEC DRIVER FOR AMLOGIC SOCS)
Jimmy Su <[email protected]> (maintainer:OMNIVISION OV08D10 SENSOR DRIVER)
Arec Kao <[email protected]> (maintainer:OMNIVISION OV13B10 SENSOR DRIVER)
Shunqian Zheng <[email protected]> (maintainer:OMNIVISION OV2685 SENSOR DRIVER)
Dave Stevenson <[email protected]> (maintainer:OMNIVISION OV5647 SENSOR DRIVER)
Chiranjeevi Rapolu <[email protected]> (maintainer:OMNIVISION OV5670 SENSOR DRIVER)
Wenyou Yang <[email protected]> (maintainer:OMNIVISION OV7740 SENSOR DRIVER)
"Paul J. Murphy" <[email protected]> (maintainer:OMNIVISION OV9282 SENSOR DRIVER)
Daniele Alessandrelli <[email protected]> (maintainer:OMNIVISION OV9282 SENSOR DRIVER)
Mike Isely <[email protected]> (maintainer:PVRUSB2 VIDEO4LINUX DRIVER)
[email protected] (maintainer:PVRUSB2 VIDEO4LINUX DRIVER)
Stanimir Varbanov <[email protected]> (maintainer:QUALCOMM VENUS VIDEO ACCELERATOR DRIVER)
[email protected] (maintainer:QUALCOMM VENUS VIDEO ACCELERATOR DRIVER)
Sean Young <[email protected]> (maintainer:RC-CORE / LIRC FRAMEWORK)
Eduardo Valentin <[email protected]> (odd fixer:SI4713 FM RADIO TRANSMITTER I2C DRIVER)
Ricardo Ribalda <[email protected]> (maintainer:SONY IMX214 SENSOR DRIVER)
Leon Luo <[email protected]> (maintainer:SONY IMX274 SENSOR DRIVER)
Manivannan Sadhasivam <[email protected]> (maintainer:SONY IMX290 SENSOR DRIVER)
Benjamin Mugnier <[email protected]> (maintainer:ST MIPID02 CSI-2 TO PARALLEL BRIDGE DRIVER)
Sylvain Petinot <[email protected]> (maintainer:ST MIPID02 CSI-2 TO PARALLEL BRIDGE DRIVER)
Ezequiel Garcia <[email protected]> (maintainer:STK1160 USB VIDEO CAPTURE DRIVER)
Olli Salonen <[email protected]> (maintainer:TDA18250 MEDIA DRIVER)
Antoine Jacquet <[email protected]> (maintainer:USB ZR364XX DRIVER)
[email protected] (maintainer:USB ZR364XX DRIVER)
Shuah Khan <[email protected]> (maintainer:VIMC VIRTUAL MEDIA CONTROLLER DRIVER)
"Daniel W. S. Almeida" <[email protected]> (maintainer:VIDTV VIRTUAL DIGITAL TV DRIVER)
Hyun Kwon <[email protected]> (supporter:XILINX VIDEO IP CORES)

And I don't know how this is an improvement as the --for-tree argument seems _very_ likely to be typoed.

scripts/get_maintainer.pl

Quoted 1 line
scripts/get_maintainer.pl +0 -0

[]

Quoted 59 lines
scripts/get_maintainer.pl +25 -2
@@ -23,6 +23,7 @@ use File::Spec::Functions;
 
 my $cur_path = fastgetcwd() . '/';
 my $lk_path = "./";
+my $for_tree = undef;
 my $email = 1;
 my $email_usename = 1;
 my $email_maintainer = 1;
@@ -239,6 +240,7 @@ if ($#ARGV > 0) {
 
 if (!GetOptions(
 		'email!' => \$email,
+		'for-tree=s' => \$for_tree,
 		'git!' => \$email_git,
 		'git-all-signature-types!' => \$email_git_all_signature_types,
 		'git-blame!' => \$email_git_blame,
@@ -300,7 +302,7 @@ if (defined $self_test) {
     exit 0;
 }
 
-if (-t STDIN && !@ARGV) {
+if (-t STDIN && !@ARGV && !$for_tree) {
     # We're talking to a terminal, but have no command line arguments.
     die "$P: missing patchfile or -f file - use --help if necessary\n";
 }
@@ -527,7 +529,7 @@ sub read_mailmap {
 
 ## use the filenames on the command line or find the filenames in the patchfiles
 
-if (!@ARGV) {
+if (!@ARGV && !$for_tree) {
     push(@ARGV, "&STDIN");
 }
 
@@ -951,6 +953,47 @@ sub get_maintainers {
 	}
     }
 
+    if ($for_tree) {
+        my $tvi = find_first_section();
+        while ($tvi < @typevalue) {
+            my $start = find_starting_index($tvi);
+            my $end = find_ending_index($tvi);
+            $tvi = $end + 1;
+
+            my $i;
+            my $tree_match = 0;
+            for ($i = $start; $i < $end; $i++) {
+                my $line = $typevalue[$i];
+                if ($line =~ m/^([A-Z]):(.*)/) {
+                    my $type = $1;
+                    my $value = $2;
+
+                    if ($type eq 'T') {
+                        if ($for_tree eq $value || "git $for_tree" eq $value) {
+                            $tree_match = 1
+                        }
+                    }
+                }

scripts/get_maintainer.pl sub get_maintainers { · line 986

Quoted 10 lines
scripts/get_maintainer.pl +10 -0
+            }
+
+            if ($tree_match) {
+                for ($i = $start; $i < $end; $i++) {
+                    my $line = $typevalue[$i];
+                    if ($line =~ m/^([A-Z]):(.*)/) {
+                        my $type = $1;
+                        my $value = $2;
+
+                        if ($type eq 'M' || $type eq 'L') {

And what about reviewers? 'R' ?

scripts/get_maintainer.pl sub get_maintainers { · line 987

Quoted 1 line
scripts/get_maintainer.pl +1 -0
+                            my $role = get_maintainer_role($i);

Also this improperly marks mailing lists as "maintainer:<SECTION>" rather than "mailing list:<SECTION>" as it uses the S: value for the section rather than the actual role of the person.

Quoted 20 lines
scripts/get_maintainer.pl +10 -0
+                            push_email_address($value, $role)
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
     foreach my $email (@email_to, @list_to) {
 	$email->[0] = deduplicate_email($email->[0]);
     }
@@ -1074,6 +1117,7 @@ Output type options:
   --multiline => print 1 entry per line
 
 Other options:
+  --for-tree => Get maintainers for the given tree
   --pattern-depth => Number of pattern directory traversals (default: 0 (all))
   --keywords => scan patch for keywords (default: $keywords)
   --sections => print all of the subsystem sections with pattern matches
#2 lore raw
Quoted 12 lines · On Thu, 13 Oct 2022 17:39:53 PDT (-0700), [email protected] wrote:
Quoted 11 lines · Palmer Dabbelt

I recently wanted to look up the maintainers for each tree path via a script, and I couldn't find a better way to do that than poking get_maintainer.pl to add a new argument. This lets folks run something like

    $ ./scripts/get_maintainer.pl --for-tree git://github.com/kvm-riscv/linux.git
    Anup Patel <[email protected]> (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
Quoted 3 lines
Quoted 1 line

to find out who owns a tree.

I'm not sure this is useful.

Seems reasonable, I'm also not sure anyone would want to do this again.
I had a pretty specific use case for this, where I wanted to poke folks who still had git://github.com URLs in MAINTAINERS to move them to https://github.com URLs. I'm not sure anyone would every want to do that sort of thing again, so no big deal on my end if this is just a NAK.

Quoted 1 line

It seems far simpler to grep the MAINTAINERS file for the repository.

That's what I tried first, but I didn't have any luck getting reliable results. It's fine if you want to handle one at a time, but not if you're trying to script something -- though maybe making it easy to script this sort if thing is a bad idea, as it's somewhat likely to blast too many people?

Quoted 14 lines

And:

$ git grep "^T:" MAINTAINERS | sort | uniq -c | sort -rn | head -10
    153 MAINTAINERS:T:	git git://linuxtv.org/media_tree.git
     70 MAINTAINERS:T:	git git://anongit.freedesktop.org/drm/drm-misc
     33 MAINTAINERS:T:	git git://linuxtv.org/anttip/media_tree.git
      9 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
      6 MAINTAINERS:T:	git git://linuxtv.org/mkrufky/tuners.git
      6 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
      6 MAINTAINERS:T:	git git://github.com/broadcom/stblinux.git
      5 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
      5 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
      5 MAINTAINERS:T:	git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
Quoted 2 lines

I think I would not like to see the output for git repositories with 153 matches. (or even 5 matches)

The stblinux repo's URL is dead, I sent mail to all 5 of them. Maybe that's overkill, but it seemed reasonable to me at the time...

Quoted 66 lines

For instance: (I've more comments below this too)

$ ./scripts/get_maintainer.pl --for-tree=git://linuxtv.org/media_tree.git
Hans Verkuil <[email protected]> (maintainer:AIMSLAB FM RADIO RECEIVER DRIVER)
[email protected] (maintainer:AIMSLAB FM RADIO RECEIVER DRIVER)
Maxime Ripard <[email protected]> (maintainer:ALLWINNER A10 CSI DRIVER)
Paul Kocialkowski <[email protected]> (maintainer:ALLWINNER A31 MIPI CSI-2 BRIDGE DRIVER)
Tianshu Qiu <[email protected]> (maintainer:ASAHI KASEI AK7375 LENS VOICE COIL DRIVER)
Mauro Carvalho Chehab <[email protected]> (maintainer:AZ6007 DVB DRIVER)
Fabien Dessenne <[email protected]> (supporter:BDISP ST MEDIA DRIVER)
Joe Tessler <[email protected]> (maintainer:CHRONTEL CH7322 CEC DRIVER)
Yong Deng <[email protected]> (maintainer:CSI DRIVERS FOR ALLWINNER V3s)
Andy Walls <[email protected]> (maintainer:CX18 VIDEO4LINUX DRIVER)
Jernej Skrabec <[email protected]> (maintainer:DEINTERLACE DRIVERS FOR ALLWINNER H3)
Hugues Fruchet <[email protected]> (supporter:DELTA ST MEDIA DRIVER)
Sakari Ailus <[email protected]> (maintainer:DONGWOON DW9714 LENS VOICE COIL DRIVER)
Dongchun Zhu <[email protected]> (maintainer:DONGWOON DW9768 LENS VOICE COIL DRIVER)
Alexey Klimov <[email protected]> (maintainer:DSBR100 USB FM RADIO DRIVER)
Michael Krufky <[email protected]> (maintainer:DVB_USB_CXUSB MEDIA DRIVER)
Charles-Antoine Couret <[email protected]> (maintainer:GS1662 VIDEO SERIALIZER)
Frank Zago <[email protected]> (maintainer:GSPCA FINEPIX SUBDRIVER)
Olivier Lorin <[email protected]> (maintainer:GSPCA GL860 SUBDRIVER)
Erik Andren <[email protected]> (maintainer:GSPCA M5602 SUBDRIVER)
Brian Johnson <[email protected]> (maintainer:GSPCA SN9C20X SUBDRIVER)
Leandro Costantino <[email protected]> (maintainer:GSPCA T613 SUBDRIVER)
Jean-Christophe Trotin <[email protected]> (supporter:HVA ST MEDIA DRIVER)
Shawn Tu <[email protected]> (maintainer:HYNIX HI556 SENSOR DRIVER)
Yong Zhi <[email protected]> (maintainer:INTEL IPU3 CSI-2 CIO2 DRIVER)
Bingbu Cao <[email protected]> (maintainer:INTEL IPU3 CSI-2 CIO2 DRIVER)
Dan Scally <[email protected]> (maintainer:INTEL IPU3 CSI-2 CIO2 DRIVER)
Ramesh Shanmugasundaram <[email protected]> (maintainer:MAX2175 SDR TUNER DRIVER)
Laurent Pinchart <[email protected]> (supporter:MEDIA CONTROLLER FRAMEWORK)
Philipp Zabel <[email protected]> (maintainer:MEDIA DRIVER FOR FREESCALE IMX PXP)
Sergey Kozlov <[email protected]> (supporter:MEDIA DRIVERS FOR ASCOT2E)
Abylay Ospan <[email protected]> (supporter:MEDIA DRIVERS FOR ASCOT2E)
Jasmin Jessich <[email protected]> (maintainer:MEDIA DRIVERS FOR CXD2099AR CI CONTROLLERS)
Yasunari Takiguchi <[email protected]> (supporter:MEDIA DRIVERS FOR CXD2880)
Steve Longerbeam <[email protected]> (maintainer:MEDIA DRIVERS FOR FREESCALE IMX)
Rui Miguel Silva <[email protected]> (maintainer:MEDIA DRIVERS FOR FREESCALE IMX7)
Dmitry Osipenko <[email protected]> (maintainer:MEDIA DRIVERS FOR NVIDIA TEGRA - VDE)
[email protected] (maintainer:MEDIA DRIVERS FOR NVIDIA TEGRA - VDE)
Jacopo Mondi <[email protected]> (supporter:MEDIA DRIVERS FOR RENESAS - CEU)
[email protected] (supporter:MEDIA DRIVERS FOR RENESAS - CEU)
Fabrizio Castro <[email protected]> (supporter:MEDIA DRIVERS FOR RENESAS - DRIF)
Kieran Bingham <[email protected]> (supporter:MEDIA DRIVERS FOR RENESAS - FDP1)
"Niklas Söderlund" <[email protected]> (supporter:MEDIA DRIVERS FOR RENESAS - VIN)
Neil Armstrong <[email protected]> (supporter:MESON AO CEC DRIVER FOR AMLOGIC SOCS)
[email protected] (supporter:MESON AO CEC DRIVER FOR AMLOGIC SOCS)
Jimmy Su <[email protected]> (maintainer:OMNIVISION OV08D10 SENSOR DRIVER)
Arec Kao <[email protected]> (maintainer:OMNIVISION OV13B10 SENSOR DRIVER)
Shunqian Zheng <[email protected]> (maintainer:OMNIVISION OV2685 SENSOR DRIVER)
Dave Stevenson <[email protected]> (maintainer:OMNIVISION OV5647 SENSOR DRIVER)
Chiranjeevi Rapolu <[email protected]> (maintainer:OMNIVISION OV5670 SENSOR DRIVER)
Wenyou Yang <[email protected]> (maintainer:OMNIVISION OV7740 SENSOR DRIVER)
"Paul J. Murphy" <[email protected]> (maintainer:OMNIVISION OV9282 SENSOR DRIVER)
Daniele Alessandrelli <[email protected]> (maintainer:OMNIVISION OV9282 SENSOR DRIVER)
Mike Isely <[email protected]> (maintainer:PVRUSB2 VIDEO4LINUX DRIVER)
[email protected] (maintainer:PVRUSB2 VIDEO4LINUX DRIVER)
Stanimir Varbanov <[email protected]> (maintainer:QUALCOMM VENUS VIDEO ACCELERATOR DRIVER)
[email protected] (maintainer:QUALCOMM VENUS VIDEO ACCELERATOR DRIVER)
Sean Young <[email protected]> (maintainer:RC-CORE / LIRC FRAMEWORK)
Eduardo Valentin <[email protected]> (odd fixer:SI4713 FM RADIO TRANSMITTER I2C DRIVER)
Ricardo Ribalda <[email protected]> (maintainer:SONY IMX214 SENSOR DRIVER)
Leon Luo <[email protected]> (maintainer:SONY IMX274 SENSOR DRIVER)
Manivannan Sadhasivam <[email protected]> (maintainer:SONY IMX290 SENSOR DRIVER)
Benjamin Mugnier <[email protected]> (maintainer:ST MIPID02 CSI-2 TO PARALLEL BRIDGE DRIVER)
Quoted 8 lines
Sylvain Petinot <[email protected]> (maintainer:ST MIPID02 CSI-2 TO PARALLEL BRIDGE DRIVER)
Ezequiel Garcia <[email protected]> (maintainer:STK1160 USB VIDEO CAPTURE DRIVER)
Olli Salonen <[email protected]> (maintainer:TDA18250 MEDIA DRIVER)
Antoine Jacquet <[email protected]> (maintainer:USB ZR364XX DRIVER)
[email protected] (maintainer:USB ZR364XX DRIVER)
Shuah Khan <[email protected]> (maintainer:VIMC VIRTUAL MEDIA CONTROLLER DRIVER)
"Daniel W. S. Almeida" <[email protected]> (maintainer:VIDTV VIRTUAL DIGITAL TV DRIVER)
Hyun Kwon <[email protected]> (supporter:XILINX VIDEO IP CORES)

That certainly seems pretty worthless as a To list, but I guess in that case user get what they asked for? For something like "your repo's URL is dead" it seems generally reasonable to just poke everyone involved, though blasting 153 people would still be a bad idea. I always assume that get_maintainers.pl might produce too many people and take a look before sending a big email, but if this makes it too easy to just send something wacky then I'm fine just tossing it.

Either way, I certainly hope to never have to use this again so no big deal on my end ;)

Quoted 77 lines

And I don't know how this is an improvement as the --for-tree argument seems _very_ likely to be typoed.

scripts/get_maintainer.pl

Quoted 1 line
scripts/get_maintainer.pl +0 -0

[]

Quoted 59 lines
scripts/get_maintainer.pl +25 -2
@@ -23,6 +23,7 @@ use File::Spec::Functions;
 
 my $cur_path = fastgetcwd() . '/';
 my $lk_path = "./";
+my $for_tree = undef;
 my $email = 1;
 my $email_usename = 1;
 my $email_maintainer = 1;
@@ -239,6 +240,7 @@ if ($#ARGV > 0) {
 
 if (!GetOptions(
 		'email!' => \$email,
+		'for-tree=s' => \$for_tree,
 		'git!' => \$email_git,
 		'git-all-signature-types!' => \$email_git_all_signature_types,
 		'git-blame!' => \$email_git_blame,
@@ -300,7 +302,7 @@ if (defined $self_test) {
     exit 0;
 }
 
-if (-t STDIN && !@ARGV) {
+if (-t STDIN && !@ARGV && !$for_tree) {
     # We're talking to a terminal, but have no command line arguments.
     die "$P: missing patchfile or -f file - use --help if necessary\n";
 }
@@ -527,7 +529,7 @@ sub read_mailmap {
 
 ## use the filenames on the command line or find the filenames in the patchfiles
 
-if (!@ARGV) {
+if (!@ARGV && !$for_tree) {
     push(@ARGV, "&STDIN");
 }
 
@@ -951,6 +953,47 @@ sub get_maintainers {
 	}
     }
 
+    if ($for_tree) {
+        my $tvi = find_first_section();
+        while ($tvi < @typevalue) {
+            my $start = find_starting_index($tvi);
+            my $end = find_ending_index($tvi);
+            $tvi = $end + 1;
+
+            my $i;
+            my $tree_match = 0;
+            for ($i = $start; $i < $end; $i++) {
+                my $line = $typevalue[$i];
+                if ($line =~ m/^([A-Z]):(.*)/) {
+                    my $type = $1;
+                    my $value = $2;
+
+                    if ($type eq 'T') {
+                        if ($for_tree eq $value || "git $for_tree" eq $value) {
+                            $tree_match = 1
+                        }
+                    }
+                }

scripts/get_maintainer.pl sub get_maintainers { · line 986

Quoted 10 lines
scripts/get_maintainer.pl +10 -0
+            }
+
+            if ($tree_match) {
+                for ($i = $start; $i < $end; $i++) {
+                    my $line = $typevalue[$i];
+                    if ($line =~ m/^([A-Z]):(.*)/) {
+                        my $type = $1;
+                        my $value = $2;
+
+                        if ($type eq 'M' || $type eq 'L') {

And what about reviewers? 'R' ?

Quoted 5 lines

scripts/get_maintainer.pl sub get_maintainers { · line 987

Quoted 1 line
scripts/get_maintainer.pl +1 -0
+                            my $role = get_maintainer_role($i);

Also this improperly marks mailing lists as "maintainer:<SECTION>" rather than "mailing list:<SECTION>" as it uses the S: value for the section rather than the actual role of the person.

OK, sorry about those. Happy to fix them, but I know almost nothing about get_maintainers.pl so it'd take a bit. Generally sound like you don't want this one so I'm going to punt on fixing these for now, I don't care all that much about having this merged.

LMK if you want a v2, though.

Quoted 21 lines
Quoted 21 lines
scripts/get_maintainer.pl +10 -0
+                            push_email_address($value, $role)
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
     foreach my $email (@email_to, @list_to) {
 	$email->[0] = deduplicate_email($email->[0]);
     }
@@ -1074,6 +1117,7 @@ Output type options:
   --multiline => print 1 entry per line
 
 Other options:
+  --for-tree => Get maintainers for the given tree
   --pattern-depth => Number of pattern directory traversals (default: 0 (all))
   --keywords => scan patch for keywords (default: $keywords)
   --sections => print all of the subsystem sections with pattern matches
maintainer
#3 lore raw
Quoted 13 lines · Palmer Dabbelt
Quoted 12 lines · On Thu, 13 Oct 2022 17:39:53 PDT (-0700), [email protected] wrote:
Quoted 11 lines · Palmer Dabbelt

I recently wanted to look up the maintainers for each tree path via a script, and I couldn't find a better way to do that than poking get_maintainer.pl to add a new argument. This lets folks run something like

    $ ./scripts/get_maintainer.pl --for-tree git://github.com/kvm-riscv/linux.git
    Anup Patel <[email protected]> (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

to find out who owns a tree.

I'm not sure this is useful.

[]

Quoted 5 lines

Generally sound like you
don't want this one so I'm going to punt on fixing these for now, I don't care all that much about having this merged.

LMK if you want a v2, though.

I think it's not necessary.

Thanks, Joe

#4 lore raw
Quoted 16 lines · On Thu, 13 Oct 2022 20:48:10 PDT (-0700), [email protected] wrote:
Quoted 15 lines · Palmer Dabbelt
Quoted 14 lines · On Thu, 13 Oct 2022 17:39:53 PDT (-0700), [email protected] wrote:
Quoted 12 lines · Palmer Dabbelt

I recently wanted to look up the maintainers for each tree path via a script, and I couldn't find a better way to do that than poking get_maintainer.pl to add a new argument. This lets folks run something like

    $ ./scripts/get_maintainer.pl --for-tree git://github.com/kvm-riscv/linux.git
    Anup Patel <[email protected]> (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))
    [email protected] (maintainer:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv))

to find out who owns a tree.

Quoted 7 lines
Quoted 1 line
Quoted 1 line

I'm not sure this is useful.

[]

Quoted 3 lines

Generally sound like you don't want this one so I'm going to punt on fixing these for now, I don't care all that much about having this merged.

LMK if you want a v2, though.

I think it's not necessary.

Works for me.