mirror of
git://git.yoctoproject.org/yocto-autobuilder-helper.git
synced 2025-07-19 20:59:02 +02:00

the two html files, index.html and index-full.html, got merged so we only need the json file with the complete set of data. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
49 lines
1.5 KiB
Python
Executable File
49 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import json, os.path, collections
|
|
import sys
|
|
import argparse
|
|
import subprocess
|
|
import tempfile
|
|
from datetime import datetime, date, timedelta
|
|
|
|
args = argparse.ArgumentParser(description="Generate Patch Metric Chart data file")
|
|
args.add_argument("-j", "--json", help="JSON data file to use")
|
|
args.add_argument("-o", "--outputdir", help="output directory")
|
|
args = args.parse_args()
|
|
|
|
status_values = ["accepted", "pending", "inappropriate", "backport", "submitted", "denied", "inactive-upstream", "malformed-upstream-status", "malformed-sob"]
|
|
|
|
data = json.load(open(args.json))
|
|
|
|
#
|
|
# Write the latest patch breakdown to a file for the pie chart
|
|
#
|
|
latest = {'date' : "0"}
|
|
for i in data:
|
|
if int(i['date']) > int(latest['date']):
|
|
latest = i
|
|
json.dump(latest, open(args.outputdir + "/patch-status-pie.json", "w"), sort_keys=True, indent="\t")
|
|
|
|
#
|
|
# Write patch counts by day
|
|
#
|
|
def round_to_day(val):
|
|
return int((datetime.fromtimestamp(int(val)).date() - date(1970, 1, 1)).total_seconds())
|
|
|
|
newdata = []
|
|
databydate = {}
|
|
for i in data:
|
|
rounded = round_to_day(i['date'])
|
|
if rounded not in databydate:
|
|
databydate[rounded] = i
|
|
elif rounded in databydate and databydate[rounded]['date'] < i['date']:
|
|
databydate[rounded] = i
|
|
|
|
for i in databydate:
|
|
for todel in ['commit', 'commit_count']:
|
|
if todel in databydate[i]:
|
|
del databydate[i][todel]
|
|
newdata.append(databydate[i])
|
|
|
|
json.dump(newdata, open(args.outputdir + "/patch-status-byday.json", "w"), sort_keys=True, indent="\t")
|