#
# PlanetLab standard components list
-#
+# initial version from Mark Huang
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2003-2006 The Trustees of Princeton University
+# rewritten by Thierry Parmentelat - INRIA Sophia Antipolis
#
-# $Id: planetlab.mk,v 1.67.2.5 2007/09/06 21:01:20 mef Exp $
-#
-
-#
-# Required:
-#
-# CVSROOT or package-CVSROOT: CVSROOT to use
-# TAG or package-TAG: CVS tag to use
-# package-MODULE: CVS module name to use
-# package-SPEC: RPM spec file template
-#
-# Optional:
-#
-# package-RPMFLAGS: Miscellaneous RPM flags
-# package-RPMBUILD: If not rpmbuild
-# package-CVS_RSH: If not ssh
-#
-# Add to ALL if you want the package built as part of the default set.
+# $Id$
#
-
-#
-# Default values
+# see doc in Makefile
#
-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
-TAG := HEAD
-
-# Check if a tag has been checked out
-ifneq ($(wildcard CVS/Root),)
-# Check if we are able to access CVS
-CVSTAG := $(shell cvs status planetlab.mk 2>/dev/null | sed -ne 's/[[:space:]]*Sticky Tag:[[:space:]]*\([^[:space:]]*\).*/\1/p')
-ifneq ($(CVSTAG),)
-CVSROOT := $(shell cat CVS/Root)
-ifeq ($(CVSTAG),(none))
-TAG := HEAD
-else
-TAG := $(CVSTAG)
-endif
-endif
-endif
-
#
# kernel
#
+# use a package name with srpm in it:
+# so the source rpm is created by running make srpm in the codebase
+#
-# Figure out whether we are building on i386 or x86_64 host
-HOSTARCH := $(shell uname -i)
-
-kernel-$(HOSTARCH)-MODULE := linux-2.6
-kernel-$(HOSTARCH)-SPEC := linux-2.6/scripts/kernel-2.6-planetlab.spec
-ifeq ($(HOSTARCH),i386)
-kernel-$(HOSTARCH)-RPMFLAGS:= --target i686
+kernel-MODULES := linux-2.6
+kernel-SPEC := kernel-2.6.spec
+kernel-BUILD-FROM-SRPM := yes
+ifeq "$(HOSTARCH)" "i386"
+kernel-RPMFLAGS:= --target i686
else
-kernel-$(HOSTARCH)-RPMFLAGS:= --target $(HOSTARCH)
+kernel-RPMFLAGS:= --target $(HOSTARCH)
endif
+KERNELS += kernel
-ALL += kernel-$(HOSTARCH)
+kernels: $(KERNELS)
+kernels-clean: $(foreach package,$(KERNELS),$(package)-clean)
-kernel-clean: kernel-$(HOSTARCH)-clean
-kernel: kernel-$(HOSTARCH)
+ALL += $(KERNELS)
+# this is to mark on which image a given rpm is supposed to go
+IN_BOOTCD += $(KERNELS)
+IN_VSERVER += $(KERNELS)
+IN_BOOTSTRAPFS += $(KERNELS)
+# turns out myplc installs kernel-vserver
+IN_MYPLC += $(KERNELS)
#
-# madwifi
+# kexec-tools
#
-
-madwifi-ng-MODULE := madwifi-ng
-madwifi-ng-SPEC := madwifi-ng/madwifi.spec
-#ALL += madwifi-ng
-
-# Build kernel first so we can bootstrap off of its build
-madwifi-ng: kernel
+ifeq "$(DISTRONAME)" "fc4"
+kexec-tools-MODULES := kexec-tools
+kexec-tools-SPEC := kexec-tools.spec
+kexec-tools-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
+kexec-tools-TAG := planetlab-4_1-rc2
+ALL += kexec-tools
+IN_BOOTCD += kexec-tools
+endif
#
-# ivtv
+# madwifi
#
-
-ivtv-MODULE := ivtv
-ivtv-SPEC := ivtv/ivtv.spec
-#ALL += ivtv
+madwifi-MODULES := madwifi
+madwifi-SPEC := madwifi.spec
+madwifi-BUILD-FROM-SRPM := yes
+madwifi-DEPEND-DEVEL-RPMS := kernel-devel
+madwifi-SPECVARS = kernel_version=$(kernel.rpm-version) \
+ kernel_release=$(kernel.rpm-release) \
+ kernel_arch=$(kernel.rpm-arch)
+ALL += madwifi
+IN_BOOTSTRAPFS += madwifi
#
# util-vserver
#
-
-util-vserver-MODULE := util-vserver
-util-vserver-SPEC := util-vserver/util-vserver.spec
+util-vserver-MODULES := util-vserver
+util-vserver-SPEC := util-vserver.spec
util-vserver-RPMFLAGS:= --without dietlibc
ALL += util-vserver
+IN_BOOTSTRAPFS += util-vserver
#
-# PlanetLabAccounts
+# util-vserver-pl
#
-
-PlanetLabAccounts-MODULE := PlanetLabAccounts
-PlanetLabAccounts-SPEC := PlanetLabAccounts/PlanetLabAccounts.spec
-ALL += PlanetLabAccounts
+util-vserver-pl-MODULES := util-vserver-pl
+util-vserver-pl-SPEC := util-vserver-pl.spec
+util-vserver-pl-DEPEND-DEVEL-RPMS := util-vserver-lib util-vserver-devel util-vserver-core
+ALL += util-vserver-pl
+IN_BOOTSTRAPFS += util-vserver-pl
#
# NodeUpdate
#
-
-NodeUpdate-MODULE := NodeUpdate
-NodeUpdate-SPEC := NodeUpdate/NodeUpdate.spec
+NodeUpdate-MODULES := NodeUpdate
+NodeUpdate-SPEC := NodeUpdate.spec
ALL += NodeUpdate
-
-#
-# PlanetLabConf
-#
-
-PlanetLabConf-MODULE := PlanetLabConf
-PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
-ALL += PlanetLabConf
+IN_BOOTSTRAPFS += NodeUpdate
#
# ipod
#
-
-ipod-MODULE := ipod
-ipod-SPEC := ipod/ipod.spec
+ipod-MODULES := PingOfDeath
+ipod-SPEC := ipod.spec
ALL += ipod
+IN_BOOTSTRAPFS += ipod
#
-# sudo
-#
-
-sudo-MODULE := sudo
-sudo-SPEC := sudo/planetlab_sudo.spec
-ALL += sudo
-
-#
-# pycurl
-#
-
-curl_vernum := $(shell printf %d 0x$(shell curl-config --vernum))
-pycurl_vernum := $(shell printf %d 0x070d01) # 7.13.1
-pycurl_incompatnum := $(shell printf %d 0x071000) # 7.16.0
-ifeq ($(shell test $(curl_vernum) -ge $(pycurl_vernum) && echo 1),1)
-ifeq ($(shell test $(curl_vernum) -ge $(pycurl_incompatnum) && echo 0),1)
-pycurl-MODULE := pycurl
-pycurl-SPEC := pycurl/pycurl.spec
-ALL += pycurl
-endif
-endif
-
-#
-# BootServerRequest
-#
-
-BootServerRequest-MODULE := BootServerRequest
-BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
-ALL += BootServerRequest
-
-#
-# Node Manager
+# NodeManager
#
-
-NodeManager-MODULE := NodeManager
-NodeManager-SPEC := NodeManager/NodeManager.spec
+NodeManager-MODULES := NodeManager
+NodeManager-SPEC := NodeManager.spec
ALL += NodeManager
+IN_BOOTSTRAPFS += NodeManager
#
# pl_sshd
#
-
-pl_sshd-MODULE := pl_sshd
-pl_sshd-SPEC := pl_sshd/pl_sshd.spec
+pl_sshd-MODULES := pl_sshd
+pl_sshd-SPEC := pl_sshd.spec
ALL += pl_sshd
+IN_BOOTSTRAPFS += pl_sshd
#
-# libhttpd++:
-#
-
-libhttpd++-MODULE := libhttpd++
-libhttpd++-SPEC := libhttpd++/libhttpd++.spec
-ALL += libhttpd++
-
-#
-# Proper: Privileged Operations Service
-#
-
-proper-MODULE := proper
-proper-SPEC := proper/proper.spec
-proper-RPMBUILD := sudo sh .rpmbuild.sh
-ALL += proper
-
-proper: libhttpd++
-
-#
-# CoDemux: Port 80 demux
-#
-
-codemux-MODULE := codemux
-codemux-SPEC := codemux/codemux.spec
-#ALL += codemux
-
-#
-# MySQL
+# codemux: Port 80 demux
#
-
-mysql-MODULE := mysql
-mysql-SPEC := mysql/mysql.spec
-#ALL += mysql
+codemux-MODULES := CoDemux
+codemux-SPEC := codemux.spec
+codemux-RPMBUILD := sudo bash ./rpmbuild.sh
+ALL += codemux
+IN_BOOTSTRAPFS += codemux
#
-# ulogd
+# fprobe-ulog
#
-
-ulogd-MODULE := ulogd
-ulogd-SPEC := ulogd/ulogd.spec
-ALL += ulogd
-
-ulogd: kernel proper #mysql
+fprobe-ulog-MODULES := fprobe-ulog
+fprobe-ulog-SPEC := fprobe-ulog.spec
+ALL += fprobe-ulog
+IN_BOOTSTRAPFS += fprobe-ulog
#
-# netflow
+# pf2slice
#
-
-netflow-MODULE := netflow
-netflow-SPEC := netflow/netflow.spec
-ALL += netflow
-
-netflow: #mysql
+pf2slice-MODULES := pf2slice
+pf2slice-SPEC := pf2slice.spec
+ALL += pf2slice
#
# PlanetLab Mom: Cleans up your mess
#
-
-pl_mom-MODULE := pl_mom
-pl_mom-SPEC := pl_mom/pl_mom.spec
+pl_mom-MODULES := Mom
+pl_mom-SPEC := pl_mom.spec
ALL += pl_mom
+IN_BOOTSTRAPFS += pl_mom
#
# iptables
#
-
-iptables-MODULE := iptables
-iptables-SPEC := iptables/iptables.spec
+iptables-MODULES := iptables
+iptables-SPEC := iptables.spec
+iptables-DEPEND-DEVEL-RPMS := kernel-devel
ALL += iptables
-
-iptables: kernel
+IN_BOOTSTRAPFS += iptables
#
# iproute
#
-
-iproute-MODULE := iproute2
-iproute-SPEC := iproute2/iproute.spec
+iproute-MODULES := iproute2
+iproute-SPEC := iproute.spec
ALL += iproute
+IN_BOOTSTRAPFS += iproute
+IN_VSERVER += iproute
+IN_BOOTCD += iproute
#
-# kexec-tools
-#
-
-kexec-tools-MODULE := kexec-tools
-kexec-tools-SPEC := kexec-tools/kexec-tools.spec
-ALL += kexec-tools
-
-#
-# util-python
+# vsys
#
+vsys_support=yes
+ifeq "$(DISTRONAME)" "fc4"
+vsys_support=
+endif
+ifeq "$(DISTRONAME)" "fc6"
+vsys_support=
+endif
+# cannot find the required packages (see devel.pkgs) on centos5
+ifeq "$(DISTRONAME)" "centos5"
+vsys_support=
+endif
-util-python-MODULE := util-python
-util-python-SPEC := util-python/util-python.spec
-ALL += util-python
-
-# proper and util-vserver both use scripts in util-python for building
-proper: util-python
-util-vserver: util-python
-PlanetLabAuth: util-python
+ifeq "$(vsys_support)" "yes"
+vsys-MODULES := vsys
+vsys-SPEC := vsys.spec
+IN_BOOTSTRAPFS += vsys
+ALL += vsys
+endif
#
# PLCAPI
#
-
-PLCAPI-MODULE := new_plc_api
-PLCAPI-SPEC := new_plc_api/PLCAPI.spec
+PLCAPI-MODULES := PLCAPI
+PLCAPI-SPEC := PLCAPI.spec
ALL += PLCAPI
+IN_MYPLC += PLCAPI
#
# PLCWWW
#
-
-PLCWWW-MODULE := new_plc_www
-PLCWWW-SPEC := new_plc_www/PLCWWW.spec
+PLCWWW-MODULES := PLCWWW
+PLCWWW-SPEC := PLCWWW.spec
ALL += PLCWWW
+IN_MYPLC += PLCWWW
#
-# vserver-reference
+# monitor
#
+Monitor-MODULES := Monitor
+Monitor-SPEC := Monitor.spec
+ALL += Monitor
+IN_BOOTSTRAPFS += Monitor
-vserver-reference-MODULE := vserver-reference build
-vserver-reference-SPEC := vserver-reference/vserver-reference.spec
-# Package must be built as root
-vserver-reference-RPMBUILD := sudo sh .rpmbuild.sh
-ALL += vserver-reference
+#
+# monitor-server
+#
+monitor-server-MODULES := Monitor
+monitor-server-SPEC := monitor-server.spec
+ALL += monitor-server
-# vserver-reference may require current packages
-vserver-reference: $(filter-out vserver-reference,$(ALL))
+#
+# nodeconfig
+#
+nodeconfig-MODULES := nodeconfig
+nodeconfig-SPEC := nodeconfig.spec
+ALL += nodeconfig
+IN_MYPLC += nodeconfig
#
# bootmanager
#
-
-bootmanager-MODULE := bootmanager build
-bootmanager-SPEC := bootmanager/bootmanager.spec
-bootmanager-RPMBUILD := sudo sh .rpmbuild.sh
+bootmanager-MODULES := BootManager
+bootmanager-SPEC := bootmanager.spec
ALL += bootmanager
+IN_MYPLC += bootmanager
-# bootmanager requires current packages
-bootmanager: $(filter-out bootmanager,$(ALL))
-
-# ...and the yum manifest
-bootmanager: RPMS/yumgroups.xml
+#
+# pypcilib : used in bootcd
+#
+pypcilib-MODULES := pypcilib
+pypcilib-SPEC := pypcilib.spec
+ALL += pypcilib
+IN_BOOTCD += pypcilib
#
# bootcd
#
-
-bootcd-MODULE := bootcd build bootmanager
-bootcd-SPEC := bootcd/bootcd.spec
-bootcd-RPMBUILD := sudo sh .rpmbuild.sh
+bootcd-MODULES := BootCD build
+bootcd-SPEC := bootcd.spec
+bootcd-RPMBUILD := sudo bash ./rpmbuild.sh
+# package has *some* dependencies, at least these ones
+bootcd-DEPEND-PACKAGES := $(IN_BOOTCD)
+bootcd-DEPEND-FILES := RPMS/yumgroups.xml
+bootcd-RPMDATE := yes
ALL += bootcd
-
-# bootcd requires current packages
-bootcd: $(filter-out bootcd,$(ALL))
+IN_MYPLC += bootcd
#
-# MyPLC
+# vserver : reference image for slices
#
-
-myplc-MODULE := build myplc new_plc_www plc/scripts
-myplc-SPEC := myplc/myplc.spec
-# Package must be built as root
-myplc-RPMBUILD := sudo sh .rpmbuild.sh
-ALL += myplc
-
-# MyPLC may require current packages
-myplc: $(filter-out myplc,$(ALL))
-
-# ...and the yum manifest
-myplc: RPMS/yumgroups.xml
-
-#
-# MyPLC development environment
-#
-
-myplc-devel-MODULE := build myplc
-myplc-devel-SPEC := myplc/myplc-devel.spec
+vserver-MODULES := VserverReference build
+vserver-SPEC := vserver-reference.spec
# Package must be built as root
-myplc-devel-RPMBUILD := sudo sh .rpmbuild.sh
-ALL += myplc-devel
-
-#
-# MyPLC native
-#
-
-myplc-native-MODULE := build myplc plc/scripts
-myplc-native-SPEC := myplc/myplc-native.spec
+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 sh .rpmbuild.sh
+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 may require current packages
-myplc-native: $(filter-out myplc,$(ALL))
-
-# ...and the yum manifest
-myplc-native: RPMS/yumgroups.xml
-#
-# libnl
-#
-
-libnl-MODULE := libnl
-libnl-SPEC := libnl/libnl.spec
-ALL += libnl
-
-util-vserver: libnl
-
-#
-# 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
-
-RPMS/yumgroups.xml:
- install -D -m 644 groups/v4_yumgroups.xml RPMS/yumgroups.xml
-
-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
+## #
+## # 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