1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#!/usr/bin/perl
# This is a helper to inspect gcc-x.y package's patches,
# looking for those applicable to gcc-x.y-doc.
#
# Usage:
# $ cd gcc-x.y/debian/patches
# $ perl $PATH_TO_ME/check_gcc_patches *.diff
use strict;
use warnings;
my $interest =
qr{
\.7$
| \.texi$
| texi2pod\.pl$
| (xgnatugn.adb|ug_words)$
}x;
my %inspect = ();
for my $patch (@ARGV) {
print "Parsing $patch\n";
open my $fh, "-|", qw(diffstat -l), $patch;
while (<$fh>) {
chomp;
if (m/$interest/) {
print "Match: $_\n";
$inspect{$patch} = 1;
}
}
}
print "\n";
print "# Interesting patches:\n";
for my $patch (sort keys %inspect) {
print "# grepping for $patch in rules.patch\n";
my $base = $patch;
$base =~ s/\.diff//;
system "grep", "-n", "-B", "5", "$base", "../rules.patch";
print "\n";
}
print "# you can add notes with this template\n";
for my $patch (sort keys %inspect) {
print "# $patch\n";
}
|