3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # Use this script to compare the crashreport stats of two different versions of LibreOffice.
10 # Usage sample: ./compare-crashreport-stats.py --old 7.2.0.4 --new 7.2.1.2
13 from bs4
import BeautifulSoup
19 html_text
= requests
.get(url
).text
20 soup
= BeautifulSoup(html_text
, 'html.parser')
22 table
= soup
.find("table", {"id": "data-table"}).tbody
23 for tr
in table
.find_all("tr"):
24 td_list
= tr
.find_all("td")
25 crashName
= td_list
[0].a
.text
.strip()
26 crashNumber
= int(td_list
[1].text
.strip())
27 crashReports
[crashName
] = crashNumber
31 if __name__
== '__main__':
32 parser
= argparse
.ArgumentParser()
34 parser
.add_argument('--old', action
='store', dest
="old", required
=True)
35 parser
.add_argument('--new', action
="store", dest
="new", required
=True)
37 results
= parser
.parse_args()
39 oldVersion
= parse_url(
40 "https://crashreport.libreoffice.org/stats/version/" + results
.old
+ "?limit=1000&days=30")
41 newVersion
= parse_url(
42 "https://crashreport.libreoffice.org/stats/version/" + results
.new
+ "?limit=1000&days=30")
44 print(str(len(oldVersion
)) + " crash reports in version " + results
.old
)
45 print(str(len(newVersion
)) + " crash reports in version " + results
.new
)
48 print("===== Fixed Reports =====")
49 fixedReports
= set(oldVersion
.keys()) - set(newVersion
.keys())
50 for k
, v
in sorted(oldVersion
.items(), key
=lambda item
: item
[1], reverse
=True):
52 if v
>= 20 and k
in fixedReports
:
53 print(str(v
) + " " + k
)
56 print("===== Newly introduced Reports =====")
57 newReports
= set(newVersion
.keys()) - set(oldVersion
.keys())
58 for k
, v
in sorted(newVersion
.items(), key
=lambda item
: item
[1], reverse
=True):
60 if v
>= 20 and k
in newReports
:
61 print(str(v
) + " " + k
)