-# Installation rules
-#
-
-# Upload packages to boot server
-SERVERA := build@boot1.planet-lab.org
-SERVERB := build@boot2.planet-lab.org
-ARCHIVE := /plc/data/var/www/html/install-rpms/archive
-
-# Put nightly alpha builds in a subdirectory
-ifeq ($(TAG),HEAD)
-ARCHIVE := $(ARCHIVE)/planetlab-alpha
-REPOS := /plc/data/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 ($(wildcard /etc/planetlab/secring.gpg),)
- # Sign all RPMS. setsid detaches rpm from the terminal,
- # allowing the (hopefully blank) GPG password to be entered
- # from stdin instead of /dev/tty. Obviously, the build server
- # should be secure.
- echo | setsid rpm \
- --define "_signature gpg" \
- --define "_gpg_path /etc/planetlab" \
- --define "_gpg_name PlanetLab <info@planet-lab.org>" \
- --resign RPMS/*/*.rpm
-endif
-ifneq ($(BUILDS),)
- # Remove old runs
- echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERA) /bin/bash -s
- echo "cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf" | ssh $(SERVERB) /bin/bash -s
-endif
- # Create package manifest
- sh ./packages.sh -b "http://build.planet-lab.org/$(subst $(HOME)/,,$(shell pwd))/RPMS" RPMS > packages.xml
- # Update yum metadata
- yum-arch RPMS >/dev/null
- createrepo -g yumgroups.xml RPMS >/dev/null
- # Populate repository
- rsync \
- --exclude '*-debuginfo-*' \
- --recursive --links --perms --times --group --compress --rsh=ssh \
- RPMS/ $(SERVERA):$(ARCHIVE)/$(BASE)
- rsync \
- --exclude '*-debuginfo-*' \
- --recursive --links --perms --times --group --compress --rsh=ssh \
- RPMS/ $(SERVERB):$(ARCHIVE)/$(BASE)
-ifeq ($(TAG),HEAD)
- # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
- if ! ssh $(SERVERA) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
- ssh $(SERVERA) ln -nsf archive/$(BASE) $(REPOS) ; \
- fi
- # Update nightly alpha symlink if it does not exist or is broken, or it is Monday
- if ! ssh $(SERVERB) "[ -e $(REPOS) ] && exit 0 || exit 1" || [ "$(shell date +%A)" = "Monday" ] ; then \
- ssh $(SERVERB) ln -nsf archive/$(BASE) $(REPOS) ; \
- fi
-
-endif
-endif
-
-.PHONY: install
+vserver-MODULES := VserverReference build
+vserver-SPEC := vserver-reference.spec
+# Package must be built as root
+vserver-RPMBUILD := sudo bash ./rpmbuild.sh
+# this list is useful for manual builds only, since nightly builds
+# always redo all sequentially - try to keep updated
+vserver-DEPEND-PACKAGES := $(IN_VSERVER)
+vserver-DEPEND-FILES := RPMS/yumgroups.xml
+vserver-RPMDATE := yes
+ALL += vserver
+IN_BOOTSTRAPFS += vserver
+
+#
+# bootstrapfs
+#
+bootstrapfs-MODULES := BootstrapFS build
+bootstrapfs-SPEC := bootstrapfs.spec
+bootstrapfs-RPMBUILD := sudo bash ./rpmbuild.sh
+# package requires all regular packages
+bootstrapfs-DEPEND-PACKAGES := $(IN_BOOTSTRAPFS)
+bootstrapfs-DEPEND-FILES := RPMS/yumgroups.xml
+bootstrapfs-RPMDATE := yes
+ALL += bootstrapfs
+IN_MYPLC += bootstrapfs
+
+#
+# noderepo
+#
+# all rpms resulting from packages marked as being in bootstrapfs and vserver
+NODEREPO_RPMS = $(foreach package,$(IN_BOOTSTRAPFS) $(IN_VSERVER),$($(package).rpms))
+# replace space with +++ (specvars cannot deal with spaces)
+SPACE=$(subst x, ,x)
+NODEREPO_RPMS_3PLUS = $(subst $(SPACE),+++,$(NODEREPO_RPMS))
+
+noderepo-MODULES := BootstrapFS
+noderepo-SPEC := noderepo.spec
+noderepo-RPMBUILD := sudo bash ./rpmbuild.sh
+# package requires all regular packages
+noderepo-DEPEND-PACKAGES := $(IN_BOOTSTRAPFS) $(IN_VSERVER)
+noderepo-DEPEND-FILES := RPMS/yumgroups.xml
+#export rpm list to the specfile
+noderepo-SPECVARS = node_rpms_plus=$(NODEREPO_RPMS_3PLUS)
+noderepo-RPMDATE := yes
+ALL += noderepo
+IN_MYPLC += noderepo
+
+#
+# MyPLC native : lightweight packaging, dependencies are yum-installed in a vserver
+#
+myplc-native-MODULES := MyPLC build
+myplc-native-SPEC := myplc-native.spec
+# Package must be built as root
+myplc-native-RPMBUILD := sudo bash ./rpmbuild.sh
+# Thierry : don't depend on anything at build-time
+#myplc-native-DEPEND-PACKAGES :=
+# Thierry : dunno about this one, let's stay safe
+myplc-native-DEPEND-FILES := myplc-release
+ALL += myplc-native
+
+## #
+## # myplc : old-fashioned, chroot-based packaging
+## #
+## myplc-MODULES := MyPLC build
+## myplc-SPEC := myplc.spec
+## # Package must be built as root
+## myplc-RPMBUILD := sudo bash ./rpmbuild.sh
+## # myplc may require all packages
+## myplc-DEPEND-PACKAGES := $(IN_MYPLC)
+## myplc-DEPEND-FILES := RPMS/yumgroups.xml myplc-release
+## myplc-RPMDATE := yes
+## ALL += myplc
+
+# myplc-docs only contains docs for PLCAPI and NMAPI, but
+# we still need to pull MyPLC, as it is where the specfile lies,
+# together with the utility script docbook2drupal.sh
+myplc-docs-MODULES := MyPLC PLCAPI NodeManager
+myplc-docs-SPEC := myplc-docs.spec
+ALL += myplc-docs