#31 Support de-activating retired packages
Merged 4 years ago by nphilipp. Opened 4 years ago by pingou.
fedora-infra/ pingou/distgit-bugzilla-sync block-retire  into  master

@@ -274,7 +274,8 @@ 

                          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 @@ 

                          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]
@@ -414,20 +417,28 @@ 

                      )

                      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}")

+                 return

+ 

              # Add component

              data = {

-                 'product': self.config['products'][collection].get('bz_product_name', collection),

+                 'product': bz_product_name,

                  '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"]:

+                 print(f"[ADDCOMP] {bz_product_name}/{package}")

+                 for key in ["initialowner", "description", "initialqacontact",

+                             "initialcclist", "is_active"]:

                      if print_fas_names and key in ('initialowner',

                                                     'initialqacontact',

                                                     'initialcclist'):
@@ -739,11 +750,15 @@ 

              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 +767,7 @@ 

                      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 +899,7 @@ 

                          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

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 PR seats on the top of #29 and should be merged after it

So this may not be perfect yet as, looking at: https://pagure.io/fedora-infrastructure/issue/7639 and testing the script with --debug -p rpms/projectM-jack --env=production, I get as output:

[ADDCOMP] Fedora/projectM-jack
    initialowner set to extras-orphan@fedoraproject.org
    description set to NA
    initialqacontact set to extras-qa@fedoraproject.org
    initialcclist set to ['extras-orphan@fedoraproject.org']
    is_active set to False

So:
- Are we failing to retrieve inactive packages when building the products cache?
- Are we fine with adding inactive packages to bugzilla?
- Will bugzilla let us add a component that potentially already exists but is inactived?

One simple fix would be: do not add a component if it is already retired in Fedora. This assumes that active but retired packages will show up in the products cache and thus we'll be able to de-active them.

@kevin @mohanboddu your input here would be appreciated :)

rebased onto 49cc66bb2928582525e6b826d2f4548d2c769052

4 years ago

rebased onto e7ddb4f

4 years ago

So this may not be perfect yet as, looking at: https://pagure.io/fedora-infrastructure/issue/7639 and testing the script with --debug -p rpms/projectM-jack --env=production, I get as output:
[ADDCOMP] Fedora/projectM-jack
initialowner set to extras-orphan@fedoraproject.org
description set to NA
initialqacontact set to extras-qa@fedoraproject.org
initialcclist set to ['extras-orphan@fedoraproject.org']
is_active set to False

So:
- Are we failing to retrieve inactive packages when building the products cache?
- Are we fine with adding inactive packages to bugzilla?
- Will bugzilla let us add a component that potentially already exists but is inactived?
One simple fix would be: do not add a component if it is already retired in Fedora. This assumes that active but retired packages will show up in the products cache and thus we'll be able to de-active them.

That looks like a bug I introduced with PR#29 (...that's what we get for not having a test suite I guess). I'll look into it.

Should we really create retired components, or should we skip earlier on?

Metadata Update from @nphilipp:
- Request assigned

4 years ago

That one of the question I was asking earlier on :)

1 new commit added

  • don't add retired components to Bugzilla
4 years ago

As discussed, bail out early instead of adding BZ components for already retired projects.

Pull-Request has been merged by nphilipp

4 years ago
Metadata