This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bump version to 5.17.4
[perl5.git] / Porting / core-cpan-diff
index 5ccf740..54110d8 100644 (file)
@@ -45,7 +45,6 @@ use constant SRC_DIR => 'tarballs';
 use constant UNTAR_DIR => 'untarred';
 
 use constant DIFF_CMD => 'diff';
-use constant WGET_CMD => 'wget';
 
 sub usage {
     print STDERR "\n@_\n\n" if @_;
@@ -59,7 +58,6 @@ Usage: $0 [opts] [ -d | -v | -x ] [ -a | module ... ]
 
 -d/--diff     Display file differences using diff(1), rather than just
               listing which files have changed.
-              The diff(1) command is assumed to be in your PATH.
 
 --diffopts    Options to pass to the diff command. Defaults to '-u'.
 
@@ -88,6 +86,10 @@ those in the perl source tree.
 
 Must be run from the root of the perl source tree.
 Module names must match the keys of %Modules in Maintainers.pl.
+
+The diff(1) command is assumed to be in your PATH and is used to diff files
+regardless of whether the --diff option has been chosen to display any file
+differences.
 HERE
     exit(1);
 }
@@ -120,6 +122,8 @@ sub run {
         '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;
@@ -240,13 +244,13 @@ sub do_compare {
             warn "WARNING: duplicate entry for $dist in $module\n";
         }
 
-        my $upstream = $m->{UPSTREAM} || 'UNKNOWN';
+        my $upstream = $m->{UPSTREAM};
         next if @$wanted_upstreams and !( $upstream ~~ $wanted_upstreams );
 
         print $outfh "\n$module - "
           . $Maintainers::Modules{$module}->{DISTRIBUTION} . "\n";
         print $outfh "  upstream is: "
-          . ( $m->{UPSTREAM} || 'UNKNOWN!' ) . "\n";
+          . ( $m->{UPSTREAM} // 'UNKNOWN!' ) . "\n";
 
         my $cpan_dir;
         eval {
@@ -488,7 +492,7 @@ sub do_crosscheck {
         my $pdist = $m->{DISTRIBUTION};
         die "ERROR: $module has no DISTRIBUTION entry\n" unless defined $pdist;
 
-        my $upstream = $m->{UPSTREAM} || 'UNKNOWN';
+        my $upstream = $m->{UPSTREAM};
         next if @$wanted_upstreams and !( $upstream ~~ $wanted_upstreams );
 
         my $cdist = $modules{$module};
@@ -634,7 +638,7 @@ sub get_distribution {
 
     if ( -f $download_file and !-s $download_file ) {
 
-        # wget can leave a zero-length file on failed download
+        # failed download might leave a zero-length file
         unlink $download_file;
     }
 
@@ -651,6 +655,7 @@ sub get_distribution {
     my $path = catfile( $untar_dir, $filename );
 
     $path =~ s/\.tar\.gz$//
+      or $path =~ s/\.tgz$//
       or $path =~ s/\.zip$//
       or die
       "ERROR: downloaded file does not have a recognised suffix: $path\n";