OLD | NEW |
1 # -*- makefile -*- | 1 # -*- makefile -*- |
2 | 2 |
3 # This is a simple makefile which lives in a buildmaster/buildslave | 3 # This is a simple makefile which lives in a buildmaster/buildslave |
4 # directory (next to the buildbot.tac file). It allows you to start/stop the | 4 # directory (next to the buildbot.tac file). It allows you to start/stop the |
5 # master or slave by doing 'make start' or 'make stop'. | 5 # master or slave by doing 'make start' or 'make stop'. |
6 | 6 |
7 # The 'reconfig' target will tell a buildmaster to reload its config file. | |
8 | |
9 # Note that a relative PYTHONPATH entry is relative to the current directory. | |
10 | |
11 # On the Mac, the buildbot is started via the launchd mechanism as a | 7 # On the Mac, the buildbot is started via the launchd mechanism as a |
12 # LaunchAgent to give the slave a proper Mac UI environment for tests. In | 8 # LaunchAgent to give the slave a proper Mac UI environment for tests. In |
13 # order for this to work, the plist must be present and loaded by launchd, and | 9 # order for this to work, the plist must be present and loaded by launchd, and |
14 # the user must be logged in to the UI. The plist is loaded by launchd at user | 10 # the user must be logged in to the UI. The plist is loaded by launchd at user |
15 # login (and the job may have been initially started at that time too). Our | 11 # login (and the job may have been initially started at that time too). Our |
16 # Mac build slaves are all set up this way, and have auto-login enabled, so | 12 # Mac build slaves are all set up this way, and have auto-login enabled, so |
17 # "make start" should just work and do the right thing. | 13 # "make start" should just work and do the right thing. |
18 # | 14 # |
19 # When using launchd to start the job, it also needs to be used to stop the | 15 # When using launchd to start the job, it also needs to be used to stop the |
20 # job. Otherwise, launchd might try to restart the job when stopped manually | 16 # job. Otherwise, launchd might try to restart the job when stopped manually |
21 # by SIGTERM. Using SIGHUP for reconfig is safe with launchd. | 17 # by SIGTERM. Using SIGHUP for reconfig is safe with launchd. |
22 # | 18 # |
23 # Because it's possible to have more than one slave on a machine (for testing), | 19 # Because it's possible to have more than one slave on a machine (for testing), |
24 # this tests to make sure that the slave is in the known slave location, | 20 # this tests to make sure that the slave is in the known slave location, |
25 # /b/slave, which is what the LaunchAgent operates on. | 21 # /b/slave, which is what the LaunchAgent operates on. |
26 USE_LAUNCHD := \ | 22 USE_LAUNCHD := \ |
27 $(shell [ -f ~/Library/LaunchAgents/org.chromium.buildbot.slave.plist ] && \ | 23 $(shell [ -f ~/Library/LaunchAgents/org.chromium.buildbot.slave.plist ] && \ |
28 [ "$$(pwd -P)" = "/b/build/slave" ] && \ | 24 [ "$$(pwd -P)" = "/b/build/slave" ] && \ |
29 echo 1) | 25 echo 1) |
30 | 26 |
31 export PYTHONPATH=../third_party/buildbot_7_12:../third_party/twisted_8_1 | |
32 | |
33 start: | 27 start: |
34 ifneq ($(USE_LAUNCHD),1) | 28 ifneq ($(USE_LAUNCHD),1) |
35 python run_slave.py --no_save -y buildbot.tac | 29 python run_slave.py --no_save -y buildbot.tac |
36 else | 30 else |
37 launchctl start org.chromium.buildbot.slave | 31 launchctl start org.chromium.buildbot.slave |
38 endif | 32 endif |
39 | 33 |
40 stop: | 34 stop: |
41 ifneq ($(USE_LAUNCHD),1) | 35 ifneq ($(USE_LAUNCHD),1) |
42 if `test -f twistd.pid`; then kill `cat twistd.pid`; fi; | 36 if `test -f twistd.pid`; then kill `cat twistd.pid`; fi; |
43 else | 37 else |
44 launchctl stop org.chromium.buildbot.slave | 38 launchctl stop org.chromium.buildbot.slave |
45 endif | 39 endif |
46 | 40 |
47 reconfig: | 41 reconfig: |
48 kill -HUP `cat twistd.pid` | 42 kill -HUP `cat twistd.pid` |
49 | 43 |
50 log: | 44 log: |
51 tail -F twistd.log | 45 tail -F twistd.log |
52 | 46 |
53 wait: | 47 wait: |
54 while `test -f twistd.pid`; do sleep 1; done; | 48 while `test -f twistd.pid`; do sleep 1; done; |
55 | 49 |
56 restart: stop wait start log | 50 restart: stop wait start log |
OLD | NEW |