more doc in Makefile - normalized package names from the actual rpm names
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 19 Nov 2007 10:49:55 +0000 (10:49 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 19 Nov 2007 10:49:55 +0000 (10:49 +0000)
Makefile
planetlab-tags.mk
planetlab.mk

index 175b617..2a38747 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,113 @@
 #
 ### $Id$
 # 
-# run 'make help' for more info
+####################
+# invokation:
+#
+# (*) make stage1=true
+#     this extracts all specfiles and computes .mk from specfiles
+#     you need to specify PLDISTRO here if relevant - see below
+# (*) make help
+#     for more info on how to invoke this stuff
+#
+#################### (fedora) distributions
+#
+# (*) as of nov. 2007, myplc-devel is deprecated
+# (*) instead, we create a fresh vserver that holds required tools (see e.g. planetlab-fc6-devel.lst)
+# (*) the build uses the current fedora version as a target for the produced images
+# (*) so you simply need to create a fedora 8 build image for building fedora-8 images 
+#     
+#################### (planetlab) distributions
+#
+# (*) the default distribution is called 'planetlab'
+# (*) you may define an alternative distribution, e.g. onelab
+# in this case you need to
+# (*) create onelab.mk that defines your *packages* (see below)
+# (*) create onelab-tags.mk that defines where to fetch your *modules*
+# (*) create your main yumgroups.xml as groups/<distro>.xml
+# (*) there are also various places where a set of modules are defined.
+#     check for .lst files in the various modules that build root images
+#     and mimick what's done for planetlab 
+# (*) then you need to run 
+#     make stage1=true PLDISTRO=onelab
+#
+#################### 
+# This build deals with 2 kinds of objects
+# 
+# (*) packages are named upon the RPM name; they are moslty lowercase
+#     Add a package to ALL if you want it built as part of the default set.
+# (*) modules are named after the subversion tree; as of this writing their names 
+#     are mostly mixedcase like MyPLC or Vserverreference
+# 
+#################### packages
+# basics: how to build a package - you need/may define the following variables
+# 
+# (*) package-MODULES
+#     a package needs one or several modules to build. 
+#     to this end, define 
+# (*) package-SPEC
+#     the package's specfile; this is relative to the FIRST module in package-MODULES
+#     see 'codebase' below
+#
+# Optional:
+#
+# (*) package-SPECVARS
+#     space-separated list of spec variable definitions, where you can reference make variable that relate to 
+#     packages defined BEFORE the current one (note: you should use = - as opposed to := - to define these)
+#     e.g. mydriver-SPECVARS = foo=$(kernel-rpm-release) 
+#     would let you use the %release from the kernel's package when rpmbuild'ing mydriver - see automatic below
+# (*) package-DEPENDS
+#     a set of *packages* that this package depends on
+# (*) package-DEPENDFILES
+#     a set of files that the package depends on - and that make needs to know about
+#     if this contains RPMS/yumgroups.xml, then the toplevel RPMS's index 
+#     is refreshed with createrepo prior to running rpmbuild
+# (*) package-RPMFLAGS: Miscellaneous RPM flags
+# (*) package-RPMBUILD: If not rpmbuild - mostly used for sudo'ing rpmbuild
+#
+#################### modules
+# Required information about the various modules (set this in e.g. planetlab-tags.mk)
+#
+# (*) module-SVNPATH
+#     the complete path where this module lies; 
+#     you can specify the trunk or a given tag with this variable
+# 
+# OR if the module is managed under cvs
+# 
+# (*) module-CVSROOT
+# (*) module-TAG
+#
+#################### automatic variables
+#
+# the build defines the following make variables - these are extracted from spec files
+# (*) package-TARBALL : from the Source<n>: declaration
+#     example: kernel-i386-TARBALL = SOURCES/linux-2.6.20.tar.bz2
+# (*) package-SOURCE : 
+#     example: kernel-i386-SOURCE = SOURCES/linux-2.6.20
+# (*) package-SRPM
+#     example: kernel-i386-SRPM = SRPMS/kernel-2.6.20-1.2949.fc6.vs2.2.0.1.0.planetlab.src.rpm
+# (*) package-RPM
+#     example: kernel-i386-RPM = \
+#      RPMS/i686/kernel-2.6.20-1.2949.fc6.vs2.2.0.1.0.planetlab.i686.rpm \
+#      RPMS/i686/kernel-devel-2.6.20-1.2949.fc6.vs2.2.0.1.0.planetlab.i686.rpm \
+#      RPMS/i686/kernel-vserver-2.6.20-1.2949.fc6.vs2.2.0.1.0.planetlab.i686.rpm \
+#      RPMS/i686/kernel-debuginfo-2.6.20-1.2949.fc6.vs2.2.0.1.0.planetlab.i686.rpm
+# (*) package-rpm-name
+#     example: kernel-i386-rpm-name = kernel
+# (*) package-rpm-release
+#     example: kernel-i386-rpm-release = 1.2949.fc6.vs2.2.0.1.0.planetlab
+# (*) package-version
+#     example: kernel-i386-rpm-version = 2.6.20
+# (*) package-subversion
+#     example: myplc-rpm-subversion = 15
+####################
+
+#
+# Default values
+#
+HOSTARCH := $(shell uname -i)
+DISTRO := $(shell ./getdistro.sh)
+RELEASE := $(shell ./getrelease.sh)
 
 #################### Makefile
 # Default target
@@ -11,7 +117,7 @@ all:
 .PHONY:all
 
 ### default values
-PLDISTRO := onelab
+PLDISTRO := planetlab
 RPMBUILD := rpmbuild
 export CVS_RSH := ssh
 
@@ -112,7 +218,7 @@ SOURCES/myplc-release:
 define stage1_variables
 $(1)_spec = $(notdir $($(1)-SPEC))
 $(1)_specpath = SPECS/$(notdir $($(1)-SPEC))
-$(1)_module = $(firstword $($(1)-MODULE))
+$(1)_module = $(firstword $($(1)-MODULES))
 endef
 
 $(foreach package, $(ALL), $(eval $(call stage1_variables,$(package))))
@@ -240,12 +346,11 @@ endef
 # usage: extract_multi_module package 
 define extract_multi_module
        mkdir -p CODEBASES/$(1) && cd CODEBASES/$(1) && (\
-       $(foreach m,$($(1)-MODULE), $(if $($(m)-SVNPATH), svn export $($(m)-SVNPATH) $(m);, cvs -d $($(m)-CVSROOT) export -r $($(m)-TAG) $(m);)))
+       $(foreach m,$($(1)-MODULES), $(if $($(m)-SVNPATH), svn export $($(m)-SVNPATH) $(m);, cvs -d $($(m)-CVSROOT) export -r $($(m)-TAG) $(m);)))
 endef
 
 CODEBASES/%: package=$(notdir $@)
