parse-maintainers: Move matching sections from MAINTAINERS
authorJoe Perches <joe@perches.com>
Sun, 6 Aug 2017 01:45:49 +0000 (18:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 Aug 2017 18:16:14 +0000 (11:16 -0700)
Allow any number of command line arguments to match either the
section header or the section contents and create new files.

Create MAINTAINERS.new and SECTION.new.

This allows scripting of the movement of various sections from
MAINTAINERS.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/parse-maintainers.pl

index c286154a2b686d26ed7f499bcbd6c3b6c260a7d7..e40b53db7f9fdc7c8e3f7094f8b862d66ef7651f 100644 (file)
@@ -109,8 +109,20 @@ sub file_input {
 }
 
 my %hash;
+my %new_hash;
 
 file_input(\%hash, "MAINTAINERS");
+
+foreach my $type (@ARGV) {
+    foreach my $key (keys %hash) {
+       if ($key =~ /$type/ || $hash{$key} =~ /$type/) {
+           $new_hash{$key} = $hash{$key};
+           delete $hash{$key};
+       }
+    }
+}
+
 alpha_output(\%hash, "MAINTAINERS.new");
+alpha_output(\%new_hash, "SECTION.new");
 
 exit(0);