From 1c90da2f774d7d8c9a984e56746a7b6635c5b518 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 25 Mar 2024 19:45:11 +0100 Subject: [PATCH] fix core-cpan-diff and sync-with-cpan to handle dist files with v prefixed 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. --- Porting/core-cpan-diff | 5 ++--- Porting/exec-bit.txt | 1 + Porting/sync-with-cpan | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) mode change 100644 => 100755 Porting/core-cpan-diff diff --git a/Porting/core-cpan-diff b/Porting/core-cpan-diff old mode 100644 new mode 100755 index 74778ed28e6f..50b250ad1427 --- a/Porting/core-cpan-diff +++ b/Porting/core-cpan-diff @@ -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; } diff --git a/Porting/exec-bit.txt b/Porting/exec-bit.txt index 25523e1f2b21..f9abc7d605b3 100644 --- a/Porting/exec-bit.txt +++ b/Porting/exec-bit.txt @@ -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 diff --git a/Porting/sync-with-cpan b/Porting/sync-with-cpan index c965c1427cef..ff5cdfa784eb 100755 --- a/Porting/sync-with-cpan +++ b/Porting/sync-with-cpan @@ -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"; @@ -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; } @@ -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)) {