From: David Golden <dagolden@cpan.org>
Date: Wed, 21 Oct 2009 03:25:40 +0000 (-0400)
Subject: Auto-generate deprecation list via corelist.pl
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a762e0540fbc9804c533c635cdd3dda69e1e7a5c;p=p5sagit%2Fp5-mst-13.2.git

Auto-generate deprecation list via corelist.pl
---

diff --git a/Porting/corelist.pl b/Porting/corelist.pl
index 5e4e5b1..87d61e6 100644
--- a/Porting/corelist.pl
+++ b/Porting/corelist.pl
@@ -16,6 +16,7 @@ use lib "Porting";
 use Maintainers qw(%Modules files_to_modules);
 use File::Spec;
 use Parse::CPAN::Meta;
+use IPC::Cmd 'can_run';
 
 my $corelist_file = 'dist/Module-CoreList/lib/Module/CoreList.pm';
 
@@ -47,8 +48,9 @@ if ($cpan) {
         warn "Reading the module list from $modlistfile";
         open $fh, '<', $modlistfile or die "Couldn't open $modlistfile: $!";
     } elsif ( -e $modlistfile . ".gz" ) {
+        my $zcat = can_run('gzcat') || can_run('zcat') or die "Can't find gzcat or zcat";
         warn "Reading the module list from $modlistfile.gz";
-        open $fh, '-|', "gzcat $modlistfile.gz" or die "Couldn't zcat $modlistfile.gz: $!";
+        open $fh, '-|', "$zcat $modlistfile.gz" or die "Couldn't zcat $modlistfile.gz: $!";
     } else {
         warn "About to fetch 02packages from ftp.funet.fi. This may take a few minutes\n";
         $content = fetch_url('http://ftp.funet.fi/pub/CPAN/modules/02packages.details.txt');
@@ -137,11 +139,13 @@ my $file_to_M = files_to_modules( values %module_to_file );
 my %module_to_upstream;
 my %module_to_dist;
 my %dist_to_meta_YAML;
+my %module_to_deprecated;
 while ( my ( $module, $file ) = each %module_to_file ) {
     my $M = $file_to_M->{$file};
     next unless $M;
     next if $Modules{$M}{MAINTAINER} eq 'p5p';
     $module_to_upstream{$module} = $Modules{$M}{UPSTREAM};
+    $module_to_deprecated{$module} = 1 if $Modules{$M}{DEPRECATED};
     next
         if defined $module_to_upstream{$module}
             && $module_to_upstream{$module} =~ /^(?:blead|first-come)$/;
@@ -192,6 +196,15 @@ $upstream_stanza .= ");";
 
 $corelist =~ s/^%upstream .*? ;$/$upstream_stanza/ismx;
 
+# Deprecation generation
+my $deprecated_stanza = "    " . $perl_vnum . " => {\n";
+foreach my $module ( sort keys %module_to_deprecated ) {
+    my $deprecated = defined $module_to_deprecated{$module} ? "'$module_to_deprecated{$module}'" : 'undef';
+    $deprecated_stanza .= sprintf "\t%-24s=> %s,\n", "'$module'", $deprecated;
+}
+$deprecated_stanza .= "    },\n";
+$corelist =~ s/^(%deprecated\s*=\s*.*?)(^\);)$/$1$deprecated_stanza$2/xism;
+
 my $tracker = "%bug_tracker = (\n";
 foreach my $module ( sort keys %module_to_upstream ) {
     my $upstream = defined $module_to_upstream{$module};
diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm
index f5ccf0e..6ddcbbe 100644
--- a/dist/Module-CoreList/lib/Module/CoreList.pm
+++ b/dist/Module-CoreList/lib/Module/CoreList.pm
@@ -10904,6 +10904,21 @@ for my $version ( sort { $a <=> $b } keys %released ) {
     },
 );
 
+%deprecated = (
+    5.011 => {
+	'Class::ISA'            => '1',
+	'Pod::Plainer'          => '1',
+	'Shell'                 => '1',
+	'Switch'                => '1',
+    },
+    5.011001 => {
+	'Class::ISA'            => '1',
+	'Pod::Plainer'          => '1',
+	'Shell'                 => '1',
+	'Switch'                => '1',
+    },
+);
+
 %upstream = (
     'App::Prove'            => undef,
     'App::Prove::State'     => undef,
@@ -11871,5 +11886,7 @@ $version{'5.000'} = $version{5};
 $version{'5.010000'} = $version{5.01};
 $version{'5.011000'} = $version{5.011};
 
+$deprecated{'5.011000'} = $deprecated{5.011};
+
 1;
 __END__