Skip to content

Commit 5cdbec1

Browse files
JoePerchestorvalds
authored andcommitted
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 <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 9420e8a commit 5cdbec1

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

scripts/parse-maintainers.pl

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
my $output_file = "MAINTAINERS.new";
99
my $output_section = "SECTION.new";
1010
my $help = 0;
11-
11+
my $order = 0;
1212
my $P = $0;
1313

1414
if (!GetOptions(
1515
'input=s' => \$input_file,
1616
'output=s' => \$output_file,
1717
'section=s' => \$output_section,
18+
'order!' => \$order,
1819
'h|help|usage' => \$help,
1920
)) {
2021
die "$P: invalid argument - use --help if necessary\n";
@@ -32,6 +33,22 @@ sub usage {
3233
--input => MAINTAINERS file to read (default: MAINTAINERS)
3334
--output => sorted MAINTAINERS file to write (default: MAINTAINERS.new)
3435
--section => new sorted MAINTAINERS file to write to (default: SECTION.new)
36+
--order => Use the preferred section content output ordering (default: 0)
37+
Preferred ordering of section output is:
38+
M: Person acting as a maintainer
39+
R: Person acting as a patch reviewer
40+
L: Mailing list where patches should be sent
41+
S: Maintenance status
42+
W: URI for general information
43+
Q: URI for patchwork tracking
44+
B: URI for bug tracking/submission
45+
C: URI for chat
46+
P: URI or file for subsystem specific coding styles
47+
T: SCM tree type and location
48+
F: File and directory pattern
49+
X: File and directory exclusion pattern
50+
N: File glob
51+
K: Keyword - patch content regex
3552
3653
If <pattern match regexes> exist, then the sections that match the
3754
regexes are not written to the output file but are written to the
@@ -56,7 +73,7 @@ ($$)
5673

5774
sub by_pattern($$) {
5875
my ($a, $b) = @_;
59-
my $preferred_order = 'MRPLSWTQBCFXNK';
76+
my $preferred_order = 'MRLSWQBCPTFXNK';
6077

6178
my $a1 = uc(substr($a, 0, 1));
6279
my $b1 = uc(substr($b, 0, 1));
@@ -105,8 +122,14 @@ sub alpha_output {
105122
print $file $separator;
106123
}
107124
print $file $key . "\n";
108-
foreach my $pattern (sort by_pattern split('\n', %$hashref{$key})) {
109-
print $file ($pattern . "\n");
125+
if ($order) {
126+
foreach my $pattern (sort by_pattern split('\n', %$hashref{$key})) {
127+
print $file ($pattern . "\n");
128+
}
129+
} else {
130+
foreach my $pattern (split('\n', %$hashref{$key})) {
131+
print $file ($pattern . "\n");
132+
}
110133
}
111134
}
112135
}

0 commit comments

Comments
 (0)