internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: fedora-infra/bodhi

Issue:
Edited updates' builds get the pending_testing_tag instead of the pending_signing_tag
@puiterwijk found that we forgot to alter the code that edits existing updates such that it tags its builds with the `pending_signing_tag` instead of the `pending_testing_tag` as it does now.

[This code](https://github.com/fedora-infra/bodhi/blob/2.3.0/bodhi/server/models/models.py#L829-L836):

```
            # Add the pending tag to all new builds
            for build in new_builds:
                if up.release.pending_testing_tag:
                    koji.tagBuild(up.release.pending_testing_tag, build)
                else:
                    # EL6 doesn't have these, and that's okay...
                    # We still warn in case the config gets messed up.
                    log.warn('%s has no pending_testing_tag' % up.release.name)
```

should be changed with `s/pending_testing_tag/pending_signing_tag/g`.



Discussion:

Resolving patch:
diff --git a/bodhi/server/models/models.py b/bodhi/server/models/models.py
--- a/bodhi/server/models/models.py
+++ b/bodhi/server/models/models.py
@@ -826,14 +826,14 @@ def edit(cls, request, data):
                     'sent back to testing.',
                 })
 
-            # Add the pending tag to all new builds
+            # Add the pending_signing_tag to all new builds
             for build in new_builds:
-                if up.release.pending_testing_tag:
-                    koji.tagBuild(up.release.pending_testing_tag, build)
+                if up.release.pending_signing_tag:
+                    koji.tagBuild(up.release.pending_signing_tag, build)
                 else:
                     # EL6 doesn't have these, and that's okay...
                     # We still warn in case the config gets messed up.
-                    log.warn('%s has no pending_testing_tag' % up.release.name)
+                    log.warn('%s has no pending_signing_tag' % up.release.name)
 
         # And, updates with new or removed builds always get their karma reset.
         # https://github.com/fedora-infra/bodhi/issues/511
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -53,7 +53,7 @@
 # The short X.Y version.
 version = '2.3'
 # The full version, including alpha/beta/rc tags.
-release = '2.3.0'
+release = '2.3.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@
 
 here = os.path.abspath(os.path.dirname(__file__))
 README = open(os.path.join(here, 'README.rst')).read()
