Support de-activating retired packages

When a package is retired, we want to de-active it in bugzilla which
makes it no longer visible in the list of packages against which one
can fill a bug.

Fixes https://pagure.io/fedora-infrastructure/issue/7690

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2019-11-23 13:54:47 +01:00
parent f2bea59f37
commit e7ddb4f8ac

View file

@ -274,7 +274,8 @@ class BugzillaProxy:
raise raise
def add_edit_component(self, package, collection, owner, description=None, def add_edit_component(self, package, collection, owner, description=None,
qacontact=None, cclist=None, print_fas_names=False): qacontact=None, cclist=None, print_fas_names=False,
retired=False):
'''Add or update a component to have the values specified. '''Add or update a component to have the values specified.
''' '''
# Turn the cclist into something usable by bugzilla # Turn the cclist into something usable by bugzilla
@ -339,6 +340,8 @@ class BugzillaProxy:
data['initialcclist'] = initial_cc_emails data['initialcclist'] = initial_cc_emails
break break
data["is_active"] = not retired
if data: if data:
# Changes occurred. Submit a request to change via xmlrpc # Changes occurred. Submit a request to change via xmlrpc
data['product'] = self.config['products'][collection] data['product'] = self.config['products'][collection]
@ -420,14 +423,16 @@ class BugzillaProxy:
'component': package, 'component': package,
'description': description or 'NA', 'description': description or 'NA',
'initialowner': owner_email, 'initialowner': owner_email,
'initialqacontact': qacontact_email 'initialqacontact': qacontact_email,
'is_active': not retired,
} }
if initial_cc_emails: if initial_cc_emails:
data['initialcclist'] = initial_cc_emails data['initialcclist'] = initial_cc_emails
if self.config["verbose"]: if self.config["verbose"]:
print('[ADDCOMP] %s/%s' % (data["product"], data["component"])) print('[ADDCOMP] %s/%s' % (data["product"], data["component"]))
for key in ["initialowner", "description", "initialqacontact", "initialcclist"]: for key in ["initialowner", "description", "initialqacontact",
"initialcclist", "is_active"]:
if print_fas_names and key in ('initialowner', if print_fas_names and key in ('initialowner',
'initialqacontact', 'initialqacontact',
'initialcclist'): 'initialcclist'):
@ -739,11 +744,15 @@ class DistgitBugzillaSync:
project['products'] = list(products) project['products'] = list(products)
products_poc = {} products_poc = {}
products_retired = {}
for product in products: for product in products:
owner = project["poc"] owner = project["poc"]
# Check if the project is retired in PDC, and if so set assignee to orphan. # Check if the project is retired in PDC, and if so set assignee to orphan.
if self._is_retired(product, project): if self._is_retired(product, project):
owner = 'orphan' owner = 'orphan'
products_retired[product] = True
else:
products_retired[product] = False
# Check if the Bugzilla ticket assignee has been manually overridden # Check if the Bugzilla ticket assignee has been manually overridden
override_yaml = self._get_override_yaml(project, self.session) override_yaml = self._get_override_yaml(project, self.session)
@ -752,6 +761,7 @@ class DistgitBugzillaSync:
owner = override_yaml[product] owner = override_yaml[product]
products_poc[product] = owner products_poc[product] = owner
project['products_poc'] = products_poc project['products_poc'] = products_poc
project["products_retired"] = products_retired
self.pagure_projects[idx] = project self.pagure_projects[idx] = project
@ -883,6 +893,7 @@ class DistgitBugzillaSync:
qacontact=None, qacontact=None,
cclist=project['watchers'], cclist=project['watchers'],
print_fas_names=self.args.print_fas_names, print_fas_names=self.args.print_fas_names,
retired=project["products_retired"][product],
) )
except ValueError as e: except ValueError as e:
# A username didn't have a bugzilla address # A username didn't have a bugzilla address