summaryrefslogtreecommitdiff
path: root/Porting/cmpVERSION.pl
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2009-07-03 21:31:15 +0100
committerDavid Mitchell <davem@iabyn.com>2009-07-03 21:31:15 +0100
commit2fb8ff88df68d4456db591e74fa6d6cb7c777e3c (patch)
treef3290e4bab5cf73cea922a20a9b889865006eb38 /Porting/cmpVERSION.pl
parentce2c78aa98e3135581858ffdba6f48caebfcb384 (diff)
downloadperl-2fb8ff88df68d4456db591e74fa6d6cb7c777e3c.tar.gz
add -x option to Porting/cmpVERSION.pl
which ignores dual-life modules
Diffstat (limited to 'Porting/cmpVERSION.pl')
-rw-r--r--Porting/cmpVERSION.pl27
1 files changed, 23 insertions, 4 deletions
diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl
index 0f808c87da..9205e28894 100644
--- a/Porting/cmpVERSION.pl
+++ b/Porting/cmpVERSION.pl
@@ -4,7 +4,10 @@
# cmpVERSION - compare two Perl source trees for modules
# that have identical version numbers but different contents.
#
-# withg -d option, output the diffs too
+# with -d option, output the diffs too
+# with -x option, exclude dual-life modules (after all, there are tools
+# like core-cpan-diff that can already deal with them)
+# With this option, one od the directories must be '.'.
#
# Original by slaven@rezic.de, modified by jhi.
#
@@ -17,14 +20,17 @@ use File::Find;
use File::Spec::Functions qw(rel2abs abs2rel catfile catdir curdir);
use Getopt::Std;
+use lib 'Porting';
+use Maintainers;
+
sub usage {
die <<'EOF';
-usage: $0 [ -d ] source_dir1 source_dir2
+usage: $0 [ -d -x ] source_dir1 source_dir2
EOF
}
my %opts;
-getopts('d', \%opts) or usage;
+getopts('dx', \%opts) or usage;
@ARGV == 2 or usage;
for (@ARGV[0, 1]) {
@@ -32,6 +38,18 @@ for (@ARGV[0, 1]) {
unless -f catfile($_, "perl.h") && -d catdir($_, "Porting");
}
+my %dual_files;
+if ($opts{x}) {
+ die "With -x, one of the directories must be '.'\n"
+ unless $ARGV[0] eq '.' or $ARGV[1] eq '.';
+ for my $m (grep $Maintainers::Modules{$_}{CPAN},
+ keys %Maintainers::Modules)
+ {
+
+ $dual_files{"./$_"} = 1 for Maintainers::get_module_files($m);
+ }
+}
+
my $dir2 = rel2abs($ARGV[1]);
chdir $ARGV[0] or die "$0: chdir '$ARGV[0]' failed: $!\n";
@@ -50,7 +68,8 @@ my @diffs;
find(
sub { /\.pm$/ &&
$File::Find::dir !~ $skip_dirs &&
- ! exists $skip{$File::Find::name}
+ ! exists $skip{$File::Find::name} &&
+ ! exists $dual_files{$File::Find::name}
&&
do { my $file2 =
catfile(catdir($dir2, $File::Find::dir), $_);