Skip to content

Commit

Permalink
Merge branch 'master' into nine
Browse files Browse the repository at this point in the history
Conflicts:
	master/buildbot/process/builder.py
	master/buildbot/test/unit/test_status_web_statuspng.py
  • Loading branch information
djmitche committed Oct 14, 2013
2 parents f8359f6 + b374882 commit b8cecfe
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 21 deletions.
2 changes: 0 additions & 2 deletions common/pylintrc
Expand Up @@ -90,8 +90,6 @@ disable=
C0324,
C1001,
E0202,
E0211,
E0213,
E0611,
E1002,
E1101,
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/buildslave/base.py
Expand Up @@ -28,7 +28,7 @@
from buildbot.process import metrics
from buildbot.interfaces import IBuildSlave, ILatentBuildSlave
from buildbot.process.properties import Properties
from buildbot.util import subscription, ascii2unicode
from buildbot.util import ascii2unicode
from buildbot.util.eventual import eventually
from buildbot import config

Expand Down
7 changes: 4 additions & 3 deletions master/buildbot/interfaces.py
Expand Up @@ -17,9 +17,10 @@
Define the interfaces that are implemented by various buildbot classes.
"""
# E0211: Method has no argument
# E0213: Method should have "self" as first argument
# pylint: disable-msg=E0211,E0213

# disable pylint warnings triggered by interface definitions
# pylint: disable=no-self-argument
# pylint: disable=no-method-argument

from zope.interface import Interface, Attribute

Expand Down
8 changes: 8 additions & 0 deletions master/buildbot/monkeypatches/__init__.py
Expand Up @@ -75,6 +75,13 @@ def patch_testcase_assert_raises_regexp():
from buildbot.monkeypatches import testcase_assert
testcase_assert.patch()

def patch_python14653():
# this bug was fixed in Python 2.7.4: http://bugs.python.org/issue14653
import sys
if sys.version_info[:3] < (2, 7, 4):
from buildbot.monkeypatches import python14653
python14653.patch()

def patch_all(for_tests=False):
if for_tests:
from buildbot.monkeypatches import servicechecks
Expand All @@ -95,3 +102,4 @@ def patch_all(for_tests=False):
patch_sqlalchemy2364()
patch_sqlalchemy2189()
patch_gatherResults()
patch_python14653()
32 changes: 32 additions & 0 deletions master/buildbot/monkeypatches/python14653.py
@@ -0,0 +1,32 @@
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members

import calendar
import time

def fixed_mktime_tz(data):
if data[9] is None:
# No zone info, so localtime is better assumption than GMT
return time.mktime(data[:8] + (-1,))
else:
t = calendar.timegm(data)
return t - data[9]

def patch():
# Fix for http://bugs.python.org/issue14653 for Python 2.7.3 and below.
# Required to fix http://trac.buildbot.net/ticket/2522 issue

import email.utils
email.utils.mktime_tz = fixed_mktime_tz
4 changes: 2 additions & 2 deletions master/buildbot/monkeypatches/servicechecks.py
Expand Up @@ -25,10 +25,10 @@ def patch_servicechecks():
old_startService = Service.startService
old_stopService = Service.stopService
def startService(self):
assert not self.running
assert not self.running, "%r already running" % (self,)
return old_startService(self)
def stopService(self):
assert self.running
assert self.running, "%r already stopped" % (self,)
return old_stopService(self)
Service.startService = startService
Service.stopService = stopService
7 changes: 7 additions & 0 deletions master/buildbot/process/builder.py
Expand Up @@ -109,6 +109,13 @@ def reconfigService(self, new_config):
self.builder_status.setSlavenames(self.config.slavenames)
self.builder_status.setCacheSize(new_config.caches['Builds'])

# if we have any slavebuilders attached which are no longer configured,
# drop them.
new_slavenames = set(builder_config.slavenames)
self.slaves = [ s for s in self.slaves
if s.slave.slavename in new_slavenames ]


def __repr__(self):
return "<Builder '%r' at %d>" % (self.name, id(self))

Expand Down
5 changes: 5 additions & 0 deletions master/buildbot/status/persistent_queue.py
Expand Up @@ -35,6 +35,11 @@ def WriteFile(path, buf):

class IQueue(Interface):
"""Abstraction of a queue."""

# disable pylint warnings triggered by this interface definition
# pylint: disable=no-self-argument
# pylint: disable=no-method-argument

def pushItem(item):
"""Adds an individual item to the end of the queue.
Expand Down
21 changes: 16 additions & 5 deletions master/buildbot/test/unit/test_steps_source_svn.py
Expand Up @@ -1730,6 +1730,22 @@ def test_rmdir_fails_purge(self):
self.expectOutcome(result=FAILURE, status_text=["updating"])
return self.runStep()


