Rewrite issue listing script

Rewrote the script in python and leveraged the dictionary CSV processor to
prevent field number mismatches. Combined the two scripts into one so that
all user-facing issues that are fixed can be easily shown in the release
notes.
This commit is contained in:
Markus Mäkelä 2018-09-10 13:50:18 +03:00
parent 73405c8ff9
commit eed2628cff
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
4 changed files with 31 additions and 37 deletions

View File

@ -11,4 +11,4 @@ fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
version=$1
curl -s "https://jira.mariadb.org/sr/jira.issueviews:searchrequest-csv-current-fields/temp/SearchRequest.csv?jqlQuery=project+%3D+MXS+AND+issuetype+%3D+Bug+AND+status+%3D+Closed+AND+fixVersion+%3D+$version" | $DIR/process.pl
curl -s "https://jira.mariadb.org/sr/jira.issueviews:searchrequest-csv-all-fields/temp/SearchRequest.csv?jqlQuery=project+%3D+MXS+AND+status+%3D+Closed+AND+fixVersion+%3D+$version" | $DIR/process.py

View File

@ -1,14 +0,0 @@
#!/bin/bash
if [ $# -ne 1 ]
then
echo "USAGE: $0 VERSION"
exit 1
fi
# Script location
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
version=$1
curl -s "https://jira.mariadb.org/sr/jira.issueviews:searchrequest-csv-current-fields/temp/SearchRequest.csv?jqlQuery=project+%3D+MXS+AND+issuetype+%21%3D+Bug+AND+status+%3D+Closed+AND+fixVersion+%3D+$version" | $DIR/process.pl

View File

@ -1,22 +0,0 @@
#!/usr/bin/env perl
# Discard the CSV headers
<>;
while (<>)
{
# Replace commas that are inside double quotes
while (s/("[^"]*),([^"]*")/$1$2/g)
{
;
}
# Replace the double quotes themselves
s/"//g;
# Split the line and grab the issue number and description
my @parts = split(/,/);
my $issue = @parts[1];
my $desc = @parts[0];
print "* [$issue](https://jira.mariadb.org/browse/$issue) $desc\n";
}

30
Documentation/process.py Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import sys
import csv
bugs = []
new_features = []
for row in csv.DictReader(sys.stdin):
if row['Issue Type'] == 'Bug':
bugs.append(row)
elif row['Issue Type'] == 'New Feature':
new_features.append(row)
if len(new_features) > 0:
print("## New Features")
print()
for f in new_features:
print("* [" + f['Issue key'] + "](https://jira.mariadb.org/browse/" + f['Issue key'] + ") " + f['Summary'])
print()
print("## Bug fixes")
print()
for b in bugs:
print("* [" + b['Issue key'] + "](https://jira.mariadb.org/browse/" + b['Issue key'] + ") " + b['Summary'])
print()