By default, the naming convention for built RPMS is
[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.80 2005/11/21 22:37:15 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 # Proper: Privileged Operations Service
215 #
216
217 proper-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
218 proper-MODULE := proper
219 proper-SPEC := proper/proper.spec
220 ALL += proper
221
222 #
223 # ulogd
224 #
225
226 ulogd-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
227 ulogd-MODULE := ulogd
228 ulogd-SPEC := ulogd/ulogd.spec
229 ALL += ulogd
230
231 ulogd: kernel proper
232
233 #
234 # netflow
235 #
236
237 netflow-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
238 netflow-MODULE := netflow
239 netflow-SPEC := netflow/netflow.spec
240 ALL += netflow
241
242 #
243 # PlanetLab Mom: Cleans up your mess
244 #
245
246 pl_mom-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
247 pl_mom-MODULE := pl_mom
248 pl_mom-SPEC := pl_mom/pl_mom.spec
249 ALL += pl_mom
250
251 #
252 # iptables
253 #
254
255 iptables-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
256 iptables-MODULE := iptables
257 iptables-SPEC := iptables/iptables.spec
258 ALL += iptables
259
260 iptables: kernel
261
262 #
263 # kexec-tools
264 #
265
266 kexec-tools-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
267 kexec-tools-MODULE := kexec-tools
268 kexec-tools-SPEC := kexec-tools/kexec-tools.spec
269 ALL += kexec-tools
270
271 #
272 # util-python
273 #
274
275 util-python-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
276 util-python-MODULE := util-python
277 util-python-SPEC := util-python/util-python.spec
278 ALL += util-python
279
280 # proper and util-vserver both use scripts in util-python for building
281 proper: util-python
282 util-vserver: util-python
283
284 #
285 # vserver-reference
286 #
287
288 vserver-reference-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
289 vserver-reference-MODULE := vserver-reference
290 vserver-reference-SPEC := vserver-reference/vserver-reference.spec
291 # Package must be built as root
292 vserver-reference-RPMBUILD := sudo rpmbuild
293 ALL += vserver-reference
294
295 # vserver-reference may require current packages
296 vserver-reference: $(filter-out vserver-reference,$(ALL))
297
298 # ...and the yum manifest
299 vserver-reference: RPMS/yumgroups.xml
300
301 #
302 # bootmanager
303 #
304
305 bootmanager-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
306 bootmanager-MODULE := bootmanager
307 bootmanager-SPEC := bootmanager/bootmanager.spec
308 bootmanager-RPMBUILD := sudo rpmbuild
309 ALL += bootmanager
310
311 # bootmanager requires current packages
312 bootmanager: $(filter-out bootmanager,$(ALL))
313
314 # ...and the yum manifest
315 bootmanager: RPMS/yumgroups.xml
316
317 #
318 # bootcd
319 #
320
321 bootcd-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
322 bootcd-MODULE := bootcd_v3
323 bootcd-SPEC := bootcd_v3/bootcd.spec
324 bootcd-RPMBUILD := sudo rpmbuild
325 ALL += bootcd
326
327 # bootcd requires current packages
328 bootcd: $(filter-out bootcd,$(ALL))
329
330 # ...and the yum manifest
331 bootcd: RPMS/yumgroups.xml
332
333 ifeq ($(findstring $(package),$(ALL)),)
334
335 # Build all packages
336 all: $(ALL)
337         # Create package manifest
338         sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/SRPMS" SRPMS > SRPMS/packages.xml
339
340 RPMS/yumgroups.xml:
341         install -D -m 644 groups/v3_yumgroups.xml RPMS/yumgroups.xml
342
343 # Recurse
344 $(ALL):
345         $(MAKE) package=$@
346         yum-arch RPMS
347         yum-arch SRPMS
348
349 # Upload packages to boot server
350 SERVER := build@boot.planet-lab.org
351 ARCHIVE := /var/www/html/install-rpms/archive
352
353 # Put nightly alpha builds in a subdirectory
354 ifeq ($(TAG),HEAD)
355 ARCHIVE := $(ARCHIVE)/planetlab-alpha
356 REPOS := /var/www/html/install-rpms/planetlab-alpha
357 endif
358
359 install:
360 ifeq ($(BASE),)
361         @echo make install is only meant to be called from ./build.sh
362 else
363 ifneq ($(BUILDS),)
364         # Remove old runs
365         echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVER) /bin/bash -s
366 endif
367         # Populate repository
368         ssh $(SERVER) mkdir -p $(ARCHIVE)/$(BASE)/RPMS $(ARCHIVE)/$(BASE)/SRPMS
369         rsync --delete --links --perms --times --group --compress --rsh=ssh \
370             $(sort $(subst -debuginfo,,$(wildcard RPMS/yumgroups.xml RPMS/*/*))) $(SERVER):$(ARCHIVE)/$(BASE)/RPMS/
371         ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/RPMS >/dev/null
372         rsync --delete --links --perms --times --group --compress --rsh=ssh \
373             $(wildcard SRPMS/*) $(SERVER):$(ARCHIVE)/$(BASE)/SRPMS/
374         ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/SRPMS >/dev/null
375 ifeq ($(TAG),HEAD)
376         # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
377         if ! ssh $(SERVER) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
378             ssh $(SERVER) ln -nsf $(ARCHIVE)/$(BASE)/RPMS/ $(REPOS) ; \
379         fi
380 endif
381 endif
382
383 # Remove files generated by this package
384 $(foreach package,$(ALL),$(package)-clean): %-clean:
385         $(MAKE) package=$* clean
386
387 # Remove all generated files
388 clean:
389         rm -rf BUILD RPMS SOURCES SPECS SRPMS .rpmmacros .cvsps tmp
390
391 .PHONY: all $(ALL) $(foreach package,$(ALL),$(package)-clean) clean
392
393 else
394
395 # Define variables for Makerules
396 CVSROOT := $(if $($(package)-CVSROOT),$($(package)-CVSROOT),$(CVSROOT))
397 INITIAL := $(if $($(package)-INITIAL),$($(package)-INITIAL),$(INITIAL))
398 TAG := $(if $($(package)-TAG),$($(package)-TAG),$(TAG))
399 MODULE := $($(package)-MODULE)
400 SPEC := $($(package)-SPEC)
401 RPMFLAGS := $($(package)-RPMFLAGS)
402 RPMBUILD := $(if $($(package)-RPMBUILD),$($(package)-RPMBUILD),rpmbuild)
403 CVS_RSH := $(if $($(package)-CVS_RSH),$($(package)-CVS_RSH),ssh)
404
405 include Makerules
406
407 endif