Created
January 23, 2019 07:23
-
-
Save hguemar/0331c0c5484dca56e450ca219f41ecc3 to your computer and use it in GitHub Desktop.
Triage fedora tracking tickets for py2 removal using rdoinfo to sort tickets relevant to RDO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
import functools | |
import os.path | |
import bugzilla | |
from distroinfo.info import DistroInfo | |
URL = 'https://bugzilla.redhat.com' | |
TICKET = '1625773' | |
RDOINFO_RAW_URL = \ | |
'https://raw.githubusercontent.com/redhat-openstack/rdoinfo/master/' | |
def retrieve_bugzilla_components(): | |
bzapi = bugzilla.Bugzilla(URL) | |
bug = bzapi.getbug(TICKET) | |
deps = bug.depends_on | |
components = [] | |
for d in deps: | |
b = bzapi.getbug(d) | |
components.append("{b.component} {b.weburl}".format(b=b)) | |
components.sort() | |
with open('components.txt', 'w') as f: | |
f.writelines(['{}\n'.format(component) for component in components]) | |
print('End') | |
def cache_rdoinfo(): | |
di_file = 'rdo-full.yml' | |
di = DistroInfo(di_file, | |
remote_info=RDOINFO_RAW_URL) | |
info = di.get_info() | |
return info | |
def is_rdo_package(info, package): | |
for k in info['packages']: | |
if k['name'] == package[0]: | |
return True | |
return False | |
if __name__ == '__main__': | |
# caching bugzilla output due to calls failing (1228 tickets) | |
if not os.path.isfile('tickets.txt'): | |
retrieve_bugzilla_components() | |
info = cache_rdoinfo() | |
data = [] | |
with open('tickets.txt', 'r') as f: | |
for line in f.readlines(): | |
if is_rdo_package(info, component) == True: | |
data.append('{0} {1}\n'.format(*line.split())) | |
with open('tickets_to_process.txt', 'w') as f: | |
f.writelines(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment