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