internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: buildbot/buildbot

Issue:
Replace execfile() with exec()
execfile() is gone in Python 3.
See:
http://python3porting.com/differences.html#execfile



Discussion:

Resolving patch:
diff --git a/master/buildbot/process/build.py b/master/buildbot/process/build.py
--- a/master/buildbot/process/build.py
+++ b/master/buildbot/process/build.py
@@ -263,7 +263,7 @@ def _release_slave(res, slave, bs):
             self.builder.builder_status.addPointEvent(["setupBuild",
                                                        "exception"])
             self.finished = True
-            self.results = FAILURE
+            self.results = EXCEPTION
             self.deferred = None
             d.callback(self)
             return d
diff --git a/master/buildbot/process/builder.py b/master/buildbot/process/builder.py
--- a/master/buildbot/process/builder.py
+++ b/master/buildbot/process/builder.py
@@ -368,6 +368,18 @@ def run_cleanups():
             defer.returnValue(False)
             return
 
+        # IMPORTANT: no yielding is allowed from here to the startBuild call!
+
+        # it's possible that we lost the slave remote between the ping above
+        # and now.  If so, bail out.  The build.startBuild call below transfers
+        # responsibility for monitoring this connection to the Build instance,
+        # so this check ensures we hand off a working connection.
+        if not slavebuilder.remote:
+            log.msg("slave disappeared before build could start")
+            run_cleanups()
+            defer.returnValue(False)
+            return
+
         # let status know
         self.master.status.build_started(req.id, self.name, bs)
 
@@ -376,11 +388,14 @@ def run_cleanups():
         # (through our BuilderStatus object, which is its parent).  Finally it
         # will start the actual build process.  This is done with a fresh
         # Deferred since _startBuildFor should not wait until the build is
-        # finished.
-        d = build.startBuild(bs, self.expectations, slavebuilder)
+        # finished.  This uses `maybeDeferred` to ensure that any exceptions
+        # raised by startBuild are treated as deferred errbacks.
+        d = defer.maybeDeferred(build.startBuild,
+                bs, self.expectations, slavebuilder)
         d.addCallback(self.buildFinished, slavebuilder, bids)
         # this shouldn't happen. if it does, the slave will be wedged
-        d.addErrback(log.err)
+        d.addErrback(log.err, 'from a running build; this is a '
+            'serious error - please file a bug at http://buildbot.net')
 
         # make sure the builder's status is represented correctly
         self.updateBigStatus()


Test patch:
Repository: buildbot/buildbot

Issue:
use local path for postgres dir to work outside of linux hosts also.
OSX with docker 1.12.0-a reports:

```
docker: Error response from daemon: Mounts denied:
The path /var/lib/buildbot_db
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.
```

This PR moves the postgres dir mountpoint to the <pwd>/buildbot_db as that should always be permitted.



Discussion:

Resolving patch:
diff --git a/master/buildbot/status/web/build.py b/master/buildbot/status/web/build.py
--- a/master/buildbot/status/web/build.py
+++ b/master/buildbot/status/web/build.py
@@ -247,12 +247,9 @@ def content(self, req, cxt):
             now = util.now()
             cxt['elapsed'] = util.formatInterval(now - start)
             
-        exactly = True
         has_changes = False
         for ss in sourcestamps:
-            exactly = exactly and (ss.revision is not None)
             has_changes = has_changes or ss.changes
-        cxt['exactly'] = (exactly) or b.getChanges()
         cxt['has_changes'] = has_changes
         cxt['build_url'] = path_to_build(req, b)
         cxt['authz'] = self.getAuthz(req)


Test patch:
Repository: buildbot/buildbot

Issue:
Add a backport of `SynchronousTestCasa`
This actually just makes `TestCase` pretend to be `SynchronousTestCase` currently, since the difference is mostly just that `SynchronousTestCase` does less. (There is also some stuff that was add to `SynchronousTestCase` that makes synchronous testing easier, but on versions with that code `TestCase` inherits from it).

