mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts/get_maintainer.pl: Add --sections, print entire matched subsystem
@ 2010-01-13 18:41 Joe Perches
  2010-01-14 23:12 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2010-01-13 18:41 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML

Print the complete contents of the matched subsystem in pattern
match depth order.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/get_maintainer.pl |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 1762e6b..16846ce 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -41,6 +41,7 @@ my $web = 0;
 my $subsystem = 0;
 my $status = 0;
 my $keywords = 1;
+my $sections = 0;
 my $file_emails = 0;
 my $from_filename = 0;
 my $pattern_depth = 0;
@@ -121,6 +122,7 @@ if (!GetOptions(
 		'web!' => \$web,
 		'pattern-depth=i' => \$pattern_depth,
 		'k|keywords!' => \$keywords,
+		'sections!' => \$sections,
 		'fe|file-emails!' => \$file_emails,
 		'f|file' => \$from_filename,
 		'v|version' => \$version,
@@ -152,10 +154,20 @@ if ($output_rolestats) {
     $output_roles = 1;
 }
 
-my $selections = $email + $scm + $status + $subsystem + $web;
-if ($selections == 0) {
-    usage();
-    die "$P:  Missing required option: email, scm, status, subsystem or web\n";
+if ($sections) {
+    $email = 0;
+    $email_list = 0;
+    $scm = 0;
+    $status = 0;
+    $subsystem = 0;
+    $web = 0;
+    $keywords = 0;
+} else {
+    my $selections = $email + $scm + $status + $subsystem + $web;
+    if ($selections == 0) {
+	usage();
+	die "$P:  Missing required option: email, scm, status, subsystem or web\n";
+    }
 }
 
 if ($email &&
@@ -346,6 +358,21 @@ foreach my $file (@files) {
 	}
 	foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
 	    add_categories($line);
+	    if ($sections) {
+		my $i;
+		my $start = find_starting_index($line);
+		my $end = find_ending_index($line);
+		for ($i = $start; $i < $end; $i++) {
+		    my $line = $typevalue[$i];
+		    if ($line =~ /^[FX]:/) {		##Restore file patterns
+			$line =~ s/([^\\])\.([^\*])/$1\?$2/g;
+			$line =~ s/([^\\])\.$/$1\?/g;	##Convert . back to ?
+			$line =~ s/\\\./\./g;       	##Convert \. to .
+			$line =~ s/\.\*/\*/g;       	##Convert .* to *
+		    }
+		    print("$line\n");
+		}
+	    }
 	}
     }
 
@@ -476,6 +503,7 @@ Output type options:
 Other options:
   --pattern-depth => Number of pattern directory traversals (default: 0 (all))
   --keywords => scan patch for keywords (default: 1 (on))
+  --sections => print the entire subsystem sections with pattern matches
   --version => show version
   --help => show this help information
 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] scripts/get_maintainer.pl: Add --sections, print entire matched subsystem
  2010-01-13 18:41 [PATCH] scripts/get_maintainer.pl: Add --sections, print entire matched subsystem Joe Perches
@ 2010-01-14 23:12 ` Andrew Morton
  2010-01-15  1:42   ` [PATCH V2 (changelog update only)] " Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2010-01-14 23:12 UTC (permalink / raw)
  To: Joe Perches; +Cc: LKML

On Wed, 13 Jan 2010 10:41:03 -0800
Joe Perches <joe@perches.com> wrote:

> Print the complete contents of the matched subsystem in pattern
> match depth order.
> 

It would be much easier for us to understand the proposed change if the
changelog contained some example output, please.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH V2 (changelog update only)] scripts/get_maintainer.pl: Add --sections, print entire matched subsystem
  2010-01-14 23:12 ` Andrew Morton
@ 2010-01-15  1:42   ` Joe Perches
  2010-01-15 14:28     ` Stefan Richter
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2010-01-15  1:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML

On Thu, 2010-01-14 at 15:12 -0800, Andrew Morton wrote:
> On Wed, 13 Jan 2010 10:41:03 -0800
> Joe Perches <joe@perches.com> wrote:
> > Print the complete contents of the matched subsystem in pattern
> > match depth order.
> It would be much easier for us to understand the proposed change if the
> changelog contained some example output, please.

Print the complete contents of the matched subsystems
in pattern match depth order.

Sample output:

$ ./scripts/get_maintainer.pl --sections -f drivers/net/usb/smsc95xx.c
USB SMSC95XX ETHERNET DRIVER
M:Steve Glendinning <steve.glendinning@smsc.com>
L:netdev@vger.kernel.org
S:Supported
F:drivers/net/usb/smsc95xx.*
USB SUBSYSTEM
M:Greg Kroah-Hartman <gregkh@suse.de>
L:linux-usb@vger.kernel.org
W:http://www.linux-usb.org
T:quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
S:Supported
F:Documentation/usb/
F:drivers/net/usb/
F:drivers/usb/
F:include/linux/usb.h
F:include/linux/usb/
NETWORKING DRIVERS
L:netdev@vger.kernel.org
W:http://www.linuxfoundation.org/en/Net
T:git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
S:Odd Fixes
F:drivers/net/
F:include/linux/if_*
F:include/linux/*device.h
THE REST
M:Linus Torvalds <torvalds@linux-foundation.org>
L:linux-kernel@vger.kernel.org
Q:http://patchwork.kernel.org/project/LKML/list/
T:git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
S:Buried alive in reporters
F:*
F:*/

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/get_maintainer.pl |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 1762e6b..16846ce 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -41,6 +41,7 @@ my $web = 0;
 my $subsystem = 0;
 my $status = 0;
 my $keywords = 1;
+my $sections = 0;
 my $file_emails = 0;
 my $from_filename = 0;
 my $pattern_depth = 0;
@@ -121,6 +122,7 @@ if (!GetOptions(
 		'web!' => \$web,
 		'pattern-depth=i' => \$pattern_depth,
 		'k|keywords!' => \$keywords,
+		'sections!' => \$sections,
 		'fe|file-emails!' => \$file_emails,
 		'f|file' => \$from_filename,
 		'v|version' => \$version,
@@ -152,10 +154,20 @@ if ($output_rolestats) {
     $output_roles = 1;
 }
 
-my $selections = $email + $scm + $status + $subsystem + $web;
-if ($selections == 0) {
-    usage();
-    die "$P:  Missing required option: email, scm, status, subsystem or web\n";
+if ($sections) {
+    $email = 0;
+    $email_list = 0;
+    $scm = 0;
+    $status = 0;
+    $subsystem = 0;
+    $web = 0;
+    $keywords = 0;
+} else {
+    my $selections = $email + $scm + $status + $subsystem + $web;
+    if ($selections == 0) {
+	usage();
+	die "$P:  Missing required option: email, scm, status, subsystem or web\n";
+    }
 }
 
 if ($email &&
@@ -346,6 +358,21 @@ foreach my $file (@files) {
 	}
 	foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
 	    add_categories($line);
+	    if ($sections) {
+		my $i;
+		my $start = find_starting_index($line);
+		my $end = find_ending_index($line);
+		for ($i = $start; $i < $end; $i++) {
+		    my $line = $typevalue[$i];
+		    if ($line =~ /^[FX]:/) {		##Restore file patterns
+			$line =~ s/([^\\])\.([^\*])/$1\?$2/g;
+			$line =~ s/([^\\])\.$/$1\?/g;	##Convert . back to ?
+			$line =~ s/\\\./\./g;       	##Convert \. to .
+			$line =~ s/\.\*/\*/g;       	##Convert .* to *
+		    }
+		    print("$line\n");
+		}
+	    }
 	}
     }
 
@@ -476,6 +503,7 @@ Output type options:
 Other options:
   --pattern-depth => Number of pattern directory traversals (default: 0 (all))
   --keywords => scan patch for keywords (default: 1 (on))
+  --sections => print the entire subsystem sections with pattern matches
   --version => show version
   --help => show this help information
 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V2 (changelog update only)] scripts/get_maintainer.pl: Add --sections, print entire matched subsystem
  2010-01-15  1:42   ` [PATCH V2 (changelog update only)] " Joe Perches
