From e7ddb4f8acec4326cccd12cae6c301c1958f878f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sat, 23 Nov 2019 13:54:47 +0100 Subject: [PATCH] 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 --- distgit_bugzilla_sync/script.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/distgit_bugzilla_sync/script.py b/distgit_bugzilla_sync/script.py index d78bce6..5c9efab 100644 --- a/distgit_bugzilla_sync/script.py +++ b/distgit_bugzilla_sync/script.py @@ -274,7 +274,8 @@ class BugzillaProxy: raise 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. ''' # Turn the cclist into something usable by bugzilla @@ -339,6 +340,8 @@ class BugzillaProxy: 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] @@ -420,14 +423,16 @@ class BugzillaProxy: 'component': package, 'description': description or 'NA', 'initialowner': owner_email, - 'initialqacontact': qacontact_email + 'initialqacontact': qacontact_email, + 'is_active': not retired, } if initial_cc_emails: data['initialcclist'] = initial_cc_emails if self.config["verbose"]: 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', 'initialqacontact', 'initialcclist'): @@ -739,11 +744,15 @@ class DistgitBugzillaSync: project['products'] = list(products) products_poc = {} + products_retired = {} for product in products: owner = project["poc"] # Check if the project is retired in PDC, and if so set assignee to orphan. if self._is_retired(product, project): owner = 'orphan' + products_retired[product] = True + else: + products_retired[product] = False # Check if the Bugzilla ticket assignee has been manually overridden override_yaml = self._get_override_yaml(project, self.session) @@ -752,6 +761,7 @@ class DistgitBugzillaSync: owner = override_yaml[product] products_poc[product] = owner project['products_poc'] = products_poc + project["products_retired"] = products_retired self.pagure_projects[idx] = project @@ -883,6 +893,7 @@ class DistgitBugzillaSync: qacontact=None, cclist=project['watchers'], print_fas_names=self.args.print_fas_names, + retired=project["products_retired"][product], ) except ValueError as e: # A username didn't have a bugzilla address