#
# PlanetLab RPM generation
#
-# Copyright (c) 2003 The Trustees of Princeton University (Trustees).
-# All Rights Reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-#
-# * Neither the name of the copyright holder nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TRUSTEES OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# $Id: Makefile,v 1.60 2005/01/10 20:39:42 mlhuang Exp $
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2003-2005 The Trustees of Princeton University
+#
+# $Id: Makefile,v 1.67 2005/05/04 20:05:53 mlhuang Exp $
#
# Default target
# spec file are generated automatically.
#
-# Default tags
+# Default values
INITIAL := HEAD
TAG := HEAD
+CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
#
# kernel
iptables: kernel
-ifeq ($(findstring $(package),$(ALL)),)
+#
+# kexec-tools
+#
+
+kexec-tools-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
+kexec-tools-MODULE := kexec-tools
+kexec-tools-SPEC := kexec-tools/kexec-tools.spec
+ALL += kexec-tools
+
+#
+# Request Tracker 3
+#
+
+rt3-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
+rt3-MODULE := rt3
+rt3-SPEC := rt3/etc/rt.spec
+ALL += rt3
+
+#
+# Mail::SpamAssassin
+#
+
+spamassassin-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
+spamassassin-MODULE := spamassassin
+spamassassin-SPEC := spamassassin/spamassassin.spec
+ALL += spamassassin
+
+PACKAGES := $(ALL)
+
+#
+# Non-default packages
+#
+
+#
+# PlanetLab Central Server Management
+#
+
+plc-CVSROOT := :ext:cvs.planet-lab.org:/cvs
+plc-MODULE := plc
+plc-SPEC := plc/plc.spec
+PACKAGES += plc
+
+ifeq ($(findstring $(package),$(PACKAGES)),)
# Build all packages
all: $(ALL)
+ # XXX Should check out a tagged version of yumgroups.xml
+ cvs -d $(CVSROOT) checkout -p alpina/groups/v3_yumgroups.xml > RPMS/yumgroups.xml
+ # Create package manifest
+ sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/SRPMS" SRPMS > SRPMS/packages.xml
# Recurse
-$(ALL):
+$(PACKAGES):
$(MAKE) package=$@
+# Upload packages to boot server
+SERVER := build@boot.planet-lab.org
+ARCHIVE := /var/www/html/install-rpms/archive
+
+# Put nightly alpha builds in a subdirectory
+ifeq ($(TAG),HEAD)
+ARCHIVE := $(ARCHIVE)/planetlab-alpha
+REPOS := /var/www/html/install-rpms/planetlab-alpha
+endif
+
+install:
+ifeq ($(BASE),)
+ @echo make install is only meant to be called from ./build.sh
+else
+ifneq ($(BUILDS),)
+ # Remove old runs
+ echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVER) /bin/bash -s
+endif
+ # Populate repository
+ ssh $(SERVER) mkdir -p $(ARCHIVE)/$(BASE)/RPMS $(ARCHIVE)/$(BASE)/SRPMS
+ rsync --links --perms --times --group --compress --rsh=ssh \
+ $(sort $(subst -debuginfo,,$(wildcard RPMS/yumgroups.xml RPMS/*/*))) $(SERVER):$(ARCHIVE)/$(BASE)/RPMS/
+ ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/RPMS >/dev/null
+ rsync --links --perms --times --group --compress --rsh=ssh \
+ $(wildcard SRPMS/*) $(SERVER):$(ARCHIVE)/$(BASE)/SRPMS/
+ ssh $(SERVER) yum-arch $(ARCHIVE)/$(BASE)/SRPMS >/dev/null
+ifeq ($(TAG),HEAD)
+ # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
+ if ! ssh $(SERVER) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
+ ssh $(SERVER) ln -nsf $(ARCHIVE)/$(BASE)/RPMS/ $(REPOS) ; \
+ fi
+endif
+endif
+
# Remove files generated by this package
-$(foreach package,$(ALL),$(package)-clean): %-clean:
+$(foreach package,$(PACKAGES),$(package)-clean): %-clean:
$(MAKE) package=$* clean
# Remove all generated files
clean:
rm -rf BUILD RPMS SOURCES SPECS SRPMS .rpmmacros .cvsps
-.PHONY: all $(ALL) $(foreach package,$(ALL),$(package)-clean) clean
+.PHONY: all $(PACKAGES) $(foreach package,$(PACKAGES),$(package)-clean) clean
else
# Define variables for Makerules
-CVSROOT := $($(package)-CVSROOT)
+CVSROOT := $(if $($(package)-CVSROOT),$($(package)-CVSROOT),$(CVSROOT))
INITIAL := $(if $($(package)-INITIAL),$($(package)-INITIAL),$(INITIAL))
TAG := $(if $($(package)-TAG),$($(package)-TAG),$(TAG))
MODULE := $($(package)-MODULE)