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