| |
@@ -0,0 +1,68 @@
|
| |
+ """ A script for listing which components have bz epel entries that shouldn't.
|
| |
+
|
| |
+ https://pagure.io/releng/issue/7148
|
| |
+ """
|
| |
+
|
| |
+ import bugzilla
|
| |
+ import dogpile.cache
|
| |
+ import requests
|
| |
+
|
| |
+ bz = bugzilla.Bugzilla('https://bugzilla.redhat.com')
|
| |
+ cache = dogpile.cache.make_region().configure(
|
| |
+ 'dogpile.cache.dbm',
|
| |
+ arguments=dict(
|
| |
+ filename='/var/tmp/bugzilla-component-cache.dbm',
|
| |
+ expiration_time=-1,
|
| |
+ )
|
| |
+ )
|
| |
+
|
| |
+
|
| |
+ @cache.cache_on_arguments()
|
| |
+ def get_pdc_data(url):
|
| |
+ response = requests.get(url)
|
| |
+ if not response:
|
| |
+ raise ValueError("%r failed %r" % (url, response))
|
| |
+ return response.json()
|
| |
+
|
| |
+
|
| |
+ @cache.cache_on_arguments()
|
| |
+ def in_bugzilla(component):
|
| |
+ matches = bz._proxy.Component.get(dict(names=[
|
| |
+ dict(product='Fedora EPEL', component=component)]))
|
| |
+ return bool(matches['components'])
|
| |
+
|
| |
+
|
| |
+ def get_all_branches_from_pdc():
|
| |
+ next = 'https://pdc.fedoraproject.org/rest_api/v1/component-branches' + \
|
| |
+ '?type=rpm&page_size=100&page=1'
|
| |
+ while next:
|
| |
+ print("Getting %r" % next)
|
| |
+ data = get_pdc_data(next)
|
| |
+ for entry in data['results']:
|
| |
+ yield entry
|
| |
+ next = data['next']
|
| |
+
|
| |
+
|
| |
+ all_packages = set()
|
| |
+ in_epel_in_pdc = set()
|
| |
+ in_epel_in_bz = set()
|
| |
+ for branch in get_all_branches_from_pdc():
|
| |
+ all_packages.add(branch['global_component'])
|
| |
+ if branch['name'].startswith('epel') or branch['name'].startswith('el'):
|
| |
+ in_epel_in_pdc.add(branch['global_component'])
|
| |
+ if in_bugzilla(branch['global_component']):
|
| |
+ in_epel_in_bz.add(branch['global_component'])
|
| |
+ print("All: %r, EPEL(PDC): %r, EPEL(BZ): %r, "
|
| |
+ "In BZ and shouldn't be: %r, "
|
| |
+ "Not in BZ and should be: %r" % (
|
| |
+ len(all_packages),
|
| |
+ len(in_epel_in_pdc),
|
| |
+ len(in_epel_in_bz),
|
| |
+ len(in_epel_in_bz - in_epel_in_pdc),
|
| |
+ len(in_epel_in_pdc - in_epel_in_bz),
|
| |
+ ))
|
| |
+
|
| |
+ with open('in-bz-and-shouldnt-be.txt', 'w') as f:
|
| |
+ f.writelines(["%s\n" % i for i in (in_epel_in_bz - in_epel_in_pdc)])
|
| |
+ with open('not-in-bz-and-should-be.txt', 'w') as f:
|
| |
+ f.writelines(["%s\n" % i for i in (in_epel_in_pdc - in_epel_in_bz)])
|
| |
\ No newline at end of file
|
| |
Still in progress. Trying to come up with a list of packages that need fixing for #7148.