| |
@@ -162,43 +162,41 @@
|
| |
# Old API -- in python-bugzilla. But with current server, this
|
| |
# gives ProxyError
|
| |
for collection, product in self.config["products"].items():
|
| |
- self.product_cache[collection] = self.server.getcomponentsdetails(product)
|
| |
+ bz_product_name = product.get('bz_product_name', collection)
|
| |
+ self.product_cache[collection] = self.server.getcomponentsdetails(bz_product_name)
|
| |
elif self.config['bugzilla']['compat_api'] == 'component.get':
|
| |
# Way that's undocumented in the partner-bugzilla api but works
|
| |
# currently
|
| |
for collection, product in self.config["products"].items():
|
| |
-
|
| |
+ bz_product_name = product.get('bz_product_name', collection)
|
| |
# restrict the list of info returned to only the packages of
|
| |
# interest
|
| |
pkglist = [
|
| |
project["name"]
|
| |
for project in pagure_projects
|
| |
- if product in project["products"]
|
| |
+ if bz_product_name in project["products"]
|
| |
]
|
| |
- products = {}
|
| |
+ product_info_by_pkg = {}
|
| |
for pkg_segment in segment(pkglist, self.config['bugzilla']['req_segment']):
|
| |
# Format that bugzilla will understand. Strip None's that
|
| |
# segment() pads out the final data segment() with
|
| |
query = [
|
| |
- dict(
|
| |
- product=self.config['products'][collection],
|
| |
- component=p
|
| |
- )
|
| |
+ {'product': bz_product_name, 'component': p}
|
| |
for p in pkg_segment
|
| |
if p is not None
|
| |
]
|
| |
- raw_data = self.server._proxy.Component.get(dict(names=query))
|
| |
+ raw_data = self.server._proxy.Component.get({'names': query})
|
| |
for package in raw_data['components']:
|
| |
# Reformat data to be the same as what's returned from
|
| |
# getcomponentsdetails
|
| |
- product = dict(
|
| |
- initialowner=package['default_assignee'],
|
| |
- description=package['description'],
|
| |
- initialqacontact=package['default_qa_contact'],
|
| |
- initialcclist=package['default_cc']
|
| |
- )
|
| |
- products[package['name'].lower()] = product
|
| |
- self.product_cache[collection] = products
|
| |
+ product_info = {
|
| |
+ 'initialowner': package['default_assignee'],
|
| |
+ 'description': package['description'],
|
| |
+ 'initialqacontact': package['default_qa_contact'],
|
| |
+ 'initialcclist': package['default_cc'],
|
| |
+ }
|
| |
+ product_info_by_pkg[package['name'].lower()] = product_info
|
| |
+ self.product_cache[collection] = product_info_by_pkg
|
| |
|
| |
def invert_user_cache(self):
|
| |
""" Takes the user_cache built when querying FAS and invert it so
|
| |
@@ -314,6 +312,8 @@
|
| |
e.args = ('ProtocolError', e.errcode, e.errmsg)
|
| |
raise
|
| |
|
| |
+ bz_product_name = self.config['products'][collection].get('bz_product_name', collection)
|
| |
+
|
| |
# Set the qacontact_email and name
|
| |
default_qa_contact_email = self.config['default_qa_contact_email']
|
| |
default_qa_contact = f"<default: {default_qa_contact_email.split('@', 1)[0]}@...>"
|
| |
@@ -346,12 +346,11 @@
|
| |
data['initialcclist'] = initial_cc_emails
|
| |
break
|
| |
|
| |
- data["is_active"] = not retired
|
| |
-
|
| |
if data:
|
| |
# Changes occurred. Submit a request to change via xmlrpc
|
| |
- data['product'] = self.config['products'][collection]
|
| |
+ data['product'] = bz_product_name
|
| |
data['component'] = package
|
| |
+ data["is_active"] = not retired
|
| |
|
| |
if self.config["verbose"]:
|
| |
print(f'[EDITCOMP] {data["product"]}/{data["component"]}')
|
| |
@@ -414,16 +413,12 @@
|
| |
new_poc=owner_email,
|
| |
prev_poc=product[pkg_key]['initialowner'],
|
| |
name=package,
|
| |
- product=self.config['products'][collection],
|
| |
+ product=bz_product_name,
|
| |
)
|
| |
else:
|
| |
if self.config.get("print-no-change"):
|
| |
- bz_product_name = self.config['products'][collection].get(
|
| |
- 'bz_product_name', collection
|
| |
- )
|
| |
print(f"[NOCHANGE] {package}/{bz_product_name}")
|
| |
else:
|
| |
- bz_product_name = self.config['products'][collection].get('bz_product_name', collection)
|
| |
if retired:
|
| |
if self.config['verbose']:
|
| |
print(f"[NOADD] {bz_product_name}/{package} (is retired)")
|
| |
@@ -473,10 +468,10 @@
|
| |
:return: a list of the repo's branches
|
| |
"""
|
| |
branches_url = '{0}component-branches/'.format(env['pdc_url'])
|
| |
- params = dict(
|
| |
- global_component=repo['name'],
|
| |
- type=env['pdc_types'][repo['namespace']]
|
| |
- )
|
| |
+ params = {
|
| |
+ 'global_component': repo['name'],
|
| |
+ 'type': env['pdc_types'][repo['namespace']],
|
| |
+ }
|
| |
if config["verbose"]:
|
| |
print('Querying {0} {1}'.format(branches_url, params))
|
| |
rv = session.get(branches_url, params=params, timeout=60)
|
| |
@@ -506,7 +501,6 @@
|
| |
_namespace_to_product = None
|
| |
_product_to_branch_regex = None
|
| |
_branch_regex_to_product = None
|
| |
- errors = collections.defaultdict(list)
|
| |
|
| |
def send_email(self, from_address, to_address, subject, message, cc_address=None):
|
| |
'''Send an email if there's an error.
|
| |
@@ -656,16 +650,16 @@
|
| |
# Combine and collapse those two into a single list:
|
| |
self.pagure_projects = []
|
| |
if project_list:
|
| |
- project_list = set(tuple(p.split("/", 1)) for p in project_list)
|
| |
+ project_list = {tuple(p.split("/", 1)) for p in project_list}
|
| |
for namespace, entries in pagure_namespace_to_poc.items():
|
| |
for name, poc in entries.items():
|
| |
if not project_list or (namespace, name) in project_list:
|
| |
- self.pagure_projects.append(dict(
|
| |
- namespace=namespace,
|
| |
- name=name,
|
| |
- poc=poc,
|
| |
- watchers=pagure_namespace_to_cc[namespace][name],
|
| |
- ))
|
| |
+ self.pagure_projects.append({
|
| |
+ 'namespace': namespace,
|
| |
+ 'name': name,
|
| |
+ 'poc': poc,
|
| |
+ 'watchers': pagure_namespace_to_cc[namespace][name],
|
| |
+ })
|
| |
|
| |
@property
|
| |
def namespace_to_product(self):
|
| |
@@ -854,7 +848,7 @@
|
| |
self.env["print-no-change"] = self.args.print_no_change
|
| |
|
| |
# Non-fatal errors to alert people about
|
| |
- errors = []
|
| |
+ self.errors = collections.defaultdict(list)
|
| |
|
| |
self.session = retry_session()
|
| |
|
| |
Previously, the
products
dict mapped product names in Fedora to theirBugzilla counter parts. Now that all information pertaining products is
in this dictionary, the Bugzilla product name (if differing) is in the
bz_product_name sub-key.
Rename some variables to make their purpose a little more obvious, and
not use
product
for two different things (names and the informationaldictionary stored in the product cache).
use dict literals and set/list comprehensions