a6e9d6070c94cf521ad8c31006277df23e40ad4c
[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.81 2005/12/02 18:54:55 mlhuang 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 # kexec-tools
275 #
276
277 kexec-tools-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
278 kexec-tools-MODULE := kexec-tools
279 kexec-tools-SPEC := kexec-tools/kexec-tools.spec
280 ALL += kexec-tools
281
282 #
283 # util-python
284 #
285
286 util-python-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
287 util-python-MODULE := util-python
288 util-python-SPEC := util-python/util-python.spec
289 ALL += util-python
290
291 # proper and util-vserver both use scripts in util-python for building
292 proper: util-python
293 util-vserver: util-python
294
295 #
296 # vserver-reference
297 #
298
299 vserver-reference-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
300 vserver-reference-MODULE := vserver-reference
301 vserver-reference-SPEC := vserver-reference/vserver-reference.spec
302 # Package must be built as root
303 vserver-reference-RPMBUILD := sudo rpmbuild
304 ALL += vserver-reference
305
306 # vserver-reference may require current packages
307 vserver-reference: $(filter-out vserver-reference,$(ALL))
308
309 # ...and the yum manifest
310 vserver-reference: RPMS/yumgroups.xml
311
312 #
313 # bootmanager
314 #
315
316 bootmanager-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
317 bootmanager-MODULE := bootmanager
318 bootmanager-SPEC := bootmanager/bootmanager.spec
319 bootmanager-RPMBUILD := sudo rpmbuild
320 ALL += bootmanager
321
322 # bootmanager requires current packages
323 bootmanager: $(filter-out bootmanager,$(ALL))
324
325 # ...and the yum manifest
326 bootmanager: RPMS/yumgroups.xml
327
328 #
329 # bootcd
330 #
331
332 bootcd-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
333 bootcd-MODULE := bootcd_v3
334 bootcd-SPEC := bootcd_v3/bootcd.spec
335 bootcd-RPMBUILD := sudo rpmbuild
336 ALL += bootcd
337
338 # bootcd requires current packages
339 bootcd: $(filter-out bootcd,$(ALL))
340
341 # ...and the yum manifest
342 bootcd: RPMS/yumgroups.xml
343
344 ifeq ($(findstring $(package),$(ALL)),)
345
346 # Build all packages
347 all: $(ALL)
348         # Create package manifest
349         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/SRPMS" SRPMS > SRPMS/packages.xml
350
351 RPMS/yumgroups.xml:
352         install -D -m 644 groups/v3_yumgroups.xml RPMS/yumgroups.xml
353
354 # Recurse
355 $(ALL):
356         $(MAKE) package=$@
357         yum-arch RPMS
358         yum-arch SRPMS
359
360 # Upload packages to boot server
361 SERVER := build@boot.planet-lab.org
362 ARCHIVE := /var/www/html/install-rpms/archive
363
364 # Put nightly alpha builds in a subdirectory
365 ifeq ($(TAG),HEAD)
366 ARCHIVE := $(ARCHIVE)/planetlab-alpha
367 REPOS := /var/www/html/install-rpms/planetlab-alpha
368 endif
369
370 install:
371 ifeq ($(BASE),)
372         @echo make install is only meant to be called from ./build.sh
373 else
374 ifneq ($(BUILDS),)
375         # Remove old runs
376         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVER) /bin/bash -s
377 endif
378         # Populate repository
379         ssh $(SERVER) mkdir -p $(ARCHIVE)/$(BASE)/RPMS $(ARCHIVE)/$(BASE)/SRPMS
380         rsync --delete --links --perms --times --group --compress --rsh=ssh \
381             $(sort $(subst -debuginfo,,$(wildcard RPMS/yumgroups.xml RPMS/*/*))) $(SERVER):$(ARCHIVE)/$(BASE)/RPMS/
382         ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/RPMS >/dev/null
383         rsync --delete --links --perms --times --group --compress --rsh=ssh \
384             $(wildcard SRPMS/*) $(SERVER):$(ARCHIVE)/$(BASE)/SRPMS/
385         ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/SRPMS >/dev/null
386 ifeq ($(TAG),HEAD)
387         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
388         if ! ssh $(SERVER) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
389             ssh $(SERVER) ln -nsf $(ARCHIVE)/$(BASE)/RPMS/ $(REPOS) ; \
390         fi
391 endif
392 endif
393
394 # Remove files generated by this package
395 $(foreach package,$(ALL),$(package)-clean): %-clean:
396         $(MAKE) package=$* clean
397
398 # Remove all generated files
399 clean:
400         rm -rf BUILD RPMS SOURCES SPECS SRPMS .rpmmacros .cvsps tmp
401
402 .PHONY: all $(ALL) $(foreach package,$(ALL),$(package)-clean) clean
403
404 else
405
406 # Define variables for Makerules
407 CVSROOT := $(if $($(package)-CVSROOT),$($(package)-CVSROOT),$(CVSROOT))
408 INITIAL := $(if $($(package)-INITIAL),$($(package)-INITIAL),$(INITIAL))
409 TAG := $(if $($(package)-TAG),$($(package)-TAG),$(TAG))
410 MODULE := $($(package)-MODULE)
411 SPEC := $($(package)-SPEC)
412 RPMFLAGS := $($(package)-RPMFLAGS)
413 RPMBUILD := $(if $($(package)-RPMBUILD),$($(package)-RPMBUILD),rpmbuild)
414 CVS_RSH := $(if $($(package)-CVS_RSH),$($(package)-CVS_RSH),ssh)
415
416 include Makerules
417
418 endif