This repository has been archived by the owner on Feb 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile.setup
104 lines (91 loc) · 3.85 KB
/
Makefile.setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
BASEDIR ?= $(shell pwd)
VIRTUALENV ?= virtualenv
PYTHON ?= /tools/python/bin/python
PIP_PACKAGES_FILE ?= master-pip.txt
HG ?= hg
HG_HOST = https://hg.mozilla.org
HG_DIR = build
MASTER_NAME = $(error MASTER_NAME must be defined (see setup-master.py -l for a list))
DATABASE = tm-b01-master01.mozilla.org/buildbot
MYSQL_CONFIG = $(HOME)/.$(MASTER_NAME)_update_from_files.conf
VIRTUALENV_PYTHON = $(BASEDIR)/bin/python
PIP = $(BASEDIR)/bin/pip
BUILDBOT = $(BASEDIR)/bin/buildbot
USER = cltbld
HOME = /home/$(USER)
BUILDBOT_BRANCH = production-0.8
BUILDBOTCUSTOM_BRANCH = production-0.8
BUILDBOTCONFIGS_BRANCH = production
TOOLS_BRANCH = default
TOOLS_REPO ?= $(HG_HOST)/$(HG_DIR)/tools
INSTALL_BUILDBOT_SLAVE=
# staging master setup
ifdef USE_DEV_MASTER
MASTERS_JSON = dev-master_config.json
HTTP_PORT = $(error HTTP_PORT must be defined)
PB_PORT = $(error PB_PORT must be defined)
SSH_PORT = $(error SSH_PORT must be defined)
ROLE = $(error ROLE must be defined)
GENERATE_MASTERS_JSON_CMD = \
sed -e 's,@BASEDIR@,$(BASEDIR),g' \
-e 's,@HTTP_PORT@,$(HTTP_PORT),g' \
-e 's,@PB_PORT@,$(PB_PORT),g' \
-e 's,@SSH_PORT@,$(SSH_PORT),g' \
-e 's,@MASTER_NAME@,$(MASTER_NAME),g' \
-e 's,@ROLE@,$(ROLE),g' \
-e 's,@ROLE@,$(ROLE),g' \
-e 's,@BUILDBOTCUSTOM_BRANCH@,$(BUILDBOTCUSTOM_BRANCH),g' \
-e 's,@BUILDBOTCONFIGS_BRANCH@,$(BUILDBOTCONFIGS_BRANCH),g' \
-e 's,@TOOLS_BRANCH@,$(TOOLS_BRANCH),g' \
-e 's,@BUILDBOT_BRANCH@,$(BUILDBOT_BRANCH),g' \
$(MASTERS_JSON).in > $(MASTERS_JSON)
endif
ifdef UNIVERSAL
UNIVERSAL_OPT=-u
else
UNIVERSAL_OPT=
endif
ifdef MASTERS_JSON
SETUP_MASTER=setup-master.py -j $(MASTERS_JSON)
else
SETUP_MASTER=setup-master.py -8
endif
all: virtualenv deps install-buildbot master master-makefile other-files done
done:
@echo
@echo
@echo You probably want to update at least the following files to contain accurate passwords/descriptions:
@echo BuildSlaves.py, passwords.py, $(MYSQL_CONFIG)
virtualenv:
$(VIRTUALENV) --distribute --no-site-packages -p $(PYTHON) $(BASEDIR)
deps:
$(PIP) install $(PIP_FLAGS) -r $(PIP_PACKAGES_FILE)
# HACK ALERT: This only works when there's only one python version in "lib".
# This is generally true when using virtualenvs.
install-buildbot: SITE_PACKAGES = $(BASEDIR)/lib/$(shell ls $(BASEDIR)/lib/)/site-packages
install-buildbot:
test -d $(BASEDIR)/buildbot || $(HG) clone -b $(BUILDBOT_BRANCH) $(HG_HOST)/$(HG_DIR)/buildbot $(BASEDIR)/buildbot
(cd $(BASEDIR)/buildbot/master; $(VIRTUALENV_PYTHON) setup.py develop install)
ifdef INSTALL_BUILDBOT_SLAVE
(cd $(BASEDIR)/buildbot/slave; $(VIRTUALENV_PYTHON) setup.py develop install)
endif
test -d $(BASEDIR)/buildbotcustom || $(HG) clone -b $(BUILDBOTCUSTOM_BRANCH) $(HG_HOST)/$(HG_DIR)/buildbotcustom $(BASEDIR)/buildbotcustom
test -d $(BASEDIR)/buildbot-configs || $(HG) clone -b $(BUILDBOTCONFIGS_BRANCH) $(HG_HOST)/$(HG_DIR)/buildbot-configs $(BASEDIR)/buildbot-configs
test -d $(BASEDIR)/tools || $(HG) clone -b $(TOOLS_BRANCH) $(TOOLS_REPO) $(BASEDIR)/tools
# Get buildbotcustom and the build/tools library into PYTHONPATH
ln -sf $(BASEDIR)/buildbotcustom $(SITE_PACKAGES)/buildbotcustom
echo "$(BASEDIR)/tools/lib/python" > $(SITE_PACKAGES)/build-tools-lib.pth
master:
ifdef GENERATE_MASTERS_JSON_CMD
cd $(BASEDIR)/buildbot-configs && $(GENERATE_MASTERS_JSON_CMD)
endif
cd $(BASEDIR)/buildbot-configs && \
$(VIRTUALENV_PYTHON) $(SETUP_MASTER) $(UNIVERSAL_OPT) -b $(BUILDBOT) $(BASEDIR)/master $(MASTER_NAME)
master-makefile:
ln -sf $(BASEDIR)/buildbot-configs/Makefile.master $(BASEDIR)/Makefile
other-files:
echo "[DEFAULT]" > $(MYSQL_CONFIG)
echo "database = mysql://buildbot:password@$(DATABASE)" >> $(MYSQL_CONFIG)
echo "master = http://this-master:port" >> $(MYSQL_CONFIG)
echo "name = $(MASTER_NAME)" >> $(MYSQL_CONFIG)
.PHONY: all done virtualenv deps install-buildbot master master-makefile other-files