@ 2010-01-15 14:28     ` Stefan Richter
  2010-01-16  0:43       ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Richter @ 2010-01-15 14:28 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andrew Morton, LKML

Joe Perches wrote:
> Sample output:
> 
> $ ./scripts/get_maintainer.pl --sections -f drivers/net/usb/smsc95xx.c
> USB SMSC95XX ETHERNET DRIVER
> M:Steve Glendinning <steve.glendinning@smsc.com>
> L:netdev@vger.kernel.org
> S:Supported
> F:drivers/net/usb/smsc95xx.*
> USB SUBSYSTEM
> M:Greg Kroah-Hartman <gregkh@suse.de>
> L:linux-usb@vger.kernel.org
> W:http://www.linux-usb.org
> T:quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
[...]

Should it be machine-readable, or only human-readable?
In the latter case, some whitespace could be nice, like:

$ ./scripts/get_maintainer.pl --sections -f drivers/net/usb/smsc95xx.c

USB SMSC95XX ETHERNET DRIVER
    M:Steve Glendinning <steve.glendinning@smsc.com>
    L:netdev@vger.kernel.org
    S:Supported
    F:drivers/net/usb/smsc95xx.*

USB SUBSYSTEM
    M:Greg Kroah-Hartman <gregkh@suse.de>
    L:linux-usb@vger.kernel.org
    W:http://www.linux-usb.org
    T:quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
[...]

For example,

> @@ -346,6 +358,21 @@ foreach my $file (@files) {
>  	}
>  	foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
>  	    add_categories($line);
> +	    if ($sections) {
> +		my $i;
> +		my $start = find_starting_index($line);
> +		my $end = find_ending_index($line);
> +		for ($i = $start; $i < $end; $i++) {
> +		    my $line = $typevalue[$i];
> +		    if ($line =~ /^[FX]:/) {		##Restore file patterns
> +			$line =~ s/([^\\])\.([^\*])/$1\?$2/g;
> +			$line =~ s/([^\\])\.$/$1\?/g;	##Convert . back to ?
> +			$line =~ s/\\\./\./g;       	##Convert \. to .
> +			$line =~ s/\.\*/\*/g;       	##Convert .* to *
> +		    }

		    if ($line =~ /^.:/)
			print("    ");
		    else
			print("\n");

> +		    print("$line\n");
> +		}
> +	    }
>  	}
>      }
>  

-- 
Stefan Richter
-=====-==-=- ---= -====
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V2 (changelog update only)] scripts/get_maintainer.pl: Add --sections, print entire matched subsystem
  2010-01-15 14:28     ` Stefan Richter
