- add iproute/tc to list of custom packages
[build.git] / Makefile
1 #
2 # PlanetLab RPM generation
3 #
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2003-2005 The Trustees of Princeton University
6 #
7 # $Id: Makefile,v 1.83 2005/12/27 23:19:51 mef Exp $
8 #
9
10 # Default target
11 all:
12
13 #
14 # CVSROOT: CVSROOT to use
15 # INITIAL: CVS tag to use for Source0 tarball
16 # TAG: CVS tag to patch to (if not HEAD)
17 # MODULE: CVS module name to use (if not HEAD)
18 # SPEC: RPM spec file template
19 # RPMBUILD: If not rpmbuild
20 # RPMFLAGS: Miscellaneous RPM flags
21 # CVS_RSH: If not ssh
22 # ALL: default targets
23 #
24 # If INITIAL is different than TAG, PatchSets will be generated
25 # automatically with cvsps(1) to bring Source0 up to TAG. If TAG is
26 # HEAD, a %{date} variable will be defined in the generated spec
27 # file. If a Patch: tag in the spec file matches a generated PatchSet
28 # number, the name of the patch will be as specified. Otherwise, the
29 # name of the patch will be the PatchSet number. %patch tags in the
30 # spec file are generated automatically.
31 #
32
33 # Default values
34 INITIAL := HEAD
35 TAG := HEAD
36 CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
37
38 # By default, the naming convention for built RPMS is
39 # <name>-<version>-<release>.planetlab.<arch>.rpm
40 # Set PLDISTRO on the command line to differentiate between downstream
41 # variants.
42 PLDISTRO := planetlab
43
44 #
45 # kernel
46 #
47
48 kernel-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
49 kernel-MODULE := linux-2.6
50 kernel-SPEC := linux-2.6/scripts/kernel-2.6-planetlab.spec
51 ALL += kernel
52
53 #
54 # vnet
55 #
56
57 vnet-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
58 vnet-MODULE := vnet
59 vnet-SPEC := vnet/vnet.spec
60 ALL += vnet
61
62 # Build kernel first so we can bootstrap off of its build
63 vnet: kernel
64
65 #
66 # util-vserver
67 #
68
69 util-vserver-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
70 util-vserver-MODULE := util-vserver
71 util-vserver-SPEC := util-vserver/util-vserver.spec
72 ALL += util-vserver
73
74 #
75 # lkcdutils
76 #
77
78 lkcdutils-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
79 lkcdutils-MODULE := lkcdutils
80 lkcdutils-SPEC := lkcdutils/spec/lkcdutils.spec
81 ALL += lkcdutils
82
83 # Build kernel first so we can bootstrap off of its build
84 lkcdutils: kernel
85
86 #
87 # yum
88 #
89
90 yum-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
91 yum-MODULE := yum
92 yum-SPEC := yum/yum.spec
93 ALL += yum
94
95 #
96 # ksymoops
97 #
98
99 ksymoops-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
100 ksymoops-INITIAL := ksymoops-2_4_9
101 ksymoops-MODULE := ksymoops
102 ksymoops-SPEC := ksymoops/ksymoops.spec
103 ALL += ksymoops
104
105 #
106 # PlanetLabAccounts
107 #
108
109 PlanetLabAccounts-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
110 PlanetLabAccounts-MODULE := PlanetLabAccounts
111 PlanetLabAccounts-SPEC := PlanetLabAccounts/PlanetLabAccounts.spec
112 ALL += PlanetLabAccounts
113
114 #
115 # NodeUpdate
116 #
117
118 NodeUpdate-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
119 NodeUpdate-MODULE := NodeUpdate
120 NodeUpdate-SPEC := NodeUpdate/NodeUpdate.spec
121 ALL += NodeUpdate
122
123 #
124 # PlanetLabConf
125 #
126
127 PlanetLabConf-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
128 PlanetLabConf-MODULE := PlanetLabConf
129 PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
130 ALL += PlanetLabConf
131
132 #
133 # PlanetLabKeys
134 #
135
136 PlanetLabKeys-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
137 PlanetLabKeys-MODULE := PlanetLabKeys
138 PlanetLabKeys-SPEC := PlanetLabKeys/PlanetLabKeys.spec
139 ALL += PlanetLabKeys
140
141 #
142 # ipod
143 #
144
145 ipod-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
146 ipod-MODULE := ipod
147 ipod-SPEC := ipod/ipod.spec
148 ALL += ipod
149
150 #
151 # sudo
152 #
153
154 sudo-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
155 sudo-MODULE := sudo
156 sudo-SPEC := sudo/planetlab_sudo.spec
157 ALL += sudo
158
159 #
160 # pycurl
161 #
162
163 pycurl-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
164 pycurl-MODULE := pycurl
165 pycurl-SPEC := pycurl/pycurl.spec
166 ALL += pycurl
167
168 #
169 # BootServerRequest
170 #
171
172 BootServerRequest-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
173 BootServerRequest-MODULE := BootServerRequest
174 BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
175 ALL += BootServerRequest
176
177 #
178 # PlanetLabID
179 #
180
181 PlanetLabID-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
182 PlanetLabID-MODULE := PlanetLabID
183 PlanetLabID-SPEC := PlanetLabID/PlanetLabID.spec
184 ALL += PlanetLabID
185
186 #
187 # Node Manager
188 #
189
190 sidewinder-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
191 sidewinder-MODULE := sidewinder
192 sidewinder-SPEC := sidewinder/sidewinder.spec
193 ALL += sidewinder
194
195 #
196 # pl_sshd
197 #
198
199 pl_sshd-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
200 pl_sshd-MODULE := pl_sshd
201 pl_sshd-SPEC := pl_sshd/pl_sshd.spec
202 ALL += pl_sshd
203
204 #
205 # Resource Management Tools
206 #
207
208 resman-CVSROOT := :pserver:anon@build.planet-lab.org:/cvs
209 resman-MODULE := resman
210 resman-SPEC := resman/resman.spec
211 ALL += resman
212
213 #
214 # libhttpd++: 
215 #
216
217 libhttpd++-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
218 libhttpd++-MODULE := libhttpd++
219 libhttpd++-SPEC := libhttpd++/libhttpd++.spec
220 ALL += libhttpd++
221
222 #
223 # Proper: Privileged Operations Service
224 #
225
226 proper-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
227 proper-MODULE := proper
228 proper-SPEC := proper/proper.spec
229 ALL += proper
230
231 proper: libhttpd++
232
233 #
234 # ulogd
235 #
236
237 ulogd-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
238 ulogd-MODULE := ulogd
239 ulogd-SPEC := ulogd/ulogd.spec
240 ALL += ulogd
241
242 ulogd: kernel proper
243
244 #
245 # netflow
246 #
247
248 netflow-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
249 netflow-MODULE := netflow
250 netflow-SPEC := netflow/netflow.spec
251 ALL += netflow
252
253 #
254 # PlanetLab Mom: Cleans up your mess
255 #
256
257 pl_mom-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
258 pl_mom-MODULE := pl_mom
259 pl_mom-SPEC := pl_mom/pl_mom.spec
260 ALL += pl_mom
261
262 #
263 # iptables
264 #
265
266 iptables-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
267 iptables-MODULE := iptables
268 iptables-SPEC := iptables/iptables.spec
269 ALL += iptables
270
271 iptables: kernel
272
273 #
274 # iproute
275 #
276
277 iproute-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
278 iproute-MODULE := iproute2
279 iproute-SPEC := iproute2/iproute.spec
280 ALL += iproute
281
282 iptables: kernel
283
284 #
285 # kexec-tools
286 #
287
288 kexec-tools-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
289 kexec-tools-MODULE := kexec-tools
290 kexec-tools-SPEC := kexec-tools/kexec-tools.spec
291 ALL += kexec-tools
292
293 #
294 # dhcp
295 #
296
297 dhcp-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
298 dhcp-MODULE := dhcp
299 dhcp-SPEC := dhcp/dhcp.spec
300 ALL += dhcp
301
302 #
303 # util-python
304 #
305
306 util-python-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
307 util-python-MODULE := util-python
308 util-python-SPEC := util-python/util-python.spec
309 ALL += util-python
310
311 # proper and util-vserver both use scripts in util-python for building
312 proper: util-python
313 util-vserver: util-python
314
315 #
316 # vserver-reference
317 #
318
319 vserver-reference-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
320 vserver-reference-MODULE := vserver-reference
321 vserver-reference-SPEC := vserver-reference/vserver-reference.spec
322 # Package must be built as root
323 vserver-reference-RPMBUILD := sudo rpmbuild
324 ALL += vserver-reference
325
326 # vserver-reference may require current packages
327 vserver-reference: $(filter-out vserver-reference,$(ALL))
328
329 # ...and the yum manifest
330 vserver-reference: RPMS/yumgroups.xml
331
332 #
333 # bootmanager
334 #
335
336 bootmanager-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
337 bootmanager-MODULE := bootmanager
338 bootmanager-SPEC := bootmanager/bootmanager.spec
339 bootmanager-RPMBUILD := sudo rpmbuild
340 ALL += bootmanager
341
342 # bootmanager requires current packages
343 bootmanager: $(filter-out bootmanager,$(ALL))
344
345 # ...and the yum manifest
346 bootmanager: RPMS/yumgroups.xml
347
348 #
349 # bootcd
350 #
351
352 bootcd-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
353 bootcd-MODULE := bootcd_v3
354 bootcd-SPEC := bootcd_v3/bootcd.spec
355 bootcd-RPMBUILD := sudo rpmbuild
356 ALL += bootcd
357
358 # bootcd requires current packages
359 bootcd: $(filter-out bootcd,$(ALL))
360
361 # ...and the yum manifest
362 bootcd: RPMS/yumgroups.xml
363
364 ifeq ($(findstring $(package),$(ALL)),)
365
366 # Build all packages
367 all: $(ALL)
368         # Create package manifest
369         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/SRPMS" SRPMS > SRPMS/packages.xml
370
371 RPMS/yumgroups.xml:
372         install -D -m 644 groups/v3_yumgroups.xml RPMS/yumgroups.xml
373
374 # Recurse
375 $(ALL):
376         $(MAKE) package=$@
377         yum-arch RPMS
378         yum-arch SRPMS
379
380 # Upload packages to boot server
381 SERVER := build@boot.planet-lab.org
382 ARCHIVE := /var/www/html/install-rpms/archive
383
384 # Put nightly alpha builds in a subdirectory
385 ifeq ($(TAG),HEAD)
386 ARCHIVE := $(ARCHIVE)/planetlab-alpha
387 REPOS := /var/www/html/install-rpms/planetlab-alpha
388 endif
389
390 install:
391 ifeq ($(BASE),)
392         @echo make install is only meant to be called from ./build.sh
393 else
394 ifneq ($(BUILDS),)
395         # Remove old runs
396         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVER) /bin/bash -s
397 endif
398         # Populate repository
399         ssh $(SERVER) mkdir -p $(ARCHIVE)/$(BASE)/RPMS $(ARCHIVE)/$(BASE)/SRPMS
400         rsync --delete --links --perms --times --group --compress --rsh=ssh \
401             $(sort $(subst -debuginfo,,$(wildcard RPMS/yumgroups.xml RPMS/*/*))) $(SERVER):$(ARCHIVE)/$(BASE)/RPMS/
402         ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/RPMS >/dev/null
403         rsync --delete --links --perms --times --group --compress --rsh=ssh \
404             $(wildcard SRPMS/*) $(SERVER):$(ARCHIVE)/$(BASE)/SRPMS/
405         ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/SRPMS >/dev/null
406 ifeq ($(TAG),HEAD)
407         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
408         if ! ssh $(SERVER) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
409             ssh $(SERVER) ln -nsf $(ARCHIVE)/$(BASE)/RPMS/ $(REPOS) ; \
410         fi
411 endif
412 endif
413
414 # Remove files generated by this package
415 $(foreach package,$(ALL),$(package)-clean): %-clean:
416         $(MAKE) package=$* clean
417
418 # Remove all generated files
419 clean:
420         rm -rf BUILD RPMS SOURCES SPECS SRPMS .rpmmacros .cvsps tmp
421
422 .PHONY: all $(ALL) $(foreach package,$(ALL),$(package)-clean) clean
423
424 else
425
426 # Define variables for Makerules
427 CVSROOT := $(if $($(package)-CVSROOT),$($(package)-CVSROOT),$(CVSROOT))
428 INITIAL := $(if $($(package)-INITIAL),$($(package)-INITIAL),$(INITIAL))
429 TAG := $(if $($(package)-TAG),$($(package)-TAG),$(TAG))
430 MODULE := $($(package)-MODULE)
431 SPEC := $($(package)-SPEC)
432 RPMFLAGS := $($(package)-RPMFLAGS)
433 RPMBUILD := $(if $($(package)-RPMBUILD),$($(package)-RPMBUILD),rpmbuild)
434 CVS_RSH := $(if $($(package)-CVS_RSH),$($(package)-CVS_RSH),ssh)
435
436 include Makerules
437
438 endif