6 from twisted
.internet
import reactor
7 from buildbot
.scripts
.reconfig
import LogWatcher
9 print "Following twistd.log until startup finished.."
10 lw
= LogWatcher("twistd.log")
12 d
.addCallbacks(self
._success
, self
._failure
)
16 def _success(self
, processtype
):
17 from twisted
.internet
import reactor
18 print "The %s appears to have (re)started correctly." % processtype
22 def _failure(self
, why
):
23 from twisted
.internet
import reactor
24 from buildbot
.scripts
.logwatcher
import BuildmasterTimeoutError
, \
25 ReconfigError
, BuildslaveTimeoutError
26 if why
.check(BuildmasterTimeoutError
):
28 The buildmaster took more than 5 seconds to start, so we were unable to
29 confirm that it started correctly. Please 'tail twistd.log' and look for a
30 line that says 'configuration update complete' to verify correct startup.
32 elif why
.check(BuildslaveTimeoutError
):
34 The buildslave took more than 5 seconds to start and/or connect to the
35 buildmaster, so we were unable to confirm that it started and connected
36 correctly. Please 'tail twistd.log' and look for a line that says 'message
37 from master: attached' to verify correct startup. If you see a bunch of
38 messages like 'will retry in 6 seconds', your buildslave might not have the
39 correct hostname or portnumber for the buildmaster, or the buildmaster might
40 not be running. If you see messages like
41 'Failure: twisted.cred.error.UnauthorizedLogin'
42 then your buildslave might be using the wrong botname or password. Please
43 correct these problems and then restart the buildslave.
45 elif why
.check(ReconfigError
):
47 The buildmaster appears to have encountered an error in the master.cfg config
48 file during startup. It is probably running with an empty configuration right
49 now. Please inspect and fix master.cfg, then restart the buildmaster.
51 elif why
.check(BuildSlaveDetectedError
):
53 Buildslave is starting up, not following logfile.
57 Unable to confirm that the buildmaster started correctly. You may need to
58 stop it, fix the config file, and restart.
66 os
.chdir(config
['basedir'])
70 # we probably can't do this os.fork under windows
71 from twisted
.python
.runtime
import platformType
72 if platformType
== "win32":
75 # fork a child to launch the daemon, while the parent process tails the
79 rc
= Follower().follow()
81 # this is the child: give the logfile-watching parent a chance to start
82 # watching it before we start the daemon
87 sys
.path
.insert(0, os
.path
.abspath(os
.getcwd()))
88 if os
.path
.exists("/usr/bin/make") and os
.path
.exists("Makefile.buildbot"):
89 # Preferring the Makefile lets slave admins do useful things like set
90 # up environment variables for the buildslave.
91 cmd
= "make -f Makefile.buildbot start"
92 if not config
['quiet']:
96 # see if we can launch the application without actually having to
97 # spawn twistd, since spawning processes correctly is a real hassle
99 from twisted
.python
.runtime
import platformType
102 "--logfile=twistd.log", # windows doesn't use the same default
103 "--python=buildbot.tac"]
104 if platformType
== "win32":
105 argv
.append("--reactor=win32")
108 # this is copied from bin/twistd. twisted-1.3.0 uses twistw, while
109 # twisted-2.0.0 uses _twistw.
110 if platformType
== "win32":
112 from twisted
.scripts
._twistw
import run
114 from twisted
.scripts
.twistw
import run
116 from twisted
.scripts
.twistd
import run