- fix typo
[build.git] / planetlab.mk
1 #
2 # PlanetLab standard components list
3 #
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2003-2006 The Trustees of Princeton University
6 #
7 # $Id$
8 #
9
10 #
11 # Required:
12 #
13 # CVSROOT or package-CVSROOT: CVSROOT to use
14 # TAG or package-TAG: CVS tag to use
15 # package-MODULE: CVS module name to use
16 # package-SPEC: RPM spec file template
17 #
18 # Optional:
19 #
20 # package-RPMFLAGS: Miscellaneous RPM flags
21 # package-RPMBUILD: If not rpmbuild
22 # package-CVS_RSH: If not ssh
23 #
24 # Add to ALL if you want the package built as part of the default set.
25 #
26
27 #
28 # Default values
29 #
30
31 ifneq ($(wildcard CVS/Root),)
32 CVSROOT := $(shell cat CVS/Root)
33 TAG := $(shell cvs status planetlab.mk | sed -ne 's/[[:space:]]*Sticky Tag:[[:space:]]*\([^[:space:]]*\).*/\1/p')
34 ifeq ($(TAG),(none))
35 TAG := HEAD
36 endif
37 else
38 CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
39 TAG := HEAD
40 endif
41
42 #
43 # kernel
44 #
45
46 kernel-MODULE := linux-2.6
47 kernel-SPEC := linux-2.6/scripts/kernel-2.6-planetlab.spec
48 ALL += kernel
49
50 #
51 # vnet
52 #
53
54 vnet-MODULE := vnet
55 vnet-SPEC := vnet/vnet.spec
56 ALL += vnet
57
58 # Build kernel first so we can bootstrap off of its build
59 vnet: kernel
60
61 #
62 # util-vserver
63 #
64
65 util-vserver-MODULE := util-vserver
66 util-vserver-SPEC := util-vserver/util-vserver.spec
67 ALL += util-vserver
68
69 #
70 # yum
71 #
72
73 yum-MODULE := yum
74 yum-SPEC := yum/yum.spec
75 ALL += yum
76
77 #
78 # PlanetLabAccounts
79 #
80
81 PlanetLabAccounts-MODULE := PlanetLabAccounts
82 PlanetLabAccounts-SPEC := PlanetLabAccounts/PlanetLabAccounts.spec
83 ALL += PlanetLabAccounts
84
85 #
86 # NodeUpdate
87 #
88
89 NodeUpdate-MODULE := NodeUpdate
90 NodeUpdate-SPEC := NodeUpdate/NodeUpdate.spec
91 ALL += NodeUpdate
92
93 #
94 # PlanetLabConf
95 #
96
97 PlanetLabConf-MODULE := PlanetLabConf
98 PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
99 ALL += PlanetLabConf
100
101 #
102 # ipod
103 #
104
105 ipod-MODULE := ipod
106 ipod-SPEC := ipod/ipod.spec
107 ALL += ipod
108
109 #
110 # sudo
111 #
112
113 sudo-MODULE := sudo
114 sudo-SPEC := sudo/planetlab_sudo.spec
115 ALL += sudo
116
117 #
118 # pycurl
119 #
120
121 pycurl-MODULE := pycurl
122 pycurl-SPEC := pycurl/pycurl.spec
123 ALL += pycurl
124
125 #
126 # BootServerRequest
127 #
128
129 BootServerRequest-MODULE := BootServerRequest
130 BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
131 ALL += BootServerRequest
132
133 #
134 # PlanetLabID
135 #
136
137 PlanetLabID-MODULE := PlanetLabID
138 PlanetLabID-SPEC := PlanetLabID/PlanetLabID.spec
139 ALL += PlanetLabID
140
141 #
142 # Node Manager
143 #
144
145 sidewinder-MODULE := sidewinder
146 sidewinder-SPEC := sidewinder/sidewinder.spec
147 ALL += sidewinder
148
149 #
150 # pl_sshd
151 #
152
153 pl_sshd-MODULE := pl_sshd
154 pl_sshd-SPEC := pl_sshd/pl_sshd.spec
155 ALL += pl_sshd
156
157 #
158 # libhttpd++: 
159 #
160
161 libhttpd++-MODULE := libhttpd++
162 libhttpd++-SPEC := libhttpd++/libhttpd++.spec
163 ALL += libhttpd++
164
165 #
166 # Proper: Privileged Operations Service
167 #
168
169 proper-MODULE := proper
170 proper-SPEC := proper/proper.spec
171 ALL += proper
172
173 proper: libhttpd++
174
175 #
176 # MySQL
177 #
178
179 mysql-MODULE := mysql
180 mysql-SPEC := mysql/mysql.spec
181 ALL += mysql
182
183 #
184 # ulogd
185 #
186
187 ulogd-MODULE := ulogd
188 ulogd-SPEC := ulogd/ulogd.spec
189 ALL += ulogd
190
191 ulogd: kernel proper mysql
192
193 #
194 # netflow
195 #
196
197 netflow-MODULE := netflow
198 netflow-SPEC := netflow/netflow.spec
199 ALL += netflow
200
201 netflow: mysql
202
203 #
204 # PlanetLab Mom: Cleans up your mess
205 #
206
207 pl_mom-MODULE := pl_mom
208 pl_mom-SPEC := pl_mom/pl_mom.spec
209 ALL += pl_mom
210
211 #
212 # iptables
213 #
214
215 iptables-MODULE := iptables
216 iptables-SPEC := iptables/iptables.spec
217 ALL += iptables
218
219 iptables: kernel
220
221 #
222 # iproute
223 #
224
225 iproute-MODULE := iproute2
226 iproute-SPEC := iproute2/iproute.spec
227 ALL += iproute
228
229 #
230 # kexec-tools
231 #
232
233 kexec-tools-MODULE := kexec-tools
234 kexec-tools-SPEC := kexec-tools/kexec-tools.spec
235 ALL += kexec-tools
236
237 #
238 # dhcp
239 #
240
241 dhcp-MODULE := dhcp
242 dhcp-SPEC := dhcp/dhcp.spec
243 ALL += dhcp
244
245 #
246 # util-python
247 #
248
249 util-python-MODULE := util-python
250 util-python-SPEC := util-python/util-python.spec
251 ALL += util-python
252
253 # proper and util-vserver both use scripts in util-python for building
254 proper: util-python
255 util-vserver: util-python
256 PlanetLabAuth: util-python
257
258 #
259 # PlanetLabAuth
260 #
261
262 PlanetLabAuth-MODULE := pl_auth
263 PlanetLabAuth-SPEC := pl_auth/pl_auth.spec
264 ALL += PlanetLabAuth
265
266 #
267 # plcapilib
268 #
269
270 plcapilib-MODULE := plcmdline
271 plcapilib-SPEC := plcmdline/plcapilib.spec
272 ALL += plcapilib
273
274 #
275 # vserver-reference
276 #
277
278 vserver-reference-MODULE := vserver-reference build
279 vserver-reference-SPEC := vserver-reference/vserver-reference.spec
280 # Package must be built as root
281 vserver-reference-RPMBUILD := sudo rpmbuild
282 ALL += vserver-reference
283
284 # vserver-reference may require current packages
285 vserver-reference: $(filter-out vserver-reference,$(ALL))
286
287 #
288 # bootmanager
289 #
290
291 bootmanager-MODULE := bootmanager build
292 bootmanager-SPEC := bootmanager/bootmanager.spec
293 bootmanager-RPMBUILD := sudo rpmbuild
294 ALL += bootmanager
295
296 # bootmanager requires current packages
297 bootmanager: $(filter-out bootmanager,$(ALL))
298
299 # ...and the yum manifest
300 bootmanager: RPMS/yumgroups.xml
301
302 #
303 # bootcd
304 #
305
306 bootcd-MODULE := bootcd build bootmanager
307 bootcd-SPEC := bootcd/bootcd.spec
308 bootcd-RPMBUILD := sudo rpmbuild
309 ALL += bootcd
310
311 # bootcd requires current packages
312 bootcd: $(filter-out bootcd,$(ALL))
313
314 #
315 # MyPLC
316 #
317
318 myplc-MODULE := $(sort $(foreach module,$(ALL),$($(module)-MODULE))) myplc build pl_db plc_api plc_www plc/scripts
319 myplc-SPEC := myplc/myplc.spec
320 # Package must be built as root
321 myplc-RPMBUILD := sudo rpmbuild
322 ALL += myplc
323
324 # MyPLC may require current packages
325 myplc: $(filter-out myplc,$(ALL))
326
327 # ...and the yum manifest
328 myplc: RPMS/yumgroups.xml
329
330 #
331 # Installation rules
332
333
334 # Upload packages to boot server
335 SERVER := build@boot.planet-lab.org
336 ARCHIVE := /var/www/html/install-rpms/archive
337
338 # Put nightly alpha builds in a subdirectory
339 ifeq ($(TAG),HEAD)
340 ARCHIVE := $(ARCHIVE)/planetlab-alpha
341 REPOS := /var/www/html/install-rpms/planetlab-alpha
342 endif
343
344 RPMS/yumgroups.xml:
345         install -D -m 644 groups/v3_yumgroups.xml RPMS/yumgroups.xml
346
347 install:
348 ifeq ($(BASE),)
349         @echo make install is only meant to be called from ./build.sh
350 else
351 ifneq ($(wildcard /etc/planetlab/secring.gpg),)
352         # Sign all RPMS. setsid detaches rpm from the terminal,
353         # allowing the (hopefully blank) GPG password to be entered
354         # from stdin instead of /dev/tty. Obviously, the build server
355         # should be secure.
356         echo | setsid rpm \
357         --define "_signature gpg" \
358         --define "_gpg_path /etc/planetlab" \
359         --define "_gpg_name PlanetLab <info@planet-lab.org>" \
360         --resign RPMS/*/*.rpm SRPMS/*.rpm
361 endif
362 ifneq ($(BUILDS),)
363         # Remove old runs
364         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVER) /bin/bash -s
365 endif
366         # Create package manifest
367         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/RPMS" RPMS > packages.xml
368         # Populate repository
369         ssh $(SERVER) mkdir -p $(ARCHIVE)/$(BASE)/RPMS $(ARCHIVE)/$(BASE)/SRPMS
370         rsync --delete --links --perms --times --group --compress --rsh=ssh \
371             $(sort $(subst -debuginfo,,$(wildcard RPMS/yumgroups.xml RPMS/*/*.rpm))) $(SERVER):$(ARCHIVE)/$(BASE)/RPMS/
372         ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/RPMS >/dev/null
373         ssh $(SERVER) createrepo -g yumgroups.xml $(ARCHIVE)/$(BASE)/RPMS >/dev/null
374         rsync --delete --links --perms --times --group --compress --rsh=ssh \
375             $(wildcard SRPMS/*.rpm) $(SERVER):$(ARCHIVE)/$(BASE)/SRPMS/
376         ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/SRPMS >/dev/null
377         ssh $(SERVER) createrepo $(ARCHIVE)/$(BASE)/SRPMS >/dev/null
378 ifeq ($(TAG),HEAD)
379         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
380         if ! ssh $(SERVER) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
381             ssh $(SERVER) ln -nsf $(ARCHIVE)/$(BASE)/RPMS/ $(REPOS) ; \
382         fi
383 endif
384 endif
385
386 .PHONY: install