-d/--diff Display file differences using diff(1), rather than just
listing which files have changed.
---diffopts Options to pass to the diff command. Defaults to '-u'.
+--diffopts Options to pass to the diff command. Defaults to '-u --binary'.
-f|force Force download from CPAN of new 02packages.details.txt file
(with --crosscheck only).
my $mirror_url = "http://www.cpan.org/";
my $use_diff;
my $output_file;
- my $verbose;
+ my $verbose = 0;
my $force;
my $do_crosscheck;
'o|output=s' => \$output_file,
'r|reverse' => \$reverse,
'u|upstream=s@' => \@wanted_upstreams,
- 'v|verbose' => \$verbose,
+ 'v|verbose:1' => \$verbose,
'x|crosscheck' => \$do_crosscheck,
) or usage;
- @wanted_upstreams = map { $_ eq 'undef' ? undef : $_ } @wanted_upstreams;
-
my @modules;
usage("Cannot mix -a with module list") if $scan_all && @ARGV;
if ($do_crosscheck) {
- usage("can't use -r, -d, --diffopts, -v with --crosscheck")
- if ( $reverse || $use_diff || $diff_opts || $verbose );
+ usage("can't use -r, -d, --diffopts with --crosscheck")
+ if ( $reverse || $use_diff || $diff_opts );
}
else {
- $diff_opts = '-u -b' unless defined $diff_opts;
+ $diff_opts = '-u --binary' unless defined $diff_opts;
usage("can't use -f without --crosscheck") if $force;
}
if ($do_crosscheck) {
do_crosscheck(
- $outfh, $cache_dir, $mirror_url,
+ $outfh, $cache_dir, $mirror_url, $verbose,
$force, \@modules, \@wanted_upstreams
);
}
else {
+ $verbose > 2 and $use_diff++;
do_compare(
\@modules, $outfh, $output_file,
$cache_dir, $mirror_url, $verbose,
warn "WARNING: duplicate entry for $dist in $module\n";
}
- my $upstream = $m->{UPSTREAM};
+ my $upstream = $m->{UPSTREAM} // 'undef';
next if @$wanted_upstreams and !$wanted_upstream{$upstream};
print $outfh "\n$module - "
file_diff( $outfh, $abs_cpan_file, $mapped_file, $reverse,
$diff_opts );
if ( $different && customized( $m, $relative_mapped_file ) ) {
- if (! $use_diff ) {
- print $outfh " Customized for blead: $relative_mapped_file\n";
+ print $outfh " Customized for blead: $relative_mapped_file\n";
+ if ( $use_diff && $verbose ) {
+ $different =~ s{^(--- |\+\+\+ )/tmp/[^/]+/}{$1}gm;
+ print $outfh $different;
}
}
elsif ($different) {
print $outfh " Perl only: $_\n" unless $use_diff;
}
}
+ if ( $verbose ) {
+ foreach my $exclude (@$excluded) {
+ my $seen = 0;
+ foreach my $cpan_file (@cpan_files) {
+ # may be a simple string to match exactly, or a pattern
+ if ( ref $exclude ) {
+ $seen = 1 if $cpan_file =~ $exclude;
+ }
+ else {
+ $seen = 1 if $cpan_file eq $exclude;
+ }
+ last if $seen;
+ }
+ if ( not $seen ) {
+ print $outfh " Unnecessary exclusion: $exclude\n";
+ }
+ }
+ }
}
}
sub do_crosscheck {
my (
- $outfh, $cache_dir, $mirror_url,
+ $outfh, $cache_dir, $mirror_url, $verbose,
$force, $modules, $wanted_upstreams,
) = @_;
my $m = $Maintainers::Modules{$module}
or die "ERROR: No such module in Maintainers.pl: '$module'\n";
+ $verbose and warn "Checking $module\n";
+
unless ( $m->{CPAN} ) {
print $outfh "\nWARNING: $module is not dual-life; skipping\n";
next;
my $pdist = $m->{DISTRIBUTION};
die "ERROR: $module has no DISTRIBUTION entry\n" unless defined $pdist;
- my $upstream = $m->{UPSTREAM};
+ my $upstream = $m->{UPSTREAM} // 'undef';
next if @$wanted_upstreams and !$wanted_upstream{$upstream};
my $cdist = $modules{$module};
if ( keys %$d > 1 ) {
print $outfh
"\n$module: (found more than one CPAN candidate):\n";
- print $outfh " perl: $pdist\n";
+ print $outfh " Perl: $pdist\n";
print $outfh " CPAN: $_\n" for sort keys %$d;
next;
}
}
# get the EXCLUDED and MAP entries for this module, or
-# make up defauts if they don't exist
+# make up defaults if they don't exist
sub get_map {
my ( $m, $module_name, $perl_files ) = @_;