Skip to content

Commit

Permalink
Add MAIN_MODULE to Porting/Maintainers.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
ap authored and jkeenan committed Aug 6, 2021
1 parent 6a58776 commit 382558a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 9 additions & 0 deletions Porting/Maintainers.pl
Expand Up @@ -70,6 +70,10 @@ package Maintainers;
# upload the corresponding cpan release, and the entry in this file should
# only be updated when that release has been done.)

# MAIN_MODULE names the top-level module by which the tarball is indexed on
# CPAN in cases where this differs from the distribution's key in %Modules.
# (If it is equal then MAIN_MODULE is optional and should be omitted.)

# EXCLUDED is a list of files to be excluded from a CPAN tarball before
# comparing the remaining contents with core. Each item can either be a
# full pathname (eg 't/foo.t') or a pattern (e.g. qr{^t/}).
Expand Down Expand Up @@ -631,6 +635,7 @@ package Maintainers;

'IO-Compress' => {
'DISTRIBUTION' => 'PMQS/IO-Compress-2.102.tar.gz',
'MAIN_MODULE' => 'IO::Compress::Base',
'FILES' => q[cpan/IO-Compress],
'EXCLUDED' => [
qr{^examples/},
Expand Down Expand Up @@ -687,6 +692,7 @@ package Maintainers;

'libnet' => {
'DISTRIBUTION' => 'SHAY/libnet-3.13.tar.gz',
'MAIN_MODULE' => 'Net::Cmd',
'FILES' => q[cpan/libnet],
'EXCLUDED' => [
qw( Configure
Expand Down Expand Up @@ -888,6 +894,7 @@ package Maintainers;

'PathTools' => {
'DISTRIBUTION' => 'XSAWYERX/PathTools-3.75.tar.gz',
'MAIN_MODULE' => 'File::Spec',
'FILES' => q[dist/PathTools],
'EXCLUDED' => [
qr{^t/lib/Test/},
Expand Down Expand Up @@ -966,6 +973,7 @@ package Maintainers;

'podlators' => {
'DISTRIBUTION' => 'RRA/podlators-4.14.tar.gz',
'MAIN_MODULE' => 'Pod::Man',
'FILES' => q[cpan/podlators pod/perlpodstyle.pod],
'EXCLUDED' => [
qr{^docs/metadata/},
Expand Down Expand Up @@ -1123,6 +1131,7 @@ package Maintainers;

'Text-Tabs+Wrap' => {
'DISTRIBUTION' => 'ARISTOTLE/Text-Tabs+Wrap-2021.0804.tar.gz',
'MAIN_MODULE' => 'Text::Tabs',
'FILES' => q[cpan/Text-Tabs],
'EXCLUDED' => [
qr{^xt},
Expand Down
11 changes: 3 additions & 8 deletions Porting/sync-with-cpan
Expand Up @@ -179,7 +179,7 @@ my @problematic = (
sub usage
{
my $err = shift and select STDERR;
print "Usage: $0 module [args] [cpan package]\n";
print "Usage: $0 <module-or-dist> [args]\n";
exit $err;
}

Expand Down Expand Up @@ -269,8 +269,6 @@ EOF
print "Hit return to continue; ^C to abort "; <STDIN>;
}

my $cpan_mod = @ARGV ? shift : $module;

my $distribution = $$info {DISTRIBUTION};

my @files = glob $$info {FILES};
Expand All @@ -293,10 +291,6 @@ my $pkg_dir = $files[0];

my ($old_version) = $distribution =~ /-([0-9.]+(?:-TRIAL[0-9]*)?)\.tar\.gz/;

if ($cpan_mod =~ /-/ && $cpan_mod !~ /::/) {
$cpan_mod =~ s/-/::/g;
}

sub wget {
my ($url, $saveas) = @_;
my $ht_res;
Expand Down Expand Up @@ -347,8 +341,9 @@ else {
wget $package_url, $package_file;
}

my $cpan_mod = $info->{MAIN_MODULE} // $module;
open my $fh, '<', $package_file;
(my $new_line) = grep {/^$cpan_mod/} <$fh> # Yes, this needs a lot of memory
(my $new_line) = grep {/^\Q$cpan_mod\E /} <$fh> # Yes, this needs a lot of memory
or die "Cannot find $cpan_mod on CPAN\n";
(undef, $new_version, my $new_path) = split ' ', $new_line;
if (defined $version) {
Expand Down

0 comments on commit 382558a

Please sign in to comment.