-CODEBASES/%: module=$($(package)-MODULE)
-CODEBASES/%: multi_module=$(word 2,$(module))
+CODEBASES/%: multi_module=$(word 2,$($(package)-MODULES))
 CODEBASES/%: 
        @(echo -n "XXXXXXXXXXXXXXX -- BEG CODEBASE $(package) : $@ " ; date)
        $(if $(multi_module),\
@@ -364,6 +469,9 @@ $(1)-clean-tarball:
        rm -rf $($(1)-TARBALL)
 .PHONY: $(1)-clean-tarball
 CLEANS += $(1)-clean-tarball
+$(1)-clean-build:
+       rm -rf BUILD/$(notdir $($(1)-SOURCE))
+CLEANS += $(1)-clean-build
 $(1)-clean-rpm:
        rm -rf $($(1)-RPM)
 .PHONY: $(1)-clean-rpm
@@ -372,7 +480,7 @@ $(1)-clean-srpm:
        rm -rf $($(1)-SRPM)
 .PHONY: $(1)-clean-srpm
 CLEANS += $(1)-clean-srpm
-$(1)-clean: $(1)-clean-codebase $(1)-clean-source $(1)-clean-tarball $(1)-clean-rpm $(1)-clean-srpm
+$(1)-clean: $(1)-clean-codebase $(1)-clean-source $(1)-clean-tarball $(1)-clean-build $(1)-clean-rpm $(1)-clean-srpm
 .PHONY: $(1)-clean
 endef
 
@@ -410,7 +518,7 @@ endef
 
 # compute all modules
 ALL-MODULES :=
-$(foreach package,$(ALL), $(eval ALL-MODULES+=$($(package)-MODULE)))
+$(foreach package,$(ALL), $(eval ALL-MODULES+=$($(package)-MODULES)))
 ALL-MODULES:=$(sort $(ALL-MODULES))
 
 $(foreach module,$(ALL-MODULES), $(eval $(call print_version,$(module))))
@@ -472,10 +580,9 @@ help:
        @echo "$ make distclean"
        @echo "  brute-force cleaning, removes entire directories - requires a new stage1"
        @echo "$ make util-vserver-clean"
-       @echo "  removes codebase, source, tarball, rpm and srpm for util-vserver"
+       @echo "  removes codebase, source, tarball, build, rpm and srpm for util-vserver"
        @echo "$ make util-vserver-clean-codebase"
-       @echo "  and so on"
-
+       @echo "  and so on for source, tarball, build, rpm and srpm"
 
 #################### convenience, for debugging only
 # make +foo : prints the value of $(foo)
index 7c4c612..c86467f 100644 (file)
@@ -1,5 +1,6 @@
 build-SVNPATH                  := http://svn.planet-lab.org/svn/build/trunk
 Linux-2.6-SVNPATH              := http://svn.planet-lab.org/svn/Linux-2.6/trunk
+libnl-SVNPATH                  := http://svn.planet-lab.org/svn/libnl/trunk
 util-vserver-SVNPATH           := http://svn.planet-lab.org/svn/util-vserver/trunk
 NodeUpdate-SVNPATH             := http://svn.planet-lab.org/svn/NodeUpdate/trunk
 PingOfDeath-SVNPATH            := http://svn.planet-lab.org/svn/PingOfDeath/trunk
@@ -22,4 +23,3 @@ BootManager-SVNPATH           := http://svn.planet-lab.org/svn/BootManager/trunk
 BootCD-SVNPATH                 := http://svn.planet-lab.org/svn/BootCD/trunk
 BootstrapFS-SVNPATH            := http://svn.planet-lab.org/svn/BootstrapFS/trunk
 MyPLC-SVNPATH                  := http://svn.planet-lab.org/svn/MyPLC/trunk
-libnl-SVNPATH                  := http://svn.planet-lab.org/svn/libnl/trunk
index 43db25e..f077f88 100644 (file)
@@ -6,44 +6,12 @@
 #
 # $Id$
 #
-
-#
-# Required:
-#
-# CVSROOT or package-CVSROOT: CVSROOT to use
-# together with 
-# TAG or package-TAG: CVS tag to use (only with CVSROOT)
-# or
-# SVNPATH or package-SVNPATH: SVNPATH to use
-# Note: do not define both CVSROOT and SVNPATH
-#
-# package-MODULE: name(s) of cvs/svn module(s) needed for building
-# package-SPEC: RPM spec file name
-#
-# Optional:
-#
-# package-RPMFLAGS: Miscellaneous RPM flags
-# package-RPMBUILD: If not rpmbuild
-#
-# Add to ALL if you want the package built as part of the default set.
-#
-
+# see doc in Makefile  
 #
-# Default values -- should be able to override these from command line
-#
-HOSTARCH := $(shell uname -i)
-DISTRO := $(shell ./getdistro.sh)
-RELEASE := $(shell ./getrelease.sh)
-
-#
-# load in a release specific tags file
-# Override TAGSFILE from command line to select something else
-#
-
 #
 # kernel
 #
-kernel-$(HOSTARCH)-MODULE := Linux-2.6
+kernel-$(HOSTARCH)-MODULES := Linux-2.6
 kernel-$(HOSTARCH)-SPEC := scripts/kernel-2.6-planetlab.spec
 ifeq ($(HOSTARCH),i386)
 kernel-$(HOSTARCH)-RPMFLAGS:= --target i686
@@ -58,10 +26,21 @@ kernel-clean: $(foreach package,$(KERNELS),$(package)-clean)
 
 ALL += $(KERNELS)
 
+#
+# libnl
+#
+# [daniel]    wait for latest Fedora release 
+# (03:29:46 PM) daniel_hozac: interfacing with the kernel directly when dealing with netlink was fugly, so... i had to find something nicer.
+# (03:29:53 PM) daniel_hozac: the one in Fedora is lacking certain APIs i need.
+#
+libnl-MODULES := libnl
+libnl-SPEC := libnl.spec
+ALL += libnl
+
 #
 # util-vserver
 #
-util-vserver-MODULE := util-vserver
+util-vserver-MODULES := util-vserver
 util-vserver-SPEC := util-vserver.spec
 util-vserver-RPMFLAGS:= --without dietlibc
 util-vserver-DEPENDS := libnl
@@ -70,28 +49,28 @@ ALL += util-vserver
 #
 # NodeUpdate
 #
-NodeUpdate-MODULE := NodeUpdate
+NodeUpdate-MODULES := NodeUpdate
 NodeUpdate-SPEC := NodeUpdate.spec
 ALL += NodeUpdate
 
 #
 # ipod
 #
-PingOfDeath-MODULE := PingOfDeath
+PingOfDeath-MODULES := PingOfDeath
 PingOfDeath-SPEC := ipod.spec
 ALL += PingOfDeath
 
 #
 # NodeManager
 #
-NodeManager-MODULE := NodeManager
+NodeManager-MODULES := NodeManager
 NodeManager-SPEC := NodeManager.spec
 ALL += NodeManager
 
 #
 # pl_sshd
 #
-pl_sshd-MODULE := pl_sshd
+pl_sshd-MODULES := pl_sshd
 pl_sshd-SPEC := pl_sshd.spec
 ALL += pl_sshd
 
@@ -101,14 +80,14 @@ ALL += pl_sshd
 # Deprecate when vsys takes over [sapan].
 # keep in build for proper.
 #
-libhttpd++-MODULE := libhttpd++
+libhttpd++-MODULES := libhttpd++
 libhttpd++-SPEC := libhttpd++.spec
 ALL += libhttpd++
 
 #
-# Proper: Privileged Operations Service
+# proper: Privileged Operations Service
 #
-proper-MODULE := proper
+proper-MODULES := proper
 proper-SPEC := proper.spec
 proper-RPMBUILD := sudo bash ./rpmbuild.sh
 # proper uses scripts in util-python for building
@@ -116,40 +95,40 @@ proper-DEPENDS := libhttpd++ util-python
 ALL += proper
 
 #
-# CoDemux: Port 80 demux
+# codemux: Port 80 demux
 #
-CoDemux-MODULE := CoDemux
-CoDemux-SPEC   := codemux.spec
-CoDemux-RPMBUILD := sudo bash ./rpmbuild.sh
-ALL += CoDemux
+codemux-MODULES := CoDemux
+codemux-SPEC   := codemux.spec
+codemux-RPMBUILD := sudo bash ./rpmbuild.sh
+ALL += codemux
 
 #
 # ulogd
 #
-ulogd-MODULE := ulogd
+ulogd-MODULES := ulogd
 ulogd-SPEC := ulogd.spec
 ulogd-DEPENDS := $(KERNELS) proper
 ALL += ulogd
 
 #
-# PlanetFlow
+# netflow
 #
-PlanetFlow-MODULE := PlanetFlow
-PlanetFlow-SPEC := netflow.spec
-PlanetFlow-SPECVARS := distroname=$(DISTRO) distrorelease=$(RELEASE)
-ALL += PlanetFlow
+netflow-MODULES := PlanetFlow
+netflow-SPEC := netflow.spec
+netflow-SPECVARS := distroname=$(DISTRO) distrorelease=$(RELEASE)
+ALL += netflow
 
 #
 # PlanetLab Mom: Cleans up your mess
 #
-Mom-MODULE := Mom
-Mom-SPEC := pl_mom.spec
-ALL += Mom
+pl_mom-MODULES := Mom
+pl_mom-SPEC := pl_mom.spec
+ALL += pl_mom
 
 #
 # iptables
 #
-iptables-MODULE := iptables
+iptables-MODULES := iptables
 iptables-SPEC := iptables.spec
 iptables-DEPENDS := $(KERNELS)
 ALL += iptables
@@ -157,7 +136,7 @@ ALL += iptables
 #
 # iproute
 #
-iproute-MODULE := iproute2
+iproute-MODULES := iproute2
 iproute-SPEC := iproute.spec
 ALL += iproute
 
@@ -166,14 +145,14 @@ ALL += iproute
 #
 # [marc]    deprecate with proper
 #
-util-python-MODULE := util-python
+util-python-MODULES := util-python
 util-python-SPEC := util-python.spec
 ALL += util-python
 
 #
 # vsys
 #
-vsys-MODULE := vsys
+vsys-MODULES := vsys
 vsys-SPEC := vsys.spec
 ifeq ($(DISTRO),"Fedora")
 ifeq ($(RELEASE),7)
@@ -184,112 +163,100 @@ endif
 #
 # PLCAPI
 #
-PLCAPI-MODULE := PLCAPI
+PLCAPI-MODULES := PLCAPI
 PLCAPI-SPEC := PLCAPI.spec
 ALL += PLCAPI
 
 #
 # PLCWWW
 #
-PLCWWW-MODULE := WWW
+PLCWWW-MODULES := WWW
 PLCWWW-SPEC := PLCWWW.spec
 ALL += PLCWWW
 
 #
-# BootManager
+# bootmanager
 #
-BootManager-MODULE := BootManager build
-BootManager-SPEC := bootmanager.spec
+bootmanager-MODULES := BootManager build
+bootmanager-SPEC := bootmanager.spec
 # Package must be built as root
-BootManager-RPMBUILD := sudo bash ./rpmbuild.sh
-ALL += BootManager
+bootmanager-RPMBUILD := sudo bash ./rpmbuild.sh
+ALL += bootmanager
 
 # we do not want BootCD to depend on vserver-reference, do we ?
 ALL-REGULARS := $(ALL)
 
 #
-# vserver-reference
+# vserver : reference image for slices
 #
-VserverReference-MODULE := VserverReference build
-VserverReference-SPEC := vserver-reference.spec
+vserver-MODULES := VserverReference build
+vserver-SPEC := vserver-reference.spec
 # Package must be built as root
-VserverReference-RPMBUILD := sudo bash ./rpmbuild.sh
+vserver-RPMBUILD := sudo bash ./rpmbuild.sh
 # package requires all regular packages
-VserverReference-DEPENDS := $(ALL-REGULARS)
-VserverReference-DEPENDFILES := RPMS/yumgroups.xml
-ALL += VserverReference
+vserver-DEPENDS := $(ALL-REGULARS)
+vserver-DEPENDFILES := RPMS/yumgroups.xml
+ALL += vserver
 
 #
-# BootCD
+# bootcd
 #
-BootCD-MODULE := BootCD BootManager build
-BootCD-SPEC := bootcd.spec
-BootCD-RPMBUILD := sudo bash ./rpmbuild.sh
+bootcd-MODULES := BootCD BootManager build
+bootcd-SPEC := bootcd.spec
+bootcd-RPMBUILD := sudo bash ./rpmbuild.sh
 # package has *some* dependencies, at least these ones
-BootCD-DEPENDS := $(KERNELS)
-BootCD-DEPENDFILES := RPMS/yumgroups.xml
-ALL += BootCD
+bootcd-DEPENDS := $(KERNELS)
+bootcd-DEPENDFILES := RPMS/yumgroups.xml
+ALL += bootcd
 
 #
-# BootstrapFS
+# bootstrapfs
 #
-BootstrapFS-MODULE := BootstrapFS build
-BootstrapFS-SPEC := bootstrapfs.spec
-BootstrapFS-RPMBUILD := sudo bash ./rpmbuild.sh
+bootstrapfs-MODULES := BootstrapFS build
+bootstrapfs-SPEC := bootstrapfs.spec
+bootstrapfs-RPMBUILD := sudo bash ./rpmbuild.sh
 # package requires all regular packages
-BootstrapFS-DEPENDS := $(ALL-REGULARS)
-BootstrapFS-DEPENDFILES := RPMS/yumgroups.xml
-ALL += BootstrapFS
+bootstrapfs-DEPENDS := $(ALL-REGULARS)
+bootstrapfs-DEPENDFILES := RPMS/yumgroups.xml
+ALL += bootstrapfs
 
 #
-# MyPLC
+# myplc : initial, chroot-based packaging
 #
-MyPLC-MODULE := MyPLC build
-MyPLC-SPEC := myplc.spec
+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-DEPENDS := $(filter-out MyPLC,$(ALL))
-MyPLC-DEPENDFILES := RPMS/yumgroups.xml
-ALL += MyPLC
+myplc-RPMBUILD := sudo bash ./rpmbuild.sh
+# myplc may require all packages
+myplc-DEPENDS := $(ALL)
+myplc-DEPENDFILES := RPMS/yumgroups.xml
+ALL += myplc
 
 #
-# MyPLC native
+# MyPLC native : lightweight packaging, dependencies are yum-installed in a vserver
 #
-MyPLC-native-MODULE := MyPLC build 
-MyPLC-native-SPEC := myplc-native.spec
+myplc-native-MODULES := MyPLC build 
+myplc-native-SPEC := myplc-native.spec
 # Package must be built as root
-MyPLC-native-RPMBUILD := sudo bash ./rpmbuild.sh
+myplc-native-RPMBUILD := sudo bash ./rpmbuild.sh
 # Thierry : I don't think we depend on these at build-time
-#MyPLC-native-DEPENDS := $(MyPLC-DEPENDS)
+#myplc-native-DEPENDS := $(MyPLC-DEPENDS)
 # Thierry : dunno about this one, let's stay safe
-MyPLC-native-DEPENDFILES := $(MyPLC-DEPENDFILES)
-#ALL += MyPLC-native
+myplc-native-DEPENDFILES := $(MyPLC-DEPENDFILES)
+#ALL += myplc-native
 
 #
-# MyPLC development environment
+# MyPLC development environment : chroot-based 
 #
-MyPLC-devel-MODULE := MyPLC build 
-MyPLC-devel-SPEC := myplc-devel.spec
-MyPLC-devel-RPMBUILD := sudo bash ./rpmbuild.sh
-#ALL += MyPLC-devel
+myplc-devel-MODULES := MyPLC build 
+myplc-devel-SPEC := myplc-devel.spec
+myplc-devel-RPMBUILD := sudo bash ./rpmbuild.sh
+#ALL += myplc-devel
 
 #
 # MyPLC native development environment
 #
-MyPLC-devel-native-MODULE := MyPLC
-MyPLC-devel-native-SPECVARS := distroname=$(DISTRO) distrorelease=$(RELEASE)
-MyPLC-devel-native-SPEC := myplc-devel-native.spec
-#ALL += MyPLC-devel-native
-
-#
-# libnl
-#
-# [daniel]    wait for latest Fedora release 
-# (03:29:46 PM) daniel_hozac: interfacing with the kernel directly when dealing with netlink was fugly, so... i had to find something nicer.
-# (03:29:53 PM) daniel_hozac: the one in Fedora is lacking certain APIs i need.
-#
-libnl-MODULE := libnl
-libnl-SPEC := libnl.spec
-ALL += libnl
-
+myplc-devel-native-MODULES := MyPLC
+myplc-devel-native-SPECVARS := distroname=$(DISTRO) distrorelease=$(RELEASE)
+myplc-devel-native-SPEC := myplc-devel-native.spec
+#ALL += myplc-devel-native