Added SVNROOT.
[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.71 2007/09/25 18:38:47 faiyaza 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 SVNROOT := http://svn.planet-lab.org/svn
33 TAG := HEAD
34
35 # Check if a tag has been checked out
36 ifneq ($(wildcard CVS/Root),)
37 # Check if we are able to access CVS
38 CVSTAG := $(shell cvs status planetlab.mk 2>/dev/null | sed -ne 's/[[:space:]]*Sticky Tag:[[:space:]]*\([^[:space:]]*\).*/\1/p')
39 ifneq ($(CVSTAG),)
40 CVSROOT := $(shell cat CVS/Root)
41 ifeq ($(CVSTAG),(none))
42 TAG := HEAD
43 else
44 TAG := $(CVSTAG)
45 endif
46 endif
47 endif
48
49 #
50 # kernel
51 #
52
53 # Figure out whether we are building on i386 or x86_64 host
54 HOSTARCH := $(shell uname -i)
55
56 kernel-$(HOSTARCH)-MODULE := linux-2.6
57 kernel-$(HOSTARCH)-SPEC := linux-2.6/scripts/kernel-2.6-planetlab.spec
58 ifeq ($(HOSTARCH),i386)
59 kernel-$(HOSTARCH)-RPMFLAGS:= --target i686
60 else
61 kernel-$(HOSTARCH)-RPMFLAGS:= --target $(HOSTARCH)
62 endif
63
64 ALL += kernel-$(HOSTARCH)
65
66 kernel-clean: kernel-$(HOSTARCH)-clean
67 kernel: kernel-$(HOSTARCH)
68
69 #
70 # madwifi
71 #
72
73 madwifi-ng-MODULE := madwifi-ng
74 madwifi-ng-SPEC := madwifi-ng/madwifi.spec
75 #ALL += madwifi-ng
76
77 # Build kernel first so we can bootstrap off of its build
78 madwifi-ng: kernel
79
80 #
81 # ivtv 
82 #
83
84 ivtv-MODULE := ivtv
85 ivtv-SPEC := ivtv/ivtv.spec
86 #ALL += ivtv
87
88 #
89 # util-vserver
90 #
91
92 util-vserver-MODULE := util-vserver
93 util-vserver-SPEC := util-vserver/util-vserver.spec
94 util-vserver-RPMFLAGS:= --without dietlibc
95 ALL += util-vserver
96
97 #
98 # NodeUpdate
99 #
100
101 NodeUpdate-MODULE := NodeUpdate
102 NodeUpdate-SPEC := NodeUpdate/NodeUpdate.spec
103 ALL += NodeUpdate
104
105 #
106 # PlanetLabConf
107 #
108
109 PlanetLabConf-MODULE := PlanetLabConf
110 PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
111 ALL += PlanetLabConf
112
113 #
114 # ipod
115 #
116
117 ipod-MODULE := ipod
118 ipod-SPEC := ipod/ipod.spec
119 ALL += ipod
120
121 #
122 # sudo
123 #
124
125 sudo-MODULE := sudo
126 sudo-SPEC := sudo/planetlab_sudo.spec
127 ALL += sudo
128
129 #
130 # pycurl
131 #
132
133 curl_vernum := $(shell printf %d 0x$(shell curl-config --vernum))
134 pycurl_vernum := $(shell printf %d 0x070d01) # 7.13.1
135 pycurl_incompatnum := $(shell printf %d 0x071000) # 7.16.0
136 ifeq ($(shell test $(curl_vernum) -ge $(pycurl_vernum) && echo 1),1)
137 ifeq ($(shell test $(curl_vernum) -ge $(pycurl_incompatnum) && echo 0),1)
138 pycurl-MODULE := pycurl
139 pycurl-SPEC := pycurl/pycurl.spec
140 ALL += pycurl
141 endif
142 endif
143
144 #
145 # BootServerRequest
146 #
147
148 BootServerRequest-MODULE := BootServerRequest
149 BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
150 ALL += BootServerRequest
151
152 #
153 # Node Manager
154 #
155
156 NodeManager-MODULE := NodeManager
157 NodeManager-SPEC := NodeManager/NodeManager.spec
158 ALL += NodeManager
159
160 #
161 # pl_sshd
162 #
163
164 pl_sshd-MODULE := pl_sshd
165 pl_sshd-SPEC := pl_sshd/pl_sshd.spec
166 ALL += pl_sshd
167
168 #
169 # libhttpd++: 
170 #
171
172 libhttpd++-MODULE := libhttpd++
173 libhttpd++-SPEC := libhttpd++/libhttpd++.spec
174 ALL += libhttpd++
175
176 #
177 # Proper: Privileged Operations Service
178 #
179
180 proper-MODULE := proper
181 proper-SPEC := proper/proper.spec
182 proper-RPMBUILD := sudo bash ./rpmbuild.sh
183 ALL += proper
184
185 proper: libhttpd++
186
187 #
188 # CoDemux: Port 80 demux
189 #
190
191 codemux-MODULE := codemux
192 codemux-SPEC   := codemux/codemux.spec
193 #ALL += codemux
194
195 #
196 # MySQL
197 #
198
199 mysql-MODULE := mysql
200 mysql-SPEC := mysql/mysql.spec
201 #ALL += mysql
202
203 #
204 # ulogd
205 #
206
207 ulogd-MODULE := ulogd
208 ulogd-SPEC := ulogd/ulogd.spec
209 ALL += ulogd
210
211 ulogd: kernel proper #mysql
212
213 #
214 # netflow
215 #
216
217 netflow-MODULE := netflow
218 netflow-SPEC := netflow/netflow.spec
219 ALL += netflow
220
221 netflow: #mysql
222
223 #
224 # PlanetLab Mom: Cleans up your mess
225 #
226
227 pl_mom-MODULE := pl_mom
228 pl_mom-SPEC := pl_mom/pl_mom.spec
229 ALL += pl_mom
230
231 #
232 # iptables
233 #
234
235 iptables-MODULE := iptables
236 iptables-SPEC := iptables/iptables.spec
237 ALL += iptables
238
239 iptables: kernel
240
241 #
242 # iproute
243 #
244
245 iproute-MODULE := iproute2
246 iproute-SPEC := iproute2/iproute.spec
247 ALL += iproute
248
249 #
250 # kexec-tools
251 #
252
253 kexec-tools-MODULE := kexec-tools
254 kexec-tools-SPEC := kexec-tools/kexec-tools.spec
255 ALL += kexec-tools
256
257 #
258 # util-python
259 #
260
261 util-python-MODULE := util-python
262 util-python-SPEC := util-python/util-python.spec
263 ALL += util-python
264
265 # proper and util-vserver both use scripts in util-python for building
266 proper: util-python
267 util-vserver: util-python
268 PlanetLabAuth: util-python
269
270 #
271 # PLCAPI
272 #
273
274 PLCAPI-MODULE := new_plc_api
275 PLCAPI-SPEC := new_plc_api/PLCAPI.spec
276 ALL += PLCAPI
277
278 #
279 # PLCWWW
280 #
281
282 PLCWWW-MODULE := new_plc_www
283 PLCWWW-SPEC := new_plc_www/PLCWWW.spec
284 ALL += PLCWWW
285
286 #
287 # vserver-reference
288 #
289
290 vserver-reference-MODULE := vserver-reference build
291 vserver-reference-SPEC := vserver-reference/vserver-reference.spec
292 # Package must be built as root
293 vserver-reference-RPMBUILD := sudo bash ./rpmbuild.sh
294 ALL += vserver-reference
295
296 # vserver-reference may require current packages
297 vserver-reference: $(filter-out vserver-reference,$(ALL))
298
299 #
300 # bootmanager
301 #
302
303 bootmanager-MODULE := bootmanager build
304 bootmanager-SPEC := bootmanager/bootmanager.spec
305 bootmanager-RPMBUILD := sudo bash ./rpmbuild.sh
306 ALL += bootmanager
307
308 # bootmanager requires current packages
309 bootmanager: $(filter-out bootmanager,$(ALL))
310
311 # ...and the yum manifest
312 bootmanager: RPMS/yumgroups.xml
313
314 #
315 # bootcd
316 #
317
318 bootcd-MODULE := bootcd build bootmanager
319 bootcd-SPEC := bootcd/bootcd.spec
320 bootcd-RPMBUILD := sudo bash ./rpmbuild.sh
321 ALL += bootcd
322
323 # bootcd requires current packages
324 bootcd: $(filter-out bootcd,$(ALL))
325
326 #
327 # MyPLC
328 #
329
330 myplc-MODULE := build myplc new_plc_www plc/scripts
331 myplc-SPEC := myplc/myplc.spec
332 # Package must be built as root
333 myplc-RPMBUILD := sudo bash ./rpmbuild.sh
334 ALL += myplc
335
336 # MyPLC may require current packages
337 myplc: $(filter-out myplc,$(ALL))
338
339 # ...and the yum manifest
340 myplc: RPMS/yumgroups.xml
341
342 #
343 # MyPLC development environment
344 #
345
346 myplc-devel-MODULE := build myplc
347 myplc-devel-SPEC := myplc/myplc-devel.spec
348 # Package must be built as root
349 myplc-devel-RPMBUILD := sudo bash ./rpmbuild.sh
350 ALL += myplc-devel
351
352 #
353 # MyPLC native
354 #
355
356 myplc-native-MODULE := build myplc plc/scripts
357 myplc-native-SPEC := myplc/myplc-native.spec
358 # Package must be built as root
359 myplc-native-RPMBUILD := sudo bash ./rpmbuild.sh
360 ALL += myplc-native
361
362 # MyPLC may require current packages
363 myplc-native: $(filter-out myplc,$(ALL))
364
365 # ...and the yum manifest
366 myplc-native: RPMS/yumgroups.xml
367 #
368 # libnl
369 #
370
371 libnl-MODULE := libnl
372 libnl-SPEC := libnl/libnl.spec
373 ALL += libnl
374
375 util-vserver: libnl
376
377 #
378 # Installation rules
379
380
381 # Upload packages to boot server
382 SERVERA := build@boot1.planet-lab.org
383 SERVERB := build@boot2.planet-lab.org
384 ARCHIVE := /plc/data/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 := /plc/data/var/www/html/install-rpms/planetlab-alpha
390 endif
391
392 RPMS/yumgroups.xml:
393         install -D -m 644 groups/v4_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
409 endif
410 ifneq ($(BUILDS),)
411         # Remove old runs
412         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERA) /bin/bash -s
413         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERB) /bin/bash -s
414 endif
415         # Create package manifest
416         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/RPMS" RPMS > packages.xml
417         # Update yum metadata
418         yum-arch RPMS >/dev/null
419         createrepo -g yumgroups.xml RPMS >/dev/null
420         # Populate repository
421         rsync \
422         --exclude '*-debuginfo-*' \
423         --recursive --links --perms --times --group --compress --rsh=ssh \
424         RPMS/ $(SERVERA):$(ARCHIVE)/$(BASE)
425         rsync \
426         --exclude '*-debuginfo-*' \
427         --recursive --links --perms --times --group --compress --rsh=ssh \
428         RPMS/ $(SERVERB):$(ARCHIVE)/$(BASE)
429 ifeq ($(TAG),HEAD)
430         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
431         if ! ssh $(SERVERA) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
432             ssh $(SERVERA) ln -nsf archive/$(BASE) $(REPOS) ; \
433         fi
434         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
435         if ! ssh $(SERVERB) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
436             ssh $(SERVERB) ln -nsf archive/$(BASE) $(REPOS) ; \
437         fi
438
439 endif
440 endif
441
442 .PHONY: install