This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "Bump Pod::Simple from 3.35 to 3.36"
[perl5.git] / Porting / acknowledgements.pl
index bd9ac82..f04dac5 100644 (file)
@@ -7,7 +7,7 @@ Porting/acknowledgements.pl - Generate perldelta acknowledgements text
 =head1 SYNOPSIS
 
   perl Porting/acknowledgements.pl v5.15.0..HEAD
-  
+
 =head1 DESCRIPTION
 
 This generates the text which goes in the Acknowledgements section in
@@ -25,7 +25,7 @@ use Text::Wrap;
 use Time::Piece;
 use Time::Seconds;
 use version;
-$Text::Wrap::columns = 80;
+$Text::Wrap::columns = 77;
 
 my $since_until = shift;
 
@@ -38,9 +38,11 @@ my $previous_version = previous_version();
 my $next_version     = next_version();
 my $development_time = development_time();
 
-my ( $changes, $files ) = changes_files();
+my ( $changes, $files, $code_changes, $code_files ) = changes_files();
 my $formatted_changes = commify( round($changes) );
 my $formatted_files   = commify( round($files) );
+my $formatted_code_changes = commify( round($code_changes) );
+my $formatted_code_files   = commify( round($code_files) );
 
 my $authors = authors();
 my $nauthors = $authors =~ tr/,/,/;
@@ -51,8 +53,12 @@ my $text
 since Perl $previous_version and contains approximately $formatted_changes
 lines of changes across $formatted_files files from $nauthors authors.
 
-Perl continues to flourish into its third decade thanks to a vibrant 
-community of users and developers. The following people are known to 
+Excluding auto-generated files, documentation and release tools, there
+were approximately $formatted_code_changes lines of changes to
+$formatted_code_files .pm, .t, .c and .h files.
+
+Perl continues to flourish into its fourth decade thanks to a vibrant
+community of users and developers. The following people are known to
 have contributed the improvements that became Perl $next_version:
 
 $authors
@@ -66,8 +72,7 @@ modules included in Perl's core. We're grateful to the entire CPAN
 community for helping Perl to flourish.
 
 For a more complete list of all of Perl's historical contributors,
-please see the F<AUTHORS> file in the Perl source distribution.
-";
+please see the F<AUTHORS> file in the Perl source distribution.";
 
 my $wrapped = fill( '', '', $text );
 print "$wrapped\n";
@@ -89,34 +94,48 @@ sub next_version {
 # returns the development time since the previous version in weeks
 # or months
 sub development_time {
-    my $dates = qx(git log --pretty=format:%ct --summary $since_until);
-    my $first_timestamp;
-    foreach my $line ( split $/, $dates ) {
-        next unless $line;
-        next unless $line =~ /^\d+$/;
-        $first_timestamp = $line;
-    }
+    my $first_timestamp = qx(git log -1 --pretty=format:%ct --summary $since);
+    my $last_timestamp  = qx(git log -1 --pretty=format:%ct --summary $until);
 
     die "Missing first timestamp" unless $first_timestamp;
+    die "Missing last timestamp" unless $last_timestamp;
 
-    my $now     = localtime;
-    my $then    = localtime($first_timestamp);
-    my $seconds = $now - $then;
-    my $weeks   = ceil( $seconds / ONE_WEEK );
-    my $months  = ceil( $seconds / ONE_MONTH );
+    my $seconds = localtime($last_timestamp) - localtime($first_timestamp);
+    my $weeks   = _round( $seconds / ONE_WEEK );
+    my $months  = _round( $seconds / ONE_MONTH );
 
     my $development_time;
     if ( $months < 2 ) {
-        return "$weeks weeks";
+        return "$weeks @{[$weeks == 1 ? q(week) : q(weeks)]}";
     } else {
         return "$months months";
     }
 }
 
+sub _round {
+    my $val = shift;
+
+    my $int = int $val;
+    my $remainder = $val - $int;
+
+    return $remainder >= 0.5 ? $int + 1 : $int;
+}
+
 # returns the number of changed lines and files since the previous
 # version
 sub changes_files {
     my $output = qx(git diff --shortstat $since_until);
+    my $q = ($^O =~ /^(?:MSWin32|NetWare|VMS)$/io) ? '"' : "'";
+    my @filenames = qx(git diff --numstat $since_until | $^X -anle ${q}next if m{^dist/Module-CoreList} or not /\\.(?:pm|c|h|t)\\z/; print \$F[2]$q);
+    chomp @filenames;
+    my $output_code_changed = qx# git diff --shortstat $since_until -- @filenames #;
+
+    return ( _changes_from_cmd ( $output ),
+             _changes_from_cmd ( $output_code_changed ) );
+}
+
+sub _changes_from_cmd {
+    my $output = shift || die "No git diff command output";
 
     # 585 files changed, 156329 insertions(+), 53586 deletions(-)
     my ( $files, $insertions, $deletions )