From 647252ba84c5ada60b98ef9b869fda38ad528e54 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Sun, 20 Aug 2023 19:25:53 -0600 Subject: [PATCH] util/release: Update gerrit_stats script for release - Change delimiter characters to safe characters to keep the output from getting mangled when imported into a spreadsheet. - Change hyphens for statistics to asterisks for easier use in the release notes. Signed-off-by: Martin Roth Change-Id: I94f581d697f58cb29a662ac70ef9fd1d8c1e98ef Reviewed-on: https://review.coreboot.org/c/coreboot/+/77332 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer --- util/release/gerrit_stats.pl | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/util/release/gerrit_stats.pl b/util/release/gerrit_stats.pl index 789cb051d7..514eebe2b4 100755 --- a/util/release/gerrit_stats.pl +++ b/util/release/gerrit_stats.pl @@ -205,6 +205,8 @@ sub Main { if ( $owner && exists( $aliases{$owner} ) ) { $owner = $aliases{$owner}; } + $owner =~ s/"/'/g; + $owner =~ s/,/./g; $author = $commit_info->{'currentPatchSet'}{'author'}{'name'}; if ( $author && exists( $aliases{$author} ) ) { @@ -213,10 +215,13 @@ sub Main { if ( !$author ) { $author = $commit_info->{'currentPatchSet'}{'author'}{'username'}; } + $author =~ s/"/'/g; + $author =~ s/,/./g; $author_email = $commit_info->{'currentPatchSet'}{'author'}{'email'}; $inserted_lines = $commit_info->{'currentPatchSet'}{'sizeInsertions'}; $deleted_lines = $commit_info->{'currentPatchSet'}{'sizeDeletions'}; $subject = $commit_info->{'subject'}; + $subject =~ s/"/'/g; #get the patch's submitter my $approvals = $commit_info->{'currentPatchSet'}{'approvals'}; @@ -275,6 +280,8 @@ sub Main { $commenter = $aliases{$commenter}; } } + $commenter =~ s/"/'/g; + $commenter =~ s/,/./g; if ( $commenter && $author && $commenter eq $author ) { next; } @@ -307,6 +314,8 @@ sub Main { $submitter = $aliases{$submitter}; } } + $submitter =~ s/"/'/g; + $submitter =~ s/,/./g; if ( $approval->{'type'} eq "Code-Review" ) { my $patch_reviewer = $approval->{'by'}{'name'}; @@ -483,16 +492,16 @@ sub Main { $Days += 1; } - print "\n- Total Commits: $number_of_commits\n"; - printf "- Average Commits per day: %.2f\n", $number_of_commits / $Days; - print "- Total lines added: $total_added\n"; - printf "- Average lines added per commit: %.2f\n", $total_added / $number_of_commits; - print "- Number of patches adding more than 100 lines: $patches_over_100_lines\n"; - printf "- Average lines added per small commit: %.2f\n", ( $total_added - $total_lines_large_patches ) / ( $number_of_commits - $patches_over_100_lines ); + print "\n* Total Commits: $number_of_commits\n"; + printf "* Average Commits per day: %.2f\n", $number_of_commits / $Days; + print "* Total lines added: $total_added\n"; + printf "* Average lines added per commit: %.2f\n", $total_added / $number_of_commits; + print "* Number of patches adding more than 100 lines: $patches_over_100_lines\n"; + printf "* Average lines added per small commit: %.2f\n", ( $total_added - $total_lines_large_patches ) / ( $number_of_commits - $patches_over_100_lines ); - print "- Total lines removed: $total_removed\n"; - printf "- Average lines removed per commit: %.2f\n", $total_removed / $number_of_commits; - print "- Total difference between added and removed: " . ( $total_added - $total_removed ) . "\n\n"; + print "* Total lines removed: $total_removed\n"; + printf "* Average lines removed per commit: %.2f\n", $total_removed / $number_of_commits; + print "* Total difference between added and removed: " . ( $total_added - $total_removed ) . "\n\n"; print "=== Authors - Number of commits ===\n"; printf "%-30s ,%5s ,%5s ,%6s ,%6s , %-52s ,%6s, %-19s , %s\n", "Author", "Ptchs", "Revws", "Cmnts", "Sbmts", "Email", "Prcnt", "Last commit", "Earliest_commit";