mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	parse-maintainers: Do not sort section content by default
Add an --order switch to control section reordering. Default for --order is off. Change the default ordering to a slightly more sensible: M: Person acting as a maintainer R: Person acting as a patch reviewer L: Mailing list where patches should be sent S: Maintenance status W: URI for general information Q: URI for patchwork tracking B: URI for bug tracking/submission C: URI for chat P: URI or file for subsystem specific coding styles T: SCM tree type and location F: File and directory pattern X: File and directory exclusion pattern N: File glob K: Keyword - patch content regex Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									9420e8ade4
								
							
						
					
					
						commit
						5cdbec108f
					
				
					 1 changed files with 27 additions and 4 deletions
				
			
		| 
						 | 
					@ -8,13 +8,14 @@ my $input_file = "MAINTAINERS";
 | 
				
			||||||
my $output_file = "MAINTAINERS.new";
 | 
					my $output_file = "MAINTAINERS.new";
 | 
				
			||||||
my $output_section = "SECTION.new";
 | 
					my $output_section = "SECTION.new";
 | 
				
			||||||
my $help = 0;
 | 
					my $help = 0;
 | 
				
			||||||
 | 
					my $order = 0;
 | 
				
			||||||
my $P = $0;
 | 
					my $P = $0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (!GetOptions(
 | 
					if (!GetOptions(
 | 
				
			||||||
		'input=s' => \$input_file,
 | 
							'input=s' => \$input_file,
 | 
				
			||||||
		'output=s' => \$output_file,
 | 
							'output=s' => \$output_file,
 | 
				
			||||||
		'section=s' => \$output_section,
 | 
							'section=s' => \$output_section,
 | 
				
			||||||
 | 
							'order!' => \$order,
 | 
				
			||||||
		'h|help|usage' => \$help,
 | 
							'h|help|usage' => \$help,
 | 
				
			||||||
	    )) {
 | 
						    )) {
 | 
				
			||||||
    die "$P: invalid argument - use --help if necessary\n";
 | 
					    die "$P: invalid argument - use --help if necessary\n";
 | 
				
			||||||
| 
						 | 
					@ -32,6 +33,22 @@ usage: $P [options] <pattern matching regexes>
 | 
				
			||||||
  --input => MAINTAINERS file to read (default: MAINTAINERS)
 | 
					  --input => MAINTAINERS file to read (default: MAINTAINERS)
 | 
				
			||||||
  --output => sorted MAINTAINERS file to write (default: MAINTAINERS.new)
 | 
					  --output => sorted MAINTAINERS file to write (default: MAINTAINERS.new)
 | 
				
			||||||
  --section => new sorted MAINTAINERS file to write to (default: SECTION.new)
 | 
					  --section => new sorted MAINTAINERS file to write to (default: SECTION.new)
 | 
				
			||||||
 | 
					  --order => Use the preferred section content output ordering (default: 0)
 | 
				
			||||||
 | 
					    Preferred ordering of section output is:
 | 
				
			||||||
 | 
					      M:  Person acting as a maintainer
 | 
				
			||||||
 | 
					      R:  Person acting as a patch reviewer
 | 
				
			||||||
 | 
					      L:  Mailing list where patches should be sent
 | 
				
			||||||
 | 
					      S:  Maintenance status
 | 
				
			||||||
 | 
					      W:  URI for general information
 | 
				
			||||||
 | 
					      Q:  URI for patchwork tracking
 | 
				
			||||||
 | 
					      B:  URI for bug tracking/submission
 | 
				
			||||||
 | 
					      C:  URI for chat
 | 
				
			||||||
 | 
					      P:  URI or file for subsystem specific coding styles
 | 
				
			||||||
 | 
					      T:  SCM tree type and location
 | 
				
			||||||
 | 
					      F:  File and directory pattern
 | 
				
			||||||
 | 
					      X:  File and directory exclusion pattern
 | 
				
			||||||
 | 
					      N:  File glob
 | 
				
			||||||
 | 
					      K:  Keyword - patch content regex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If <pattern match regexes> exist, then the sections that match the
 | 
					If <pattern match regexes> exist, then the sections that match the
 | 
				
			||||||
regexes are not written to the output file but are written to the
 | 
					regexes are not written to the output file but are written to the
 | 
				
			||||||
| 
						 | 
					@ -56,7 +73,7 @@ sub by_category($$) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sub by_pattern($$) {
 | 
					sub by_pattern($$) {
 | 
				
			||||||
    my ($a, $b) = @_;
 | 
					    my ($a, $b) = @_;
 | 
				
			||||||
    my $preferred_order = 'MRPLSWTQBCFXNK';
 | 
					    my $preferred_order = 'MRLSWQBCPTFXNK';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    my $a1 = uc(substr($a, 0, 1));
 | 
					    my $a1 = uc(substr($a, 0, 1));
 | 
				
			||||||
    my $b1 = uc(substr($b, 0, 1));
 | 
					    my $b1 = uc(substr($b, 0, 1));
 | 
				
			||||||
| 
						 | 
					@ -105,9 +122,15 @@ sub alpha_output {
 | 
				
			||||||
		print $file $separator;
 | 
							print $file $separator;
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
	    print $file $key . "\n";
 | 
						    print $file $key . "\n";
 | 
				
			||||||
 | 
						    if ($order) {
 | 
				
			||||||
		foreach my $pattern (sort by_pattern split('\n', %$hashref{$key})) {
 | 
							foreach my $pattern (sort by_pattern split('\n', %$hashref{$key})) {
 | 
				
			||||||
		    print $file ($pattern . "\n");
 | 
							    print $file ($pattern . "\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						    } else {
 | 
				
			||||||
 | 
							foreach my $pattern (split('\n', %$hashref{$key})) {
 | 
				
			||||||
 | 
							    print $file ($pattern . "\n");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						    }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    close($file);
 | 
					    close($file);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue