summaryrefslogtreecommitdiff
path: root/Porting/cmpVERSION.pl
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-03-22 10:39:30 +0100
committerYves Orton <demerphq@gmail.com>2023-03-29 20:54:49 +0800
commitea35cd23e9d1405ff9dda3484cf2648c5332225e (patch)
tree60242af52c2f631416a74b23b4714b7f9593b469 /Porting/cmpVERSION.pl
parentcb6188df375141f4ec9f33cc918fd640b1ff81b6 (diff)
downloadperl-ea35cd23e9d1405ff9dda3484cf2648c5332225e.tar.gz
Porting/cmpVERSION.pl - deal with old git clients better in tag date parsing
The HPUX box we smoke on does not have a modern git and chokes on taggerdate:unix, so we use taggerdata:iso8601 instead, and then parse the date with Time::Local.
Diffstat (limited to 'Porting/cmpVERSION.pl')
-rwxr-xr-xPorting/cmpVERSION.pl12
1 files changed, 10 insertions, 2 deletions
diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl
index eed4157877..187763b0d4 100755
--- a/Porting/cmpVERSION.pl
+++ b/Porting/cmpVERSION.pl
@@ -19,6 +19,7 @@ use 5.006;
use ExtUtils::MakeMaker;
use File::Spec::Functions qw(devnull);
use Getopt::Long;
+use Time::Local qw(timelocal_posix);
my ($diffs, $exclude_upstream, $tag_to_compare, $tap);
unless (GetOptions('diffs' => \$diffs,
@@ -84,8 +85,15 @@ unless ($tag_exists eq $tag_to_compare) {
my $commit_epoch = `git log -1 --format="%ct"`;
chomp($commit_epoch);
-my $tag_epoch = `git for-each-ref --format="%(taggerdate:unix)" refs/tags/$tag_to_compare`;
-chomp($tag_epoch);
+# old git versions dont support taggerdate:unix. so use :iso8601 and then
+# use timelocal_posix() to convert to an epoch.
+my $tag_date = `git for-each-ref --format="%(taggerdate:iso8601)" refs/tags/$tag_to_compare`;
+chomp($tag_date);
+my $tag_epoch= do {
+ my ($Y,$M,$D,$h,$m,$s) = split /[- :]/, $tag_date; # 2023-03-20 22:49:09
+ timelocal_posix($s,$m,$h,$D,$M,$Y);
+};
+
if ($commit_epoch - $tag_epoch > 60 * 24 * 60 * 60) {
my $months = sprintf "%.2f", ($commit_epoch - $tag_epoch) / (30 * 24 * 60 * 60);
my $message=