Commit | Line | Data |
f1c5bace |
1 | #!/usr/bin/perl -w |
2 | |
3 | # |
4 | # cmpVERSION - compare two Perl source trees for modules |
5 | # that have identical version numbers but different contents. |
6 | # |
7 | # Original by slaven@rezic.de, modified by jhi. |
8 | # |
9 | |
10 | use strict; |
11 | |
12 | use ExtUtils::MakeMaker; |
13 | use File::Compare; |
14 | use File::Find; |
15 | use File::Spec::Functions qw(rel2abs abs2rel catfile catdir curdir); |
16 | |
0c429c78 |
17 | @ARGV == 2 or die "usage: $0 source_dir1 source_dir2\n"; |
18 | |
f1c5bace |
19 | for (@ARGV[0, 1]) { |
20 | die "$0: '$_' does not look like Perl directory\n" |
21 | unless -f catfile($_, "perl.h") && -d catdir($_, "Porting"); |
22 | } |
23 | |
24 | my $dir2 = rel2abs($ARGV[1]); |
25 | chdir $ARGV[0] or die "$0: chdir '$ARGV[0]' failed: $!\n"; |
26 | |
88830c88 |
27 | # Files to skip from the check for one reason or another, |
28 | # usually because they pull in their version from some other file. |
29 | my %skip; |
477acd91 |
30 | @skip{ |
31 | './lib/Carp/Heavy.pm', |
8adca191 |
32 | './lib/Exporter/Heavy.pm', |
33 | './win32/FindExt.pm' |
477acd91 |
34 | } = (); |
ae8d64f5 |
35 | my $skip_dirs = qr|^\./t/lib|; |
88830c88 |
36 | |
f1c5bace |
37 | my @wanted; |
38 | find( |
39 | sub { /\.pm$/ && |
ae8d64f5 |
40 | $File::Find::dir !~ $skip_dirs && |
88830c88 |
41 | ! exists $skip{$File::Find::name} |
42 | && |
f1c5bace |
43 | do { my $file2 = |
44 | catfile(catdir($dir2, $File::Find::dir), $_); |
780d3752 |
45 | (my $xs_file1 = $_) =~ s/\.pm$/.xs/; |
46 | (my $xs_file2 = $file2) =~ s/\.pm$/.xs/; |
47 | if (-e $xs_file1 && -e $xs_file2) { |
48 | return if compare($_, $file2) == 0 && |
49 | compare($xs_file1, $xs_file2) == 0; |
50 | } else { |
51 | return if compare($_, $file2) == 0; |
52 | } |
f1c5bace |
53 | my $version1 = eval {MM->parse_version($_)}; |
54 | my $version2 = eval {MM->parse_version($file2)}; |
55 | push @wanted, $File::Find::name |
0ac6c0fd |
56 | if defined $version1 && |
57 | defined $version2 && |
58 | $version1 eq $version2 |
f1c5bace |
59 | } }, curdir); |
60 | print map { $_, "\n" } sort @wanted; |
61 | |