#
# svn.SVN.svnUriCanonicalize() test method factory
#
# given input string and expected result create a test method that
# will call svn.SVN.svnUriCanonicalize() with the input and check
# that expected result is returned
#
# @param input: test input
# @param exp: expected result
#
def _makeSUCTest(input, exp):
return lambda self: self.assertEqual(
svn.SVN.svnUriCanonicalize(input), exp)


class TestGetUnversionedFiles(unittest.TestCase):
def test_getUnversionedFiles_does_not_list_externals(self):
svn_st_xml = """<?xml version="1.0"?>
Expand Down Expand Up @@ -1815,11 +1831,6 @@ def test_getUnversionedFiles_no_item(self):
unversioned_files = list(svn.SVN.getUnversionedFiles(svn_st_xml, []))
self.assertEquals(["svn_external_path/unversioned_file"], unversioned_files)


def _makeSUCTest(input, exp):
return lambda self : self.assertEqual(
svn.SVN.svnUriCanonicalize(input), exp)

test_svnUriCanonicalize_empty = _makeSUCTest(
"", "")
test_svnUriCanonicalize_canonical = _makeSUCTest(
Expand Down
30 changes: 22 additions & 8 deletions master/contrib/post_build_request.py
@@ -1,6 +1,22 @@
#!/usr/bin/env python

# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Portions Copyright Buildbot Team Members
# Portions Copyright 2013 OpenGamma Inc. and the OpenGamma group of companies

import httplib, urllib
import getopt
import optparse
import textwrap
import getpass
Expand All @@ -11,6 +27,7 @@
# http://lists.debian.org/debian-python/2010/02/msg00016.html
try:
import json # python 2.6
assert json # silence pyflakes
except ImportError:
import simplejson as json # python 2.4 to 2.5
try:
Expand Down Expand Up @@ -163,8 +180,8 @@ def propertyCB(option, opt, value, parser):
"""))
parser.add_option("-v", "--verbose", dest='verbosity', action="count",
help=textwrap.dedent("""\
Print more detail. If specified once, show status. If secified twice,
print all data returned. Normally this will be the json version of the Change.
Print more detail. Shows the response status and reason received from the master. If
specified twice, it also shows the raw response.
"""))
parser.add_option("-H", "--host", dest='host', metavar="HOST",
default='localhost:8010',
Expand Down Expand Up @@ -210,15 +227,12 @@ def propertyCB(option, opt, value, parser):
response = conn.getresponse()
data = response.read()
exitCode=0
if response.status is not 200:
if response.status is not 202:
exitCode=1
if options.verbosity >= 1:
print response.status, response.reason
if response.status is 200:
res =json.loads(data)
print "Request %d at %s" % (res[0]['number'], res[0]['at'])
if options.verbosity >= 2:
print "Raw response %s" % (data)
print "Raw response: %s" % (data)
conn.close()
os._exit(exitCode)

3 changes: 3 additions & 0 deletions slave/buildslave/interfaces.py
Expand Up @@ -13,6 +13,9 @@
#
# Copyright Buildbot Team Members

# disable pylint warnings triggered by interface definitions
# pylint: disable=no-self-argument
# pylint: disable=no-method-argument

from zope.interface import Interface

Expand Down

0 comments on commit b8cecfe

Please sign in to comment.