Repository: fedora-infra/bodhi

Issue:
The "Fixed In Version" Bugzilla field should contain NVRs
Traditionally, the "Fixed In Version" field in Bugzilla contained NVRs (separated by spaces where applicable). The current instance uses only VRs.

This adds an unnecessary inconsistency and confusion in cases where a bug is fixed by multiple packages, each with a different version.



Discussion:
This is related to #428 and #528

For reference, can you link me to one or two bugs that used the fixed-in version this way?

Sure.
https://bugzilla.redhat.com/show_bug.cgi?id=1134882
https://bugzilla.redhat.com/show_bug.cgi?id=1256190
https://bugzilla.redhat.com/show_bug.cgi?id=1256193


Resolving patch:
diff --git a/bodhi/bugs.py b/bodhi/bugs.py
--- a/bodhi/bugs.py
+++ b/bodhi/bugs.py
@@ -101,13 +101,18 @@ def close(self, bug_id, versions):
             if bug.component in versions:
                 version = versions[bug.component]
                 # Get the existing list
-                fixedin = [v.strip() for v in bug.fixed_in.split(',')]
-                # Strip out any empty strings
-                fixedin = [v for v in fixedin if v.strip()]
+                fixedin = [v.strip() for v in bug.fixed_in.split()]
+                # Strip out any empty strings (already stripped)
+                fixedin = [v for v in fixedin if v]
                 # And add our build if its not already there
                 if version not in fixedin:
                     fixedin.append(version)
-                args['fixedin'] = ", ".join(fixedin)
+
+                # There are Red Hat preferences to how this field should be
+                # structured.  We should use:
+                # - the full NVR as it appears in koji
+                # - space-separated if there's more than one.
+                args['fixedin'] = " ".join(fixedin)
 
             bug.close('NEXTRELEASE', **args)
         except xmlrpclib.Fault:
diff --git a/bodhi/models/models.py b/bodhi/models/models.py
--- a/bodhi/models/models.py
+++ b/bodhi/models/models.py
@@ -1960,12 +1960,9 @@ def testing(self, update):
     def close_bug(self, update):
         # Build a mapping of package names to build versions
         # so that .close() can figure out which build version fixes which bug.
-        versions = dict([(
-            get_nvr(b.nvr)[0],
-            # Strip off the .fc23 at the end of the nvr to try and match the
-            # way the anaconda team uses the fixedin field.
-            b.nvr.rsplit('.', 1)[0]
-        ) for b in update.builds])
+        versions = dict([
+            (get_nvr(b.nvr)[0], b.nvr) for b in update.builds
+        ])
         bugtracker.close(self.bug_id, versions=versions)
 
     def modified(self, update):


Test patch:
diff --git a/bodhi/tests/test_masher.py b/bodhi/tests/test_masher.py
--- a/bodhi/tests/test_masher.py
+++ b/bodhi/tests/test_masher.py
@@ -731,7 +731,8 @@ def test_modify_stable_bugs(self, close, comment, *args):
             t.db = session
             t.work()
             t.db = None
-        close.assert_called_with(12345, versions=dict(bodhi=u'bodhi-2.0-1'))
+        close.assert_called_with(
+            12345, versions=dict(bodhi=u'bodhi-2.0-1.fc17'))
         comment.assert_called_with(12345, u'bodhi-2.0-1.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.')
 
     @mock.patch(**mock_taskotron_results)