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