1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 import os, sys, time
18
30
32 from twisted.internet import reactor
33 print "The %s appears to have (re)started correctly." % processtype
34 self.rc = 0
35 reactor.stop()
36
38 from twisted.internet import reactor
39 from buildbot.scripts.logwatcher import BuildmasterTimeoutError, \
40 ReconfigError, BuildslaveTimeoutError, BuildSlaveDetectedError
41 if why.check(BuildmasterTimeoutError):
42 print """
43 The buildmaster took more than 10 seconds to start, so we were unable to
44 confirm that it started correctly. Please 'tail twistd.log' and look for a
45 line that says 'configuration update complete' to verify correct startup.
46 """
47 elif why.check(BuildslaveTimeoutError):
48 print """
49 The buildslave took more than 10 seconds to start and/or connect to the
50 buildmaster, so we were unable to confirm that it started and connected
51 correctly. Please 'tail twistd.log' and look for a line that says 'message
52 from master: attached' to verify correct startup. If you see a bunch of
53 messages like 'will retry in 6 seconds', your buildslave might not have the
54 correct hostname or portnumber for the buildmaster, or the buildmaster might
55 not be running. If you see messages like
56 'Failure: twisted.cred.error.UnauthorizedLogin'
57 then your buildslave might be using the wrong botname or password. Please
58 correct these problems and then restart the buildslave.
59 """
60 elif why.check(ReconfigError):
61 print """
62 The buildmaster appears to have encountered an error in the master.cfg config
63 file during startup. It is probably running with an empty configuration right
64 now. Please inspect and fix master.cfg, then restart the buildmaster.
65 """
66 elif why.check(BuildSlaveDetectedError):
67 print """
68 Buildslave is starting up, not following logfile.
69 """
70 else:
71 print """
72 Unable to confirm that the buildmaster started correctly. You may need to
73 stop it, fix the config file, and restart.
74 """
75 print why
76 self.rc = 1
77 reactor.stop()
78
79
81 os.chdir(config['basedir'])
82 if (not os.path.exists("buildbot.tac") and
83 not os.path.exists("Makefile.buildbot")):
84 print "This doesn't look like a buildbot base directory:"
85 print "No buildbot.tac or Makefile.buildbot file."
86 print "Giving up!"
87 sys.exit(1)
88 if config['quiet']:
89 return launch(config)
90
91
92 from twisted.python.runtime import platformType
93 if platformType == "win32":
94 return launch(config)
95
96
97
98 if os.fork():
99
100 rc = Follower().follow()
101 sys.exit(rc)
102
103
104 time.sleep(0.2)
105 launch(config)
106
108 sys.path.insert(0, os.path.abspath(os.getcwd()))
109 if os.path.exists("/usr/bin/make") and os.path.exists("Makefile.buildbot"):
110
111
112 cmd = "make -f Makefile.buildbot start"
113 if not config['quiet']:
114 print cmd
115 os.system(cmd)
116 else:
117
118
119
120 argv = ["twistd",
121 "--no_save",
122 "--logfile=twistd.log",
123 "--python=buildbot.tac"]
124 sys.argv = argv
125
126
127
128
129 from twisted.scripts import twistd
130 twistd.run()
131