@ 2010-01-16  0:43       ` Joe Perches
  2010-01-16  0:57         ` Stefan Richter
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2010-01-16  0:43 UTC (permalink / raw)
  To: Stefan Richter; +Cc: Andrew Morton, LKML

On Fri, 2010-01-15 at 15:28 +0100, Stefan Richter wrote:
> Joe Perches wrote:
> > Sample output:
> > $ ./scripts/get_maintainer.pl --sections -f drivers/net/usb/smsc95xx.c
> > USB SMSC95XX ETHERNET DRIVER
> > M:Steve Glendinning <steve.glendinning@smsc.com>
> > L:netdev@vger.kernel.org
> > S:Supported
> > F:drivers/net/usb/smsc95xx.*
> > USB SUBSYSTEM
> > M:Greg Kroah-Hartman <gregkh@suse.de>
> > L:linux-usb@vger.kernel.org
> > W:http://www.linux-usb.org
> > T:quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
> [...]

> $ ./scripts/get_maintainer.pl --sections -f drivers/net/usb/smsc95xx.c
> USB SMSC95XX ETHERNET DRIVER
>     M:Steve Glendinning <steve.glendinning@smsc.com>
>     L:netdev@vger.kernel.org
>     S:Supported
>     F:drivers/net/usb/smsc95xx.*
> 
> USB SUBSYSTEM
>     M:Greg Kroah-Hartman <gregkh@suse.de>
>     L:linux-usb@vger.kernel.org
>     W:http://www.linux-usb.org
>     T:quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/

The MAINTAINERS file uses tab or space after "^[A-Z]:"
Perhaps that format should be kept.

I don't have a strong preference.

Anyone else?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V2 (changelog update only)] scripts/get_maintainer.pl: Add --sections, print entire matched subsystem
  2010-01-16  0:43       ` Joe Perches
@ 2010-01-16  0:57         ` Stefan Richter
  2010-01-16  1:52           ` [PATCH] scripts/get_maintainer.pl: Change --sections to print in the same style as MAINTAINERS Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Richter @ 2010-01-16  0:57 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andrew Morton, LKML

Joe Perches wrote:
> On Fri, 2010-01-15 at 15:28 +0100, Stefan Richter wrote:
>> USB SMSC95XX ETHERNET DRIVER
>>     M:Steve Glendinning <steve.glendinning@smsc.com>
>>     L:netdev@vger.kernel.org
[...]
> The MAINTAINERS file uses tab or space after "^[A-Z]:"
> Perhaps that format should be kept.

Right, the original format is actually better (if you want to tweak your
output at all).
-- 
Stefan Richter
-=====-==-=- ---= =----
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] scripts/get_maintainer.pl: Change --sections to print in the same style as MAINTAINERS
  2010-01-16  0:57         ` Stefan Richter
@ 2010-01-16  1:52           ` Joe Perches
  0 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2010-01-16  1:52 UTC (permalink / raw)
  To: Stefan Richter; +Cc: Andrew Morton, LKML

On Sat, 2010-01-16 at 01:57 +0100, Stefan Richter wrote:
> > The MAINTAINERS file uses tab or space after "^[A-Z]:"
> > Perhaps that format should be kept.
> Right, the original format is actually better (if you want to tweak your
> output at all).

Signed-off-by: Joe Perches <joe@perches.com>
---
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 4cd2b4c..8461452 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -381,8 +381,10 @@ foreach my $file (@files) {
 		    $line =~ s/\\\./\./g;       	##Convert \. to .
 		    $line =~ s/\.\*/\*/g;       	##Convert .* to *
 		}
+		$line =~ s/^([A-Z]):/$1:\t/g;
 		print("$line\n");
 	    }
+	    print("\n");
 	}
     }
 




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-01-16  1:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-13 18:41 [PATCH] scripts/get_maintainer.pl: Add --sections, print entire matched subsystem Joe Perches
2010-01-14 23:12 ` Andrew Morton
2010-01-15  1:42   ` [PATCH V2 (changelog update only)] " Joe Perches
2010-01-15 14:28     ` Stefan Richter
2010-01-16  0:43       ` Joe Perches
2010-01-16  0:57         ` Stefan Richter
2010-01-16  1:52           ` [PATCH] scripts/get_maintainer.pl: Change --sections to print in the same style as MAINTAINERS Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®