summaryrefslogtreecommitdiff
path: root/Porting
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-03-02 13:04:10 +0100
committerYves Orton <demerphq@gmail.com>2023-03-02 22:23:02 +0800
commitaeac6656432abc7c867314cb1ce8319321d6cdef (patch)
tree446f71b7f19b026530f18770c1aab7dd7e3fe532 /Porting
parent9f3d08cd5c12c8828f3c240327b861f6a4ff5747 (diff)
downloadperl-aeac6656432abc7c867314cb1ce8319321d6cdef.tar.gz
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.
Diffstat (limited to 'Porting')
-rwxr-xr-xPorting/sync-with-cpan12
1 files changed, 9 insertions, 3 deletions
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)) {