This incidentally bumps the minimum version of twisted required for the worker to 10.2.0, which is 5y 12mo old, and is the old version that we tested against that supports deferred cancellation, which was used in #2464. (It was introduced in 10.1.0, bu that that wasn't in our test matrix, and 10.2.0 is plenty old enough).



Discussion:

Resolving patch:
diff --git a/master/buildbot/util/maildir.py b/master/buildbot/util/maildir.py
--- a/master/buildbot/util/maildir.py
+++ b/master/buildbot/util/maildir.py
@@ -41,6 +41,7 @@ def __init__(self, basedir=None):
             self.setBasedir(basedir)
         self.files = []
         self.dnotify = None
+        self.timerService = None
 
     def setBasedir(self, basedir):
         # some users of MaildirService (scheduler.Try_Jobdir, in particular)
@@ -68,10 +69,11 @@ def startService(self):
             # because of a python bug
             log.msg("DNotify failed, falling back to polling")
         if not self.dnotify:
-            t = internet.TimerService(self.pollinterval, self.poll)
-            t.setServiceParent(self)
-        self.poll()
-
+            self.timerService = internet.TimerService(self.pollinterval, self.poll)
+            self.timerService.setServiceParent(self)
+        self.poll()  
+           
+        
     def dnotify_callback(self):
         log.msg("dnotify noticed something, now polling")
 
@@ -91,6 +93,9 @@ def stopService(self):
         if self.dnotify:
             self.dnotify.remove()
             self.dnotify = None
+        if self.timerService is not None:
+            self.timerService.disownServiceParent() 
+            self.timerService = None
         return service.MultiService.stopService(self)
 
     @defer.inlineCallbacks


Test patch:
diff --git a/master/buildbot/test/unit/test_util_maildir.py b/master/buildbot/test/unit/test_util_maildir.py
--- a/master/buildbot/test/unit/test_util_maildir.py
+++ b/master/buildbot/test/unit/test_util_maildir.py
@@ -37,6 +37,16 @@ def tearDown(self):
         self.tearDownDirs()
 
     # tests
+    
+    @defer.inlineCallbacks
+    def test_start_stop_repeatedly(self):
+        self.svc = maildir.MaildirService(self.maildir)
+        self.svc.startService()
+        yield self.svc.stopService()
+        self.svc.startService()
+        yield self.svc.stopService()
+        self.assertLess(len(list(self.svc)), 2)
+      
 
     def test_messageReceived(self):
         self.svc = maildir.MaildirService(self.maildir)
Repository: buildbot/buildbot

Issue:
cfg-www.rst: Fix some indentation.



Discussion:

Resolving patch:
diff --git a/master/buildbot/steps/shell.py b/master/buildbot/steps/shell.py
--- a/master/buildbot/steps/shell.py
+++ b/master/buildbot/steps/shell.py
@@ -68,7 +68,8 @@ class ShellCommand(buildstep.LoggingBuildStep):
     name = "shell"
     renderables = buildstep.LoggingBuildStep.renderables + [
                    'slaveEnvironment', 'remote_kwargs', 'command',
-                   'description', 'descriptionDone', 'descriptionSuffix']
+                   'description', 'descriptionDone', 'descriptionSuffix',
+                   'haltOnFailure', 'flunkOnFailure']
 
     description = None # set this to a list of short strings to override
     descriptionDone = None # alternate description when the step is complete


Test patch:
Repository: buildbot/buildbot

Issue:
Replace xrange() with range() for Python 3 compatibility
xrange() is gone in Python 3.
In Python 3, range() returns a view, not a list,
so in a few places where we really need a list, we
need to wrap it with list().

See:
http://python3porting.com/differences.html#range-and-xrange



Discussion:

Resolving patch:
diff --git a/master/buildbot/process/buildstep.py b/master/buildbot/process/buildstep.py
--- a/master/buildbot/process/buildstep.py
+++ b/master/buildbot/process/buildstep.py
@@ -785,6 +785,7 @@ def addURL(self, name, url):
         self.step_status.addURL(name, url)
 
     def runCommand(self, c):
+        self.cmd = c
         c.buildslave = self.buildslave
         d = c.run(self, self.remote)
         return d