-VERSION = '2.3.0'
+VERSION = '2.3.1'
 # Possible options are at https://pypi.python.org/pypi?%3Aaction=list_classifiers
 CLASSIFIERS = [
     'Development Status :: 5 - Production/Stable',


Test patch:
Repository: fedora-infra/bodhi

Issue:
Mismatch between e-mail template name and key lookup
Bodhi 2.3.0 introduced a new `bodhi.server.mail.fedora_epel_legacy_errata_template` string, but the models.py looked it up by the name `fedora_epel_errata_legacy_template` which caused the masher to fail:

```
  File "/usr/lib/python2.7/site-packages/bodhi/server/mail.py", line 341, in get_template
    use_template = globals()[use_template]
KeyError: u'fedora_epel_errata_legacy_template'
```



Discussion:

Resolving patch:
diff --git a/bodhi/server/models/models.py b/bodhi/server/models/models.py
--- a/bodhi/server/models/models.py
+++ b/bodhi/server/models/models.py
@@ -1252,7 +1252,7 @@ def send_update_notice(self):
 
         # switch email template to legacy if update aims to EPEL <= 7
         if release_name == 'fedora_epel' and self.release.version_int <= 7:
-            templatetype = '%s_errata_legacy_template' % release_name
+            templatetype = '%s_legacy_errata_template' % release_name
         else:
             templatetype = '%s_errata_template' % release_name
 


Test patch:
Repository: fedora-infra/bodhi

Issue:
Ensure the masher's Koji interactions are fault-tolerant
This is an expansion on https://github.com/fedora-infra/bodhi/issues/1143.

The masher is a long-running task that needs to handle failures gracefully. The masher's interactions with Koji need to work despite intermittent network problems. This includes authentication, which involves the Kerberos server.

- [x] Ensure calls to Koji are retried in the event of network problems

- [ ]  Ensure that if there is an authentication problem, it is retried


Discussion:

Resolving patch:
diff --git a/bodhi/server/buildsys.py b/bodhi/server/buildsys.py
--- a/bodhi/server/buildsys.py
+++ b/bodhi/server/buildsys.py
@@ -291,7 +291,17 @@ def getRPMHeaders(self, rpmID, headers):
 
 def koji_login(config):
     """ Login to Koji and return the session """
-    koji_client = koji.ClientSession(_koji_hub, {'krb_rdns': False})
+
+    koji_options = {
+        'krb_rdns': False,
+        'max_retries': 30,
+        'retry_interval': 10,
+        'offline_retry': True,
+        'offline_retry_interval': 10,
+        'anon_retry': True,
+    }
+
+    koji_client = koji.ClientSession(_koji_hub, koji_options)
     if not koji_client.krb_login(**get_krb_conf(config)):
         log.error('Koji krb_login failed')
     return koji_client


Test patch:
diff --git a/bodhi/tests/server/test_buildsys.py b/bodhi/tests/server/test_buildsys.py
--- a/bodhi/tests/server/test_buildsys.py
+++ b/bodhi/tests/server/test_buildsys.py
@@ -124,8 +124,18 @@ def test_login_success(self, error):
         """Assert correct behavior for a successful login event."""
         config = {'some_meaningless_other_key': 'boring_value', 'krb_ccache': 'a_ccache',
                   'krb_keytab': 'a_keytab', 'krb_principal': 'a_principal'}
+        default_koji_opts = {
+            'krb_rdns': False,
+            'max_retries': 30,
+            'retry_interval': 10,
+            'offline_retry': True,
+            'offline_retry_interval': 10,
+            'anon_retry': True,
+        }
 
         client = buildsys.koji_login(config)
+        for key in default_koji_opts:
+            self.assertEqual(default_koji_opts[key], client.opts[key])
 
         self.assertEqual(type(client), koji.ClientSession)
         # No error should have been logged
Repository: fedora-infra/bodhi

Issue:
mention that karma is reset on update edit
Some people are confused why karma is zero for certain updates, because they don't know that update edit resets karma. It might be a good idea to add a note when this happens, so that it's more obvious.

What about changing e.g. this:
```
jwrdegoede edited this update.

New build(s):
    mesa-13.0.4-1.fc25
    libglvnd-0.2.999-10.gitdc16f8c.fc25
Removed build(s):
    libglvnd-0.2.999-9.gitdc16f8c.fc25
    mesa-13.0.3-7.fc25
```

into this:
```
jwrdegoede edited this update.

New build(s):
    mesa-13.0.4-1.fc25
    libglvnd-0.2.999-10.gitdc16f8c.fc25
Removed build(s):
    libglvnd-0.2.999-9.gitdc16f8c.fc25
    mesa-13.0.3-7.fc25

All karma has been reset.
```
?

Of course don't add the note when just the update is edited, but builds are not changed (e.g. just the description is updated, or linked bug reports, etc) - that does not reset karma.


Discussion:
I like the idea.

Resolving patch:
diff --git a/bodhi/server/models.py b/bodhi/server/models.py
--- a/bodhi/server/models.py
+++ b/bodhi/server/models.py
@@ -962,6 +962,8 @@ def edit(cls, request, data):
             comment += '\n\nRemoved build(s):\n'
             for removed_build in removed_builds:
                 comment += "\n- %s" % removed_build
+        if new_builds or removed_builds:
+            comment += '\n\nKarma has been reset.'
         up.comment(db, comment, karma=0, author=u'bodhi')
         caveats.append({'name': 'builds', 'description': comment})
 


Test patch:
diff --git a/bodhi/tests/server/services/test_updates.py b/bodhi/tests/server/services/test_updates.py
--- a/bodhi/tests/server/services/test_updates.py
+++ b/bodhi/tests/server/services/test_updates.py
@@ -1639,6 +1639,8 @@ def test_edit_update(self, publish, *args):
         Removed build(s):
 
         - bodhi-2.0.0-2.fc17
+
+        Karma has been reset.
         """).strip()
         self.assertMultiLineEqual(up['comments'][-1]['text'], comment)
         self.assertEquals(len(up['builds']), 1)
@@ -1680,6 +1682,8 @@ def test_edit_testing_update_with_new_builds(self, publish, *args):
         Removed build(s):
 
         - bodhi-2.0.0-2.fc17
+
+        Karma has been reset.
         """).strip()
         self.assertMultiLineEqual(up['comments'][-2]['text'], comment)
         self.assertEquals(up['comments'][-3]['text'],
@@ -1723,6 +1727,8 @@ def test_edit_testing_update_with_new_builds_with_stable_request(self, publish,
         Removed build(s):
 
         - bodhi-2.0.0-2.fc17
+
+        Karma has been reset.
         """).strip()
         self.assertMultiLineEqual(up['comments'][-2]['text'], comment)
         self.assertEquals(up['comments'][-3]['text'],
Repository: fedora-infra/bodhi

Issue:
[UI/UX] *Add Comment* button should be just below the Comment section of Updates
The *Add Comment* looks odd down there. It should be just below the *Solution* field.
For instance: https://bodhi.fedoraproject.org/updates/FEDORA-2017-78a478cd32 

![screenshot from 2017-01-11 17-25-51](https://cloud.githubusercontent.com/assets/13337039/21847731/68a75016-d823-11e6-839d-3f4cc209ba81.jpg)



Discussion:
@trishnaguha I would like to work on this, could you please tell me how to start. 
You will need to look into https://github.com/fedora-infra/bodhi/blob/develop/bodhi/server/templates/update.html
@trishnaguha It would be nice if I just put the  Add comment on the right-side just below the solution field.
@trishnaguha can you assign me this issue.

Resolving patch:
diff --git a/bodhi/server/util.py b/bodhi/server/util.py
--- a/bodhi/server/util.py
+++ b/bodhi/server/util.py
@@ -101,6 +101,11 @@ def get_nvr(nvr):
     return ('-'.join(x[:-2]), x[-2], x[-1])
 
 
+def packagename_from_nvr(context, nvr):
+    x = map(unicode, nvr.split('-'))
+    return '-'.join(x[:-2])
+
+
 def mkmetadatadir(path):
     """
     Generate package metadata for a given directory; if it doesn't exist, then
@@ -416,6 +421,25 @@ def type2html(context, kind):
     return "<span class='label label-%s'>%s</span>" % (cls, kind)
 
 
+def type2icon(context, kind):
+    kind = unicode(kind)
+    cls = {
+        'security': 'danger',
+        'bugfix': 'warning',
+        'newpackage': 'primary',
+        'enhancement': 'success',
+    }.get(kind)
+
+    fontawesome = {
+        'security': 'fa-shield',
+        'bugfix': 'fa-bug',
+        'newpackage': 'fa-archive',
+        'enhancement': 'fa-bolt',
+    }.get(kind)
+
+    return "<span class='label label-%s'><i class='fa %s'></i></span>" % (cls, fontawesome)
+
+
 def severity2html(context, severity):
     severity = unicode(severity)
     cls = {


Test patch:
Repository: fedora-infra/bodhi

Issue:
The docs on readthedocs are missing the Python bindings
Our RTD page is missing the Python bindings:

http://bodhi.readthedocs.io/en/latest/python_bindings.html

Very likely this is due to our ```docs/conf.py``` file not injecting the root of our repo into sys.path.


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -11,12 +11,14 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 import datetime
+import os
+import sys
 
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
-# sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
 
 # -- General configuration -----------------------------------------------------
 
@@ -92,7 +94,7 @@
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'default'
+html_theme = 'alabaster'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the


Test patch:
Repository: fedora-infra/bodhi

Issue:
There are multiple alembic heads on the develop branch
The migrations can't be applied on the develop branch because there are multiple alembic heads:

```
[vagrant@bodhi-dev bodhi]$ alembic upgrade head
/usr/lib64/python2.7/pkgutil.py:186: ImportWarning: Not importing directory '/usr/lib64/python2.7/site-packages/zope': missing __init__.py
  file, filename, etc = imp.find_module(subname, path)
/usr/lib64/python2.7/pkgutil.py:186: ImportWarning: Not importing directory '/usr/lib/python2.7/site-packages/zope': missing __init__.py
  file, filename, etc = imp.find_module(subname, path)
/usr/lib64/python2.7/pkgutil.py:186: ImportWarning: Not importing directory '/usr/lib/python2.7/site-packages/paste': missing __init__.py
  file, filename, etc = imp.find_module(subname, path)
/usr/lib64/python2.7/pkgutil.py:186: ImportWarning: Not importing directory '/usr/lib/python2.7/site-packages/moksha': missing __init__.py
  file, filename, etc = imp.find_module(subname, path)
/usr/lib64/python2.7/pkgutil.py:186: ImportWarning: Not importing directory '/usr/lib/python2.7/site-packages/repoze': missing __init__.py
  file, filename, etc = imp.find_module(subname, path)
/home/vagrant/bodhi/bodhi/server/__init__.py:26: DeprecationWarning: unauthenticated_userid: As of Pyramid 1.5 the "pyramid.security.unauthenticated_userid" API is now deprecated.  It will be removed in Pyramd 1.8.  Use the "unauthenticated_userid" attribute of the Pyramid request instead.
  from pyramid.security import unauthenticated_userid
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
ERROR [alembic.util.messaging] Multiple head revisions are present for given argument 'head'; please specify a specific target revision, '<branchname>@head' to narrow to a specific head, or 'heads' for all heads
  FAILED: Multiple head revisions are present for given argument 'head'; please specify a specific target revision,
  '<branchname>@head' to narrow to a specific head, or 'heads' for all heads
```


Discussion:

Resolving patch:
diff --git a/alembic/versions/9241378c92ab_convert_the_builds_table_to_be_.py b/alembic/versions/9241378c92ab_convert_the_builds_table_to_be_.py
--- a/alembic/versions/9241378c92ab_convert_the_builds_table_to_be_.py
+++ b/alembic/versions/9241378c92ab_convert_the_builds_table_to_be_.py
@@ -1,7 +1,7 @@
 """Convert the builds table to be polymorphic.
 
 Revision ID: 9241378c92ab
-Revises: fc6b0169c596
+Revises: 12d3e8695f90
 Create Date: 2017-04-06 20:37:24.766366
 """
 from alembic import op
@@ -10,7 +10,7 @@
 
 # revision identifiers, used by Alembic.
 revision = '9241378c92ab'
-down_revision = 'fc6b0169c596'
+down_revision = '12d3e8695f90'
 
 
 def upgrade():


Test patch:
Repository: fedora-infra/bodhi

Issue:
Split the BuildrootOverride model into two, if needed
We may need to split the BuiltrootOverride model into two models, a superclass (probably still called BuildrootOverride) and a new RPM-specific subclass, perhaps simply called RPMBuildrootOverride.

Whether we do this depends on whether modules need BuildrootOverrides, as I do not believe containers or flatpaks need them.

If we do need them, all of BuildrootOverride's relationships should be analyzed to determine which ones should be adjusted to reference RPM vs. continuing to reference BuildrootOverride. Also, a database migration will be needed so that Bodhi's existing data can be preserved in the new split BuildrootOverride design. All code will need to be altered to use the new RPM model rather than the BuildrootOverride model when the data involved is RPM-specific.

Once this is done, all of Bodhi's functionality should continue to work exactly as it does today.


Discussion:
### BuildrootOverride Fields

* Notes (a text field)
* Submission date
* Expiration date
* Expired date

None of these seem specific to RPM buildroot overrides

### BuildrootOverrides Relationships

* A build
* A submitter (user)

Using the build type, we can determine what type of override it is. There are two methods of interest on the model, ``enable`` and ``expire``. If we want to have custom implementations of these it _might_ make sense to make a superclass/subclass, but neither one looks complicated or RPM specific.

Based on this, my vote is to document this model and move on without changes.

Resolving patch:
diff --git a/bodhi/server/models.py b/bodhi/server/models.py
--- a/bodhi/server/models.py
+++ b/bodhi/server/models.py
@@ -2496,6 +2496,24 @@ class Group(Base):
 
 
 class BuildrootOverride(Base):
+    """
+    This model represents a Koji buildroot override.
+
+    A buildroot override is a way to add a build to the Koji buildroot (the set of packages used
+    to build a package) manually. Normally, builds are only available after they are pushed to
+    "stable", but this allows a build to be added to the buildroot immediately. This is useful
+    for updates that depend on each other to be built.
+
+    Attributes:
+        notes (unicode): A text field that holds arbitrary notes about the buildroot override.
+        submission_date (DateTime): The date that the buildroot override was submitted.
+        expiration_date (DateTime): The date that the buildroot override expires.
+        expired_date (DateTime): The date that the buildroot override expired.
+        build_id (int): The primary key of the :class:`Build` this override is related to.
+        build (Build): The :class:`Build` object this override is related to.
+        submitter_id (int): The primary key of the :class:`User` this override was created by.
+        submitter (User): The :class:`User` this override was created by.
+    """
     __tablename__ = 'buildroot_overrides'
     __include_extras__ = ('nvr',)
     __get_by__ = ('build_id',)


Test patch:
Repository: fedora-infra/bodhi

Issue:
The type icons aren't the same width
I was noticing after working on https://github.com/fedora-infra/bodhi/pull/1504 that the type icons aren't the same width, which causes the bodhi builds below to be unaligned:

![delme](https://cloud.githubusercontent.com/assets/354506/25731465/9ac1811c-3114-11e7-8d8b-8878ac96f8ad.png)

If we can get those icons to be a uniform width, the page would look more uniform.


Discussion:

Resolving patch:
diff --git a/bodhi/server/util.py b/bodhi/server/util.py
--- a/bodhi/server/util.py
+++ b/bodhi/server/util.py
@@ -435,7 +435,7 @@ def type2icon(context, kind):
     }.get(kind)
 
     return "<span class='label label-%s' data-toggle='tooltip'\
-            title='This is a %s update'><i class='fa %s'></i></span> \
+            title='This is a %s update'><i class='fa fa-fw %s'></i></span> \
             " % (cls, kind, fontawesome)
 
 


Test patch:
Repository: fedora-infra/bodhi

Issue:
Edit Form accessable by anyone
Currently, anyone can access the edit page for an update. It is viewable even if not logged in, or if you are logged in and not in the edit ACLs for the update.

https://bodhi.fedoraproject.org/updates/FEDORA-2017-8733e65d13/edit

It is not a huge issue, as it does not let you save the changes to the update, but we really shouldnt show the update edit form to people that don't have access.


Discussion:

Resolving patch:
diff --git a/bodhi/server/services/updates.py b/bodhi/server/services/updates.py
--- a/bodhi/server/services/updates.py
+++ b/bodhi/server/services/updates.py
@@ -89,7 +89,11 @@ def get_update(request):
 
 
 @update_edit.get(accept="text/html", renderer="new_update.html",
-                 error_handler=bodhi.server.services.errors.html_handler)
+                 error_handler=bodhi.server.services.errors.html_handler,
+                 permission='edit',
+                 validators=(
+                     validate_acls,
+                 ))
 def get_update_for_editing(request):
     """Return a single update from an id, title, or alias for the edit form"""
     return dict(


Test patch:
diff --git a/bodhi/tests/server/services/test_updates.py b/bodhi/tests/server/services/test_updates.py
--- a/bodhi/tests/server/services/test_updates.py
+++ b/bodhi/tests/server/services/test_updates.py
@@ -446,6 +446,38 @@ def test_obsoletion_with_exception(self, *args):
         self.assertEquals(up.comments[-1].text, expected_comment)
 
 
+class TestEditUpdateForm(bodhi.tests.server.functional.base.BaseWSGICase):
+
+    def test_edit_with_permission(self):
+        """
+        Test a logged in User with permissions on the update can see the form
+        """
+        resp = self.app.get('/updates/FEDORA-2017-a3bbe1a8f2/edit')
+        self.assertIn('Editing an update requires JavaScript', resp)
+
+    def test_edit_without_permission(self):
+        """
+        Test a logged in User without permissions on the update can't see the form
+        """
+        app = TestApp(main({}, testing=u'anonymous', session=self.db, **self.app_settings))
+        resp = app.get('/updates/FEDORA-2017-a3bbe1a8f2/edit', status=400)
+        self.assertIn('anonymous does not have commit access to bodhi', resp)
+
+    def test_edit_not_loggedin(self):
+        """
+        Test a non logged in User can't see the form
+        """
+        anonymous_settings = copy.copy(self.app_settings)
+        anonymous_settings.update({
+            'authtkt.secret': 'whatever',
+            'authtkt.secure': True,
+        })
+        app = TestApp(main({}, session=self.db, **anonymous_settings))
+        resp = app.get('/updates/FEDORA-2017-a3bbe1a8f2/edit', status=403)
+        self.assertIn('<h1>403 <small>Forbidden</small></h1>', resp)
+        self.assertIn('<p class="lead">Access was denied to this resource.</p>', resp)
+
+
 class TestUpdatesService(bodhi.tests.server.functional.base.BaseWSGICase):
 
     def test_home_html(self):
Repository: fedora-infra/bodhi

Issue:
feature request - multiline blockquote using triple tick marks
it would be good if we can get multiline blockquotes in bodhi comments by using triple tick marks.

    ```
    like this
    ```

Here is an example where it line wraps the triple tick marks: https://bodhi.fedoraproject.org/updates/atomic-1.17.1-4.fc25#comment-605115




Discussion:

Resolving patch:
diff --git a/bodhi/server/util.py b/bodhi/server/util.py
--- a/bodhi/server/util.py
+++ b/bodhi/server/util.py
@@ -327,7 +327,8 @@ def hostname(context=None):
 
 def markup(context, text):
     return markdown.markdown(text, safe_mode="replace",
-                             html_replacement_text="--RAW HTML NOT ALLOWED--")
+                             html_replacement_text="--RAW HTML NOT ALLOWED--",
+                             extensions=['markdown.extensions.fenced_code'])
 
 
 def status2html(context, status):


Test patch:
diff --git a/bodhi/tests/server/functional/test_generic.py b/bodhi/tests/server/functional/test_generic.py
--- a/bodhi/tests/server/functional/test_generic.py
+++ b/bodhi/tests/server/functional/test_generic.py
@@ -202,6 +202,17 @@ def test_markdown_with_unknown_prefixed_bugzilla(self):
             "</div>"
         )
 
+    def test_markdown_with_fenced_code_block(self):
+        res = self.app.get('/markdown', {
+            'text': '```\nsudo dnf install bodhi\n```',
+        }, status=200)
+        self.assertEquals(
+            res.json_body['html'],
+            "<div class='markdown'>"
+            '<pre><code>sudo dnf install bodhi\n</code></pre>\n'
+            "</div>"
+        )
+
     def test_metrics(self):
         res = self.app.get('/metrics')
         self.assertIn('$.plot', res)