From aeac6656432abc7c867314cb1ce8319321d6cdef Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Thu, 2 Mar 2023 13:04:10 +0100 Subject: Fixup for sync-with-cpan - deal with .tgz files We were only handling '.tar.gz' files, but Config::Perl::V uses '.tgz' so when we ran the sync script got very confused and deleted everything and then tried to add the raw archive. --- Porting/sync-with-cpan | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Porting') diff --git a/Porting/sync-with-cpan b/Porting/sync-with-cpan index 37641065d1..b79942e3f0 100755 --- a/Porting/sync-with-cpan +++ b/Porting/sync-with-cpan @@ -289,7 +289,13 @@ chdir "cpan"; my $pkg_dir = $files[0]; $pkg_dir =~ s!.*/!!; -my ($old_version) = $distribution =~ /-([0-9.]+(?:-TRIAL[0-9]*)?)\.tar\.gz/; +my $tail_pat = qr/(?:\.tar\.gz|\.tgz)\z/; + +my ($old_version) = $distribution =~ /-([0-9._]+(?:-TRIAL[0-9]*)?)$tail_pat/; + +if (!$old_version) { + die "WTF: failed to parse old version from '$distribution'\n"; +} sub wget { my ($url, $saveas) = @_; @@ -329,7 +335,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]*)?)\.tar\.gz/) [0]; + $new_version = $version // ($new_file =~ /-([0-9._]+(?:-TRIAL[0-9]*)?)$tail_pat/) [0]; die "Blead and that tarball both have version $new_version of $module\n" if $new_version eq $old_version; } @@ -371,7 +377,7 @@ system git => 'clean', '-dfxq', $pkg_dir; say "Unpacking $new_file"; Archive::Tar->extract_archive( $new_file ); -(my $new_dir = basename($new_file)) =~ s/\.tar\.gz//; +(my $new_dir = basename($new_file)) =~ s/$tail_pat//; # ensure 'make' will update all files my $t= time; for my $file (find_type_f($new_dir)) { -- cgit v1.2.1