Test patch:
diff --git a/master/buildbot/test/unit/test_process_buildstep.py b/master/buildbot/test/unit/test_process_buildstep.py
--- a/master/buildbot/test/unit/test_process_buildstep.py
+++ b/master/buildbot/test/unit/test_process_buildstep.py
@@ -21,7 +21,7 @@
 from buildbot.process import buildstep
 from buildbot.process.buildstep import regex_log_evaluator
 from buildbot.status.results import FAILURE, SUCCESS, WARNINGS, EXCEPTION
-from buildbot.test.fake import fakebuild, remotecommand
+from buildbot.test.fake import fakebuild, remotecommand, slave
 from buildbot.test.util import config, steps, compat
 from buildbot.util.eventual import eventually
 
@@ -138,6 +138,15 @@ def test_setProperty(self):
         bs.setProperty("x", "abc", "test", runtime=True)
         props.setProperty.assert_called_with("x", "abc", "test", runtime=True)
 
+    def test_runCommand(self):
+        bs = buildstep.BuildStep()
+        bs.buildslave = slave.FakeSlave()
+        bs.remote = 'dummy'
+        cmd = buildstep.RemoteShellCommand("build", ["echo", "hello"], user=None)
+        cmd.run = lambda self, remote : SUCCESS
+        bs.runCommand(cmd)
+        self.assertEqual(bs.cmd, cmd)
+
     def test_hideStepIf_False(self):
         self._setupWaterfallTest(False, False)
         return self.runStep()
Repository: buildbot/buildbot

Issue:
cfg-www.rst: Fix some indentation.

cfg-www.rst: Fix some indentation.



Discussion:

Resolving patch:
diff --git a/master/buildbot/process/buildstep.py b/master/buildbot/process/buildstep.py
--- a/master/buildbot/process/buildstep.py
+++ b/master/buildbot/process/buildstep.py
@@ -442,6 +442,17 @@ class BuildStep(object, properties.PropertiesMixin):
     # properties set on a build step are, by nature, always runtime properties
     set_runtime_properties = True
 
+    renderables = [
+            'haltOnFailure',
+            'flunkOnWarnings',
+            'flunkOnFailure',
+            'warnOnWarnings',
+            'warnOnFailure',
+            'alwaysRun',
+            'doStepIf',
+            'hideStepIf',
+    ]
+
     # 'parms' holds a list of all the parameters we care about, to allow
     # users to instantiate a subclass of BuildStep with a mixture of
     # arguments, some of which are for us, some of which are for the subclass


Test patch:
diff --git a/master/buildbot/test/unit/test_process_buildstep.py b/master/buildbot/test/unit/test_process_buildstep.py
--- a/master/buildbot/test/unit/test_process_buildstep.py
+++ b/master/buildbot/test/unit/test_process_buildstep.py
@@ -18,7 +18,7 @@
 from twisted.trial import unittest
 from twisted.internet import defer
 from twisted.python import log
-from buildbot.process import buildstep
+from buildbot.process import buildstep, properties
 from buildbot.process.buildstep import regex_log_evaluator
 from buildbot.status.results import FAILURE, SUCCESS, WARNINGS, EXCEPTION
 from buildbot.test.fake import fakebuild, remotecommand, slave
@@ -244,6 +244,14 @@ def test_describe_suffix(self):
         self.assertEqual(step2.describe(done=True),
                          [step2.name] + descriptionSuffix)
 
+    @defer.inlineCallbacks
+    def test_step_renders_flunkOnFailure(self):
+        self.setupStep(TestBuildStep.FakeBuildStep(flunkOnFailure=properties.Property('fOF')))
+        self.properties.setProperty('fOF', 'yes', 'test')
+        self.expectOutcome(result=SUCCESS, status_text=["generic"])
+        yield self.runStep()
+        self.assertEqual(self.step.flunkOnFailure, 'yes')
+
 class TestLoggingBuildStep(unittest.TestCase):
 
     def makeRemoteCommand(self, rc, stdout, stderr=''):
