3853053eccdf870a7a13a6e12010d99a74c5d149
[build.git] / onelab.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: onelab.mk,v 1.25 2007/04/16 15:28:18 thierry 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 # we do not use TAG directly anymore, and let it to HEAD
29 # this because we want the rpm's releases to reflect the date even when a tag is used
30 # our build script defines COMMON_TAG that the various components are free to use or not
31  
32 # COMMON_TAG set from the build script
33
34 TAGSFILE = onelab-tags.mk
35
36 include $(TAGSFILE)
37
38 #
39 # Default values
40 #
41
42 # it's useless to set this here because it's overriden on the command line by nightly-build.sh
43 TAG := HEAD
44
45 # Check if a tag has been checked out
46 ifneq ($(wildcard CVS/Root),)
47 # Check if we are able to access CVS
48 CVSTAG := $(shell cvs status planetlab.mk 2>/dev/null | sed -ne 's/[[:space:]]*Sticky Tag:[[:space:]]*\([^[:space:]]*\).*/\1/p')
49 ifneq ($(CVSTAG),)
50 CVSROOT := $(shell cat CVS/Root)
51 ifeq ($(CVSTAG),(none))
52 TAG := HEAD
53 else
54 TAG := $(CVSTAG)
55 endif
56 endif
57 endif
58
59 #
60 # kernel
61 #
62
63 #kernel-x86_64-MODULE := linux-2.6
64 #kernel-x86_64-RPMFLAGS:= --target x86_64
65 #kernel-x86_64-SPEC := linux-2.6/scripts/kernel-2.6-$(PLDISTRO).spec
66 ##ALL += kernel-x86_64
67
68 kernel-i686-MODULE := linux-2.6
69 kernel-i686-RPMFLAGS:= --target i686
70 kernel-i686-SPEC := linux-2.6/scripts/kernel-2.6-$(PLDISTRO).spec
71 ALL += kernel-i686
72
73 #kernel-i586-MODULE := linux-2.6
74 #kernel-i586-RPMFLAGS:= --target i586
75 #kernel-i586-SPEC := linux-2.6/scripts/kernel-2.6-planetlab.spec
76 #ALL += kernel-i586
77
78 #kernel: kernel-i586 kernel-i686
79 #kernel-clean: kernel-i586-clean kernel-i686-clean
80 kernel: kernel-i686
81 kernel-clean: kernel-i686-clean
82
83 #
84 # vnet
85 #
86
87 vnet-MODULE := vnet
88 vnet-SPEC := vnet/vnet.spec
89 ALL += vnet
90
91 # Build kernel first so we can bootstrap off of its build
92 vnet: kernel
93
94 #
95 # madwifi
96 #
97
98 madwifi-ng-MODULE := madwifi-ng
99 madwifi-ng-SPEC := madwifi.spec
100 ALL += madwifi-ng
101
102 # Build kernel first so we can bootstrap off of its build
103 madwifi-ng: kernel
104
105
106 # wireless-tools
107
108
109 wireless-tools-MODULE = wireless-tools
110 wireless-tools-SPEC := wireless-tools.spec
111 ALL += wireless-tools
112
113 #
114 # ivtv 
115 #
116
117 #ivtv-MODULE := ivtv
118 #ivtv-SPEC := ivtv/ivtv.spec
119 #ALL += ivtv
120
121 #
122 # util-vserver
123 #
124
125 util-vserver-MODULE := util-vserver
126 util-vserver-SPEC := util-vserver/util-vserver.spec
127 util-vserver-RPMFLAGS:= --without dietlibc
128 ALL += util-vserver
129
130 #
131 # PlanetLabAccounts
132 #
133
134 PlanetLabAccounts-MODULE := PlanetLabAccounts
135 PlanetLabAccounts-SPEC := PlanetLabAccounts/PlanetLabAccounts.spec
136 ALL += PlanetLabAccounts
137
138 #
139 # NodeUpdate
140 #
141
142 NodeUpdate-MODULE := NodeUpdate
143 NodeUpdate-SPEC := NodeUpdate/NodeUpdate.spec
144 ALL += NodeUpdate
145
146 #
147 # PlanetLabConf
148 #
149
150 PlanetLabConf-MODULE := PlanetLabConf
151 PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
152 ALL += PlanetLabConf
153
154 #
155 # ipod
156 #
157
158 ipod-MODULE := ipod
159 ipod-SPEC := ipod/ipod.spec
160 ALL += ipod
161
162 #
163 # sudo
164 #
165
166 sudo-MODULE := sudo
167 sudo-SPEC := sudo/planetlab_sudo.spec
168 ALL += sudo
169
170 #
171 # pycurl
172 #
173
174 pycurl-MODULE := pycurl
175 pycurl-SPEC := pycurl/pycurl.spec
176 ALL += pycurl
177
178 #
179 # BootServerRequest
180 #
181
182 BootServerRequest-MODULE := BootServerRequest
183 BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
184 ALL += BootServerRequest
185
186 #
187 # PlanetLabID
188 #
189
190 PlanetLabID-MODULE := PlanetLabID
191 PlanetLabID-SPEC := PlanetLabID/PlanetLabID.spec
192 ALL += PlanetLabID
193
194 #
195 # Node Manager
196 #
197
198 NodeManager-MODULE := NodeManager
199 NodeManager-SPEC := NodeManager/NodeManager.spec
200 ALL += NodeManager
201
202 #
203 # pl_sshd
204 #
205
206 pl_sshd-MODULE := pl_sshd
207 pl_sshd-SPEC := pl_sshd/pl_sshd.spec
208 ALL += pl_sshd
209
210 #
211 # libhttpd++: 
212 #
213
214 libhttpd++-MODULE := libhttpd++
215 libhttpd++-SPEC := libhttpd++/libhttpd++.spec
216 ALL += libhttpd++
217
218 #
219 # Proper: Privileged Operations Service
220 #
221
222 proper-MODULE := proper
223 proper-SPEC := proper/proper.spec
224 ALL += proper
225
226 proper: libhttpd++
227
228 #
229 # MySQL
230 #
231
232 mysql-MODULE := mysql
233 mysql-SPEC := mysql/mysql.spec
234 ALL += mysql
235
236 #
237 # ulogd
238 #
239
240 ulogd-MODULE := ulogd
241 ulogd-SPEC := ulogd/ulogd.spec
242 ALL += ulogd
243
244 ulogd: kernel proper mysql
245
246 #
247 # netflow
248 #
249
250 netflow-MODULE := netflow
251 netflow-SPEC := netflow/netflow.spec
252 ALL += netflow
253
254 netflow: mysql
255
256 #
257 # PlanetLab Mom: Cleans up your mess
258 #
259
260 pl_mom-MODULE := pl_mom
261 pl_mom-SPEC := pl_mom/pl_mom.spec
262 ALL += pl_mom
263
264 #
265 # iptables
266 #
267
268 iptables-MODULE := iptables
269 iptables-SPEC := iptables/iptables.spec
270 ALL += iptables
271
272 iptables: kernel
273
274 #
275 # iproute
276 #
277
278 iproute-MODULE := iproute2
279 iproute-SPEC := iproute2/iproute.spec
280 ALL += iproute
281
282 #
283 # kexec-tools
284 #
285
286 kexec-tools-MODULE := kexec-tools
287 kexec-tools-SPEC := kexec-tools/kexec-tools.spec
288 ALL += kexec-tools
289
290 #
291 # util-python
292 #
293
294 util-python-MODULE := util-python
295 util-python-SPEC := util-python/util-python.spec
296 ALL += util-python
297
298 # proper and util-vserver both use scripts in util-python for building
299 proper: util-python
300 util-vserver: util-python
301 PlanetLabAuth: util-python
302
303 #
304 # PLCAPI
305 #
306
307 PLCAPI-MODULE := new_plc_api
308 PLCAPI-SPEC := PLCAPI.spec
309 ALL += PLCAPI
310
311 #
312 # vserver-reference
313 #
314
315 vserver-reference-MODULE := vserver-reference build
316 vserver-reference-SPEC := vserver-reference/vserver-reference.spec
317 # Package must be built as root
318 vserver-reference-RPMBUILD := sudo rpmbuild
319 ALL += vserver-reference
320
321 # vserver-reference may require current packages
322 vserver-reference: $(filter-out vserver-reference,$(ALL))
323
324 #
325 # bootmanager
326 #
327
328 bootmanager-MODULE := bootmanager build
329 bootmanager-SPEC := bootmanager.spec
330 bootmanager-RPMBUILD := sudo rpmbuild
331 ALL += bootmanager
332
333 # bootmanager requires current packages
334 bootmanager: $(filter-out bootmanager,$(ALL))
335
336 # ...and the yum manifest
337 bootmanager: RPMS/yumgroups.xml
338
339 #
340 # bootcd
341 #
342
343 bootcd-MODULE := bootcd build bootmanager
344 bootcd-SPEC := bootcd.spec
345 bootcd-RPMBUILD := sudo rpmbuild
346 ALL += bootcd
347
348 # bootcd requires current packages
349 bootcd: $(filter-out bootcd,$(ALL))
350
351 #
352 # plcwww
353 #
354
355 plcwww-MODULE := new_plc_www
356 plcwww-SPEC := plcwww.spec
357 ALL += plcwww
358
359 #
360 # MyPLC
361 #
362
363 myplc-MODULE := build myplc plc/scripts
364 myplc-SPEC := myplc.spec
365 # Package must be built as root
366 myplc-RPMBUILD := sudo rpmbuild
367 ALL += myplc
368
369 # MyPLC may require current packages
370 myplc: $(filter-out myplc,$(ALL))
371
372 # ...and the yum manifest
373 myplc: RPMS/yumgroups.xml
374
375 # we also ship various information on the build in /etc/myplc-release
376 # we cannot store this under SOURCES/myplc 
377 # otherwise the code extraction phase does not take place 
378 # because it depends on $SOURCES/$(package) as per Rules.mk
379 myplc: SOURCES/myplc-release
380
381 SOURCES/myplc-release:
382         @echo 'Creating myplc-release'
383         rm -f $@
384         (echo -n 'Build date: ' ; date '+%Y.%m.%d') >> $@
385         (echo -n 'Build hostname: ' ; hostname) >> $@
386         (echo -n 'Build location: ' ; pwd) >> $@
387         echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx tags file contents" >> $@
388         cat $(TAGSFILE) >> $@
389
390 #
391 # MyPLC development environment
392 #
393
394 ###myplc-devel-MODULE := build myplc
395 ###myplc-devel-SPEC := myplc/myplc-devel.spec
396 #### Package must be built as root
397 ###myplc-devel-RPMBUILD := sudo rpmbuild
398 ###ALL += myplc-devel
399
400 #
401 # Installation rules
402
403
404 # Upload packages to boot server
405 SERVER          := root@onelab-plc.inria.fr
406 RPMSAREA        := /var/www/html/install-rpms/
407 BOOTAREA        := /var/www/html/boot/
408
409 ifeq ($(PLDISTRO),planetlab)
410 YUMGROUPS       := groups/v3_yumgroups.xml
411 else
412 YUMGROUPS       := groups/v4_onelab.xml
413 endif
414
415 #BASE           := onelab
416 BASENEW         := build-$(notdir $(shell pwd))
417 BASEBAK         := planetlab-bak
418 BASE            := planetlab
419
420 RPMS/yumgroups.xml:
421         install -D -m 644 $(YUMGROUPS) RPMS/yumgroups.xml
422
423 INSTALL-TARGETS := install-rpms install-index install-adopt install-bootstrap
424 install: $(INSTALL-TARGETS)
425
426 install-help:
427         @echo install: $(INSTALL-TARGETS)
428
429 install-rpms:RPMS/yumgroups.xml
430         # create repository
431         ssh $(SERVER) mkdir -p /plc/data/$(RPMSAREA)/$(BASENEW)
432         # populate
433         rsync -v --perms --times --group --compress --rsh=ssh \
434            RPMS/yumgroups.xml $(wildcard RPMS/*/*.rpm) $(SERVER):/plc/data/$(RPMSAREA)/$(BASENEW)/
435
436 install-index:
437         # sign and index new repository
438         ssh $(SERVER) chroot /plc/root /etc/plc.d/packages start $(RPMSAREA)/$(BASENEW)/ 2>> install-index.log
439
440 install-clean-index:
441         # sign and index new repository
442         ssh $(SERVER) chroot /plc/root /etc/plc.d/packages clean $(RPMSAREA)/$(BASENEW)/ 2>> install-index.log
443
444 install-adopt:
445         # cleanup former bak
446         ssh $(SERVER) rm -rf /plc/data/$(RPMSAREA)/$(BASEBAK)
447         # bak previous repo
448         ssh $(SERVER) mv /plc/data/$(RPMSAREA)/$(BASE) /plc/data/$(RPMSAREA)/$(BASEBAK)
449         # install new repo
450         ssh $(SERVER) mv /plc/data/$(RPMSAREA)/$(BASENEW) /plc/data/$(RPMSAREA)/$(BASE)
451
452 install-bootstrap:
453         # install node image
454         install_bz2=$(wildcard BUILD/bootmanager-*/bootmanager/support-files/PlanetLab-Bootstrap.tar.bz2) ; \
455           if [ -n "$$install_bz2" ] ; then rsync $$install_bz2 $(SERVER):/plc/data/$(BOOTAREA) ; fi
456 #endif
457
458 .PHONY: install