Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix core-cpan-diff and sync-with-cpan to handle dist files with v pre…
…fixed versions

Allow a v prefix on versions expected by the core-cpan-diff and
sync-with-cpan scripts. Also align the two scripts with each other, and
handle the same file extensions expected by PAUSE.
  • Loading branch information
haarg authored and jkeenan committed Mar 26, 2024
1 parent 274d22b commit 1c90da2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 2 additions & 3 deletions Porting/core-cpan-diff 100644 → 100755
Expand Up @@ -435,9 +435,8 @@ sub relatively_mapped {

sub distro_base {
my $d = shift;
$d =~ s/\.tar\.gz$//;
$d =~ s/\.gip$//;
$d =~ s/[\d\-_\.]+$//;
my $tail_pat = qr/\.(?:tar\.(?:g?z|bz2|Z)|zip|tgz|tbz)/;
$d =~ s{-v?([0-9._]+(?:-TRIAL[0-9]*)?)$tail_pat\z}{};
return $d;
}

Expand Down
1 change: 1 addition & 0 deletions Porting/exec-bit.txt
Expand Up @@ -51,6 +51,7 @@ Porting/checkcfgvar.pl
Porting/checkpodencoding.pl
Porting/cmpVERSION.pl
Porting/config_h.pl
Porting/core-cpan-diff
Porting/corecpan.pl
Porting/corelist-perldelta.pl
Porting/corelist.pl
Expand Down
9 changes: 5 additions & 4 deletions Porting/sync-with-cpan
Expand Up @@ -410,9 +410,10 @@ chdir "$type_dir";
my $pkg_dir = $files[0];
$pkg_dir =~ s!.*/!!;

my $tail_pat = qr/(?:\.tar\.gz|\.tgz|\.zip)\z/;
my $tail_pat = qr/\.(?:tar\.(?:g?z|bz2|Z)|zip|tgz|tbz)/;
my $version_pat = qr/-v?([0-9._]+(?:-TRIAL[0-9]*)?)$tail_pat\z/;

my ($old_version) = $distribution =~ /-([0-9._]+(?:-TRIAL[0-9]*)?)$tail_pat/;
my ($old_version) = $distribution =~ $version_pat;

if (!$old_version) {
die "WTF: failed to parse old version from '$distribution'\n";
Expand Down Expand Up @@ -457,7 +458,7 @@ if (defined $tarball) {
die "Tarball $tarball does not exist\n" if !-e $tarball;
die "Tarball $tarball is not a plain file\n" if !-f _;
$new_file = $tarball;
$new_version = $version // ($new_file =~ /-([0-9._]+(?:-TRIAL[0-9]*)?)$tail_pat/) [0];
$new_version = $version // ($new_file =~ $version_pat) [0];
die "Blead and that tarball both have version $new_version of $module\n"
if $new_version eq $old_version;
}
Expand Down Expand Up @@ -504,7 +505,7 @@ system git => 'clean', '-dfxq', $pkg_dir;
say "Unpacking $new_file";
Archive::Tar->extract_archive( $new_file );

(my $new_dir = basename($new_file)) =~ s/$tail_pat//;
(my $new_dir = basename($new_file)) =~ s/$tail_pat\z//;
# ensure 'make' will update all files
my $t= time;
for my $file (find_type_f($new_dir)) {
Expand Down

0 comments on commit 1c90da2

Please sign in to comment.