@@ -293,7 +301,7 @@ def setUp(self):
     def tearDown(self):
         return self.tearDownBuildStep()
 
-    def test_step_raining_buildstepfailed_in_start(self):
+    def test_step_raising_buildstepfailed_in_start(self):
         self.setupStep(FailingCustomStep())
         self.expectOutcome(result=FAILURE, status_text=["generic"])
         return self.runStep()
Repository: buildbot/buildbot

Issue:
Remove googlecode
This fixes the following test on Python 3:

```
trial buildbot.test.unit.test_www_hooks_googlecode
```


Discussion:

Resolving patch:
diff --git a/master/buildbot/status/web/waterfall.py b/master/buildbot/status/web/waterfall.py
--- a/master/buildbot/status/web/waterfall.py
+++ b/master/buildbot/status/web/waterfall.py
@@ -854,4 +854,4 @@ def phase2(self, request, sourceNames, timestamps, eventGrid,
                 if strip[i]:
                     strip[i] = strip[i].td()
 
-        return dict(grid=grid, gridlen=gridlen, no_bubble=noBubble, time=lastDate)
+        return dict(grid=grid, gridlen=gridlen, no_bubble=noBubble)


Test patch:
Repository: buildbot/buildbot

Issue:
fixed availabale typo



Discussion:

Resolving patch:
diff --git a/master/buildbot/changes/hgpoller.py b/master/buildbot/changes/hgpoller.py
--- a/master/buildbot/changes/hgpoller.py
+++ b/master/buildbot/changes/hgpoller.py
@@ -48,7 +48,7 @@ def __init__(self, repourl, branch='default',
             pollInterval = pollinterval
 
         if name is None:
-            name = repourl
+            name = "%s[%s]" % (repourl, branch)
 
         self.repourl = repourl
         self.branch = branch


Test patch:
diff --git a/master/buildbot/test/unit/test_changes_hgpoller.py b/master/buildbot/test/unit/test_changes_hgpoller.py
--- a/master/buildbot/test/unit/test_changes_hgpoller.py
+++ b/master/buildbot/test/unit/test_changes_hgpoller.py
@@ -35,6 +35,7 @@ def setUp(self):
         self.setUpGetProcessOutput()
         d = self.setUpChangeSource()
         self.remote_repo = 'ssh://example.com/foo/baz'
+        self.branch = 'default'
         self.repo_ready = True
 
         def _isRepositoryReady():
@@ -71,7 +72,7 @@ def test_describe(self):
         self.assertSubstring("HgPoller", self.poller.describe())
 
     def test_name(self):
-        self.assertEqual(self.remote_repo, self.poller.name)
+        self.assertEqual("%s[%s]" % (self.remote_repo, self.branch), self.poller.name)
 
         # and one with explicit name...
         other = hgpoller.HgPoller(self.remote_repo, name="MyName", workdir='/some/dir')
Repository: buildbot/buildbot

Issue:
buildbot.tac do not allow 'print <string>' lines anymore
This ticket is a migrated Trac ticket [3318](http://trac.buildbot.net/ticket/3318)

People contributed to the original ticket: @rutsky, @unknown_contributor
Ticket created on: `Jul 21 2015`
Ticket last modified on: `Jan 31 2016`

---

Due to https://github.com/buildbot/buildbot/commit/201f0d9cbcffefb4062668c03ca95558f6a6b8c7

old style
'print <string>'
statements in buildbot.tac files

raise an exception when calling
% buildbot checkconfig

which breaks the backward compatibility


---

_Comment from_: @rutsky
_Date_: `Jan 31 2016`

I think this issue should be fixed in eight branch and in nine should have resolution "won't fix" with adding appropriate notice into the nine release notes (if it is not yet documented).




Discussion:

Resolving patch:
diff --git a/master/buildbot/changes/gitpoller.py b/master/buildbot/changes/gitpoller.py
--- a/master/buildbot/changes/gitpoller.py
+++ b/master/buildbot/changes/gitpoller.py
@@ -163,6 +163,7 @@ def poll(self):
                             [self.repourl] + refspecs, path=self.workdir)
 
         revs = {}
+        log.msg('gitpoller: processing changes from "%s"' % (self.repourl,))
         for branch in branches:
             try:
                 revs[branch] = rev = yield self._dovccmd(
@@ -256,8 +257,9 @@ def _process_changes(self, newRev, branch):
         revList.reverse()
         self.changeCount = len(revList)
 
-        log.msg('gitpoller: processing %d changes: %s from "%s"'
-                % (self.changeCount, revList, self.repourl))
+        if self.changeCount:
+            log.msg('gitpoller: processing %d changes: %s from "%s" branch "%s"'
+                    % (self.changeCount, revList, self.repourl, branch))
 
         for rev in revList:
             dl = defer.DeferredList([


Test patch:
Repository: buildbot/buildbot

Issue:
console view stuck in loading animation
When there are no change yet in the buildbot system, the console view get stuck in the loading animation.

This is a bug that is often found by new users which trigger their first build manually.

The problem is that the data-module does not have way to detect if the list is empty or if it is not yet loaded. Need a fix in the data-module to provide this information in the collection
collection.isLoaded should be a good solution.

The thing is the problem disapear as soon as you use the change source, so it is really a one time problem. But this gives new users a bad experience, so we should fix it.


Discussion:

Resolving patch:
diff --git a/master/setup.py b/master/setup.py
--- a/master/setup.py
+++ b/master/setup.py
@@ -383,12 +383,19 @@ def define_plugin_entries(groups):
         'sqlalchemy-migrate ==0.7.0, ==0.7.1, ==0.7.2',
         'python-dateutil==1.5',
     ]
-    setup_args['tests_require'] = [
-        'mock',
-    ]
+
+    setup_args['extras_require'] = {
+        'test': [
+            'mock',
+            'pep8',
+            'pylint==1.1.0',
+            'pyflakes',
+        ],
+    }
+
     if os.getenv('NO_INSTALL_REQS'):
         setup_args['install_requires'] = None
-        setup_args['tests_require'] = None
+        setup_args['extras_require'] = None
 
 setup(**setup_args)
 
diff --git a/slave/setup.py b/slave/setup.py
--- a/slave/setup.py
+++ b/slave/setup.py
@@ -134,11 +134,17 @@ def make_release_tree(self, base_dir, files):
             'twisted >= 8.0.0, <= 12.1.0',
             'zope.interface < 4.0.0',
         ]
-    setup_args['tests_require'] = [
-        'mock',
-    ]
+    setup_args['extras_require'] = {
+        'test': [
+            'mock',
+            'pep8',
+            'pylint==1.1.0',
+            'pyflakes',
+        ],
+    }
 
     if os.getenv('NO_INSTALL_REQS'):
         setup_args['install_requires'] = None
+        setup_args['extras_require'] = None
 
 setup(**setup_args)


Test patch:
Repository: buildbot/buildbot

Issue:
RETRY should be 5 and CANCELLED 6
Value 4 is duplicated, and as in the code RETRY should be 5 and CANCELLED 6

https://github.com/buildbot/buildbot/blob/858a282942fa5875bc6142b2970765d6196cb4de/www/md_base/src/app/common/common.constant.coffee#L14

https://github.com/buildbot/buildbot/blob/858a282942fa5875bc6142b2970765d6196cb4de/www/base/src/app/common/common.constant.coffee#L44

## Remove this paragraph
Please have a look at our developer documentation before submitting your Pull Request.

http://trac.buildbot.net/wiki/Development
And especially:
http://trac.buildbot.net/wiki/SubmittingPatches

## Contributor Checklist:

* [ ] I have updated the unit tests
* [ ] I have created a file in the master/buildbot/newsfragment directory (and read the README.txt in that directory)
* [ ] I have updated the appropriate documentation




Discussion:

Resolving patch:
diff --git a/master/buildbot/buildslave/manager.py b/master/buildbot/buildslave/manager.py
--- a/master/buildbot/buildslave/manager.py
+++ b/master/buildbot/buildslave/manager.py
@@ -18,8 +18,7 @@
 from buildbot.buildslave.protocols import pb as bbpb
 from buildbot.process import metrics
 from buildbot.util import misc
-from buildbot.util.service import ReconfigurableServiceMixin
-from twisted.application import service
+from buildbot.util import service
 from twisted.internet import defer
 from twisted.python import log
 from twisted.python import reflect
@@ -57,15 +56,15 @@ def getPBPort(self):
         return self.pbReg.getPort()
 
 
-class BuildslaveManager(ReconfigurableServiceMixin,
-                        service.MultiService):
+class BuildslaveManager(service.ReconfigurableServiceMixin,
+                        service.AsyncMultiService):
 
     name = "buildslaves"
     PING_TIMEOUT = 10
     reconfig_priority = 127
 
     def __init__(self, master):
-        service.MultiService.__init__(self)
+        service.AsyncMultiService.__init__(self)
         self.setName('buildslaves')
         self.master = master
 
@@ -91,8 +90,8 @@ def reconfigService(self, new_config):
         yield self.reconfigServiceSlaves(new_config)
 
         # reconfig any newly-added change sources, as well as existing
-        yield ReconfigurableServiceMixin.reconfigService(self,
-                                                         new_config)
+        yield service.ReconfigurableServiceMixin.reconfigService(self,
+                                                                 new_config)
 
     @defer.inlineCallbacks
     def reconfigServiceSlaves(self, new_config):


Test patch:
Repository: buildbot/buildbot

Issue:
use latest version of automat instead of trunk
trying to fix unit tests for 3.6


Discussion:

Resolving patch:
diff --git a/master/buildbot/steps/python_twisted.py b/master/buildbot/steps/python_twisted.py
--- a/master/buildbot/steps/python_twisted.py
+++ b/master/buildbot/steps/python_twisted.py
@@ -374,6 +374,9 @@ def __init__(self, reactor=UNSPECIFIED, python=None, trial=None,
         self.problems = ""
         self.warnings = {}
 
+        # text used before commandComplete runs
+        self.text = 'running'
+
     def setupEnvironment(self, cmd):
         ShellCommand.setupEnvironment(self, cmd)
         if self.testpath is not None:


Test patch:
Repository: buildbot/buildbot

Issue:
include missing secret providers module
fixes #3086


Discussion:

Resolving patch:
diff --git a/master/buildbot/www/service.py b/master/buildbot/www/service.py
--- a/master/buildbot/www/service.py
+++ b/master/buildbot/www/service.py
@@ -122,9 +122,14 @@ def setupSite(self, new_config):
 
         root = self.apps.get('base').resource
         for key, plugin in new_config.www.get('plugins', {}).items():
+            log.msg("initializing www plugin %r" % (key,))
             if key not in self.apps:
                 raise RuntimeError("could not find plugin %s; is it installed?" % (key,))
             root.putChild(key, self.apps.get(key).resource)
+        known_plugins = set(new_config.www.get('plugins', {})) | set(['base'])
+        for plugin_name in set(self.apps.names) - known_plugins:
+            log.msg("NOTE: www plugin %r is installed but not "
+                    "configured" % (plugin_name,))
 
         # /
         root.putChild('', wwwconfig.IndexResource(self.master, self.apps.get('base').static_dir))


Test patch:
Repository: buildbot/buildbot

Issue:
fix E741 on test_process_build
recent pep8 does not like l (the letter) as a variable because some fonts make it undistinguishable from 1 (the number).



Discussion:

Resolving patch:
diff --git a/master/buildbot/status/web/slaves.py b/master/buildbot/status/web/slaves.py
--- a/master/buildbot/status/web/slaves.py
+++ b/master/buildbot/status/web/slaves.py
@@ -114,8 +114,8 @@ def content(self, request, ctx):
                     current_builds.append(self.get_line_values(request, cb))
 
         try:
-            max_builds = int(request.args.get('numbuilds')[0])
-        except ValueError:
+            max_builds = int(request.args.get('numbuilds', ['10'])[0])
+        except (TypeError, ValueError):
             max_builds = 10
 
         recent_builds = []


Test patch: