diff options
author | David Golden <dagolden@cpan.org> | 2009-10-20 23:25:40 -0400 |
---|---|---|
committer | David Golden <dagolden@cpan.org> | 2009-10-20 23:44:22 -0400 |
commit | a762e0540fbc9804c533c635cdd3dda69e1e7a5c (patch) | |
tree | 52128da82d18dd0f753ae67e6dcd15aeb17e7472 /Porting/corelist.pl | |
parent | c77945c3ac1accefe435a4ba5074a4f9257b4bf9 (diff) | |
download | perl-a762e0540fbc9804c533c635cdd3dda69e1e7a5c.tar.gz |
Auto-generate deprecation list via corelist.pl
Diffstat (limited to 'Porting/corelist.pl')
-rw-r--r-- | Porting/corelist.pl | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Porting/corelist.pl b/Porting/corelist.pl index 5e4e5b139a..87d61e6ca9 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}; |