+++ /dev/null
-.cvsps
-.rpmmacros
-BUILD
-RPMS
-SOURCES
-SPECS
-SRPMS
-tmp
-parseSpec
#
-# PlanetLab RPM generation
-#
-# Mark Huang <mlhuang@cs.princeton.edu>
-# Copyright (C) 2003-2006 The Trustees of Princeton University
-#
-# $Id: Makefile,v 1.89 2007/09/12 20:26:20 mef Exp $
+# Thierry Parmentelat - INRIA Sophia Antipolis
#
+### $Id: Makefile 1088 2007-11-15 14:51:33Z thierry $
+#
+# run 'make help' for more info
+#################### Makefile
# Default target
all:
+.PHONY:all
+
+### default values
+PLDISTRO := onelab
+RPMBUILD := rpmbuild
+export CVS_RSH := ssh
+
+########## pldistro.mk holds PLDISTRO - it is generated at stage1 (see below)
+ifeq "$(stage1)" ""
+include pldistro.mk
+endif
-# By default, the naming convention for built RPMS is
-# <name>-<version>-<release>.<PLDISTRO>.<arch>.rpm
-# Set PLDISTRO on the command line to differentiate between downstream
-# variants.
-PLDISTRO := planetlab
+#################### include onelab.mk
+# describes the set of components
+PLDISTROCONTENTS := $(PLDISTRO).mk
+include $(PLDISTROCONTENTS)
-include $(PLDISTRO).mk
+#################### include <pldistro>-tags.mk
+# describes where to fetch components, and the related tags if using cvs
+PLDISTROTAGS := $(PLDISTRO)-tags.mk
+include $(PLDISTROTAGS)
-RPMBUILD ?= bash ./rpmbuild.sh
-CVS_RSH ?= ssh
+########## stage1 and stage2
+# extract specs and compute .mk files by running
+# make stage1=true
+# entering stage1, we compute all the spec files
+# then we use stage2 to compute the .mk iteratively,
+# ensuring that the n-1 first makefiles are loaded when creating the n-th one
+# when stage2 is set, it is supposed to be an index (starting at 1) in $(ALL)
-ifeq ($(findstring $(package),$(ALL)),)
+ALLMKS := $(foreach package, $(ALL), MAKE/$(package).mk)
-# Build all packages
+### stage2 : need some arithmetic, see
+# http://www.cmcrossroads.com/articles/ask-mr.-make/learning-gnu-make-functions-with-arithmetic.html
+ifneq "$(stage2)" ""
+# the first n packages
+packages := $(wordlist 1,$(words $(stage2)),$(ALL))
+# the n-th package
+package := $(word $(words $(packages)),$(packages))
+# the n-1 first packages
+stage2_1 := $(wordlist 2,$(words $(stage2)),$(stage2))
+previous := $(wordlist 1,$(words $(stage2_1)),$(ALL))
+previousmks := $(foreach package,$(previous),MAKE/$(package).mk)
+include $(previousmks)
+all: verbose
+verbose:
+ @echo "========== stage2 : $(package)"
+ @echo "stage2 : included .mk files : $(previousmks)"
+all: $($(package)_specpath)
+all: MAKE/$(package).mk
+else
+### stage1
+ifneq "$(stage1)" ""
+all : verbose
+verbose :
+ @echo "========== stage1"
+all : spec2make
+all : .rpmmacros
+# specs and makes are done sequentially by stage2
+all : stage2
+stage2:
+ arg=""; for n in $(ALL) ; do arg="$$arg x"; $(MAKE) --no-print-directory stage2="$$arg"; done
+### regular make
+else
+### once .mks are OK, you can run make normally
+include $(ALLMKS)
+#all : tarballs
+#all : sources
+#all : codebases
+#all : rpms
+#all : srpms
+# mention $(ALL) here rather than rpms
+# this is because the inter-package dependencies are expressed like
+# util-vserver: util-python
all: $(ALL)
+all: srpms
+endif
+endif
+
+####################
+# gather build information for the 'About' page
+SOURCES/myplc-release:
+ @echo 'Creating myplc-release'
+ mkdir -p SOURCES
+ rm -f $@
+ (echo -n 'Build bdate: ' ; date '+%Y.%m.%d') >> $@
+ (echo -n 'Build btime: ' ; date '+%H:%M') >> $@
+ (echo -n 'Build hostname: ' ; hostname) >> $@
+ (echo -n 'Build location: ' ; pwd) >> $@
+ (echo -n 'Build tags file: ' ; fgrep '$$''Id' $(PLDISTROTAGS)) >> $@
+ echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx modules versions info" >> $@
+ $(MAKE) --no-print-directory versions >> $@
+
+####################
+# notes:
+# * to make configuration easier, we always use the first module's
+# definitions (CVSROOT,TAG, or SVNPATH) to extract the spec file
+# * for the same reason, in case cvs is used, the first module name is added to
+# $(package)-SPEC - otherwise the cvs modules have to define spec as
+# <module>/<module>.spec while svn modules just define it as <module>.spec
+#
+define stage1_variables
+$(1)_spec = $(notdir $($(1)-SPEC))
+$(1)_specpath = SPECS/$(notdir $($(1)-SPEC))
+$(1)_module = $(firstword $($(1)-MODULE))
+endef
+
+$(foreach package, $(ALL), $(eval $(call stage1_variables,$(package))))
+
+#
+# for each package, compute whether we need to set date (i.e. whether we use the trunk)
+# the myplc package is forced to have a date, because it is more convenient
+# (we cannot bump its number everytime something changes in the system)
+#
+define package_hasdate
+$(1)_hasdate = $(if $(subst myplc,,$(1)), \
+ $(if $($(1)-SVNPATH),\
+ $(if $(findstring /trunk,$($(1)-SVNPATH)),yes,),\
+ $(if $(findstring HEAD,$($(1)-TAG)),yes,)), \
+ yes)
+endef
+
+$(foreach package, $(ALL), $(eval $(call package_hasdate,$(package))))
+
+### extract spec file from scm
+# usage: extract_spec_file package
+# see early releases for comments on other possible implementations
+# cannot use variables in such rules, we need to inline everything, sigh
+define target_spec
+$($(1)_specpath):
+ mkdir -p SPECS
+ echo "%define pldistro $(PLDISTRO)" > $($(1)_specpath)
+ $(if $($(1)_hasdate),echo "%define date $(shell date +%Y.%m.%d)" >> $($(1)_specpath),)
+ $(if $($(1)-SPECVARS), \
+ $(foreach line,$($(1)-SPECVARS), \
+ echo "%define" $(word 1,$(subst =, ,$(line))) "$(word 2,$(subst =, ,$(line)))" >> $($(1)_specpath) ;))
+ $(if $($($(1)_module)-SVNPATH),\
+ svn cat $($($(1)_module)-SVNPATH)/$($(1)-SPEC) >> $($(1)_specpath),\
+ cvs -d $($($(1)_module)-CVSROOT) checkout \
+ -r $($($(1)_module)-TAG) \
+ -p $($(1)_module)/$($(1)-SPEC) >> $($(1)_specpath))
+ @if [ -z $($(1)_specpath) ] ; then rm $($(1)_specpath) ; exit 1 ; fi
+endef
+
+$(foreach package,$(ALL),$(eval $(call target_spec,$(package))))
+
+### this utility allows to extract various info from a spec file
+### and to define them in makefiles
+spec2make: spec2make.c
+ $(CC) -g -Wall $< -o $@ -lrpm -lrpmbuild
+
+# Base rpmbuild in the current directory
+export HOME := $(shell pwd)
+.rpmmacros:
+ echo "%_topdir $(HOME)" > $@
+ echo "%_tmppath $(HOME)/tmp" >> $@
+
+### run spec2make on the spec file and include the result
+# usage: spec2make package
+define target_mk
+MAKE/$(1).mk: $($(1)_specpath) spec2make .rpmmacros
+ mkdir -p MAKE
+ ./spec2make $($(1)-RPMFLAGS) $($(1)_specpath) $(1) > MAKE/$(1).mk
+ @if [ -z MAKE/$(1).mk ] ; then rm MAKE/$(1).mk ; exit 1 ; fi
+endef
+
+$(foreach package,$(ALL),$(eval $(call target_mk,$(package))))
+
+# stores PLDISTRO in a file
+# this is done at stage1. later run wont get confused
+pldistro.mk:
+ echo "PLDISTRO:=$(PLDISTRO)" > $@
+ echo "PLDISTROTAGS:=$(PLDISTROTAGS)" >> $@
+
+savepldistro: pldistro.mk
+.PHONY: savepldistro
+
+# always refresh this
+all: savepldistro
+
+####################
+### pack sources into tarballs
+ALLTARBALLS:= $(foreach package, $(ALL), $($(package)-TARBALL))
+tarballs: $(ALLTARBALLS)
+ @echo $(words $(ALLTARBALLS)) source tarballs OK
+.PHONY: tarballs
+
+SOURCES/%.tar.bz2: SOURCES/%
+ tar chpjf $@ -C SOURCES $*
+
+SOURCES/%.tar.gz: SOURCES/%
+ tar chpzf $@ -C SOURCES $*
+
+SOURCES/%.tgz: SOURCES/%
+ tar chpzf $@ -C SOURCES $*
+
+### the directory SOURCES/<package>-<version> is made
+# with a copy -rl from CODEBASES/<package>
+# the former is $(package-SOURCE) and the latter is $(package-CODEBASE)
+ALLSOURCES:=$(foreach package, $(ALL), $($(package)-SOURCE))
+# so that make does not use the rule below directly for creating the tarball files
+.SECONDARY: $(ALLSOURCES)
+
+sources: $(ALLSOURCES)
+ @echo $(words $(ALLSOURCES)) versioned source trees OK
+.PHONY: sources
-# Recurse
-$(ALL):
- @echo -n "XXXXXXXXXXXXXXX -- BEG $@ " ; date
- $(MAKE) package=$@
- @echo -n "XXXXXXXXXXXXXXX -- END $@ " ; date
+define target_link_codebase_sources
+$($(1)-SOURCE): $($(1)-CODEBASE) ; mkdir -p SOURCES ; cp -rl $($(1)-CODEBASE) $($(1)-SOURCE)
+endef
-# Remove files generated by this package
-$(foreach package,$(ALL),$(package)-clean): %-clean:
- $(MAKE) package=$* clean
+$(foreach package,$(ALL),$(eval $(call target_link_codebase_sources,$(package))))
-# Remove all generated files
+### codebase extraction
+ALLCODEBASES:=$(foreach package, $(ALL), $($(package)-CODEBASE))
+# so that make does not use the rule below directly for creating the tarball files
+.SECONDARY: $(ALLCODEBASES)
+
+codebases : $(ALLCODEBASES)
+ @echo $(words $(ALLCODEBASES)) codebase OK
+.PHONY: codebases
+
+### extract codebase
+# usage: extract_single_module package
+define extract_single_module
+ mkdir -p CODEBASES
+ $(if $($($(1)_module)-SVNPATH), cd CODEBASES && svn export $($($(1)_module)-SVNPATH) $(1), cd CODEBASES && cvs -d $($($(1)_module)-CVSROOT) export -r $($($(1)_module)-TAG) -d $(1) $($(1)_module))
+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);)))
+endef
+
+CODEBASES/%: package=$(notdir $@)
+CODEBASES/%: module=$($(package)-MODULE)
+CODEBASES/%: multi_module=$(word 2,$(module))
+CODEBASES/%:
+ @(echo -n "XXXXXXXXXXXXXXX -- BEG CODEBASE $(package) : $@ " ; date)
+ $(if $(multi_module),\
+ $(call extract_multi_module,$(package)),\
+ $(call extract_single_module,$(package)))
+ @(echo -n "XXXXXXXXXXXXXXX -- END CODEBASE $(package) : $@ " ; date)
+
+### rpmbuild invokation
+ALLRPMS:=$(foreach package,$(ALL),$($(package)-RPM))
+# same as above, mention $(ALL) and not $(ALLRPMS)
+rpms: $(ALL)
+ @echo $(words $(ALLRPMS)) binary rpms OK
+.PHONY: rpms
+
+# usage: build_binary_rpm package
+# xxx hacky - invoke createrepo if DEPENDFILES mentions RPMS/yumgroups.xml
+define target_binary_rpm
+$($(1)-RPM): $($(1)_specpath) $($(1)-TARBALL) .rpmmacros
+ mkdir -p BUILD RPMS tmp
+ @(echo -n "XXXXXXXXXXXXXXX -- BEG RPM $(1) " ; date)
+ $(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPENDFILES)), createrepo --quiet -g yumgroups.xml RPMS/ , )
+ $(if $($(1)-RPMBUILD),\
+ $($(1)-RPMBUILD) $($(1)-RPMFLAGS) -bb $($(1)_specpath), \
+ $(RPMBUILD) $($(1)-RPMFLAGS) -bb $($(1)_specpath))
+ @(echo -n "XXXXXXXXXXXXXXX -- END RPM $(1) " ; date)
+endef
+
+$(foreach package,$(ALL),$(eval $(call target_binary_rpm,$(package))))
+
+### source rpms
+ALLSRPMS:=$(foreach package,$(ALL),$($(package)-SRPM))
+srpms: $(ALLSRPMS)
+ @echo $(words $(ALLSRPMS)) source rpms OK
+.PHONY: srpms
+
+# usage: build_source_rpm package
+define target_source_rpm
+$($(1)-SRPM): $($(1)_specpath) $($(1)-TARBALL) .rpmmacros
+ mkdir -p BUILD SRPMS tmp
+ @(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) " ; date)
+ $(if $($(1)-RPMBUILD),\
+ $($(1)-RPMBUILD) $($(1)-RPMFLAGS) -bs $($(1)_specpath),
+ $(RPMBUILD) $($(1)-RPMFLAGS) -bs $($(1)_specpath))
+ @(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
+endef
+
+$(foreach package,$(ALL),$(eval $(call target_source_rpm,$(package))))
+
+### RPMS/yumgroups.xml
+ifndef YUMGROUPS
+YUMGROUPS := groups/$(PLDISTRO).xml
+endif
+RPMS/yumgroups.xml: $(YUMGROUPS)
+ install -D -m 644 $(YUMGROUPS) $@
+
+### shorthand target
+# e.g. make proper -> does propers rpms
+# usage shorthand_target package
+define target_shorthand
+$(1): $($(package)-RPM)
+.PHONY: $(1)
+$(1)-spec: $($(package)-SPEC)
+.PHONY: $(1)-spec
+$(1)-mk: $($(package)-MK)
+.PHONY: $(1)-mk
+$(1)-tarball: $($(package)-TARBALL)
+.PHONY: $(1)-tarball
+$(1)-codebase: $($(package)-CODEBASE)
+.PHONY: $(1)-source
+$(1)-source: $($(package)-SOURCE)
+.PHONY: $(1)-codebase
+$(1)-rpm: $($(package)-RPM)
+.PHONY: $(1)-rpm
+$(1)-srpm: $($(package)-SRPM)
+.PHONY: $(1)-srpm
+endef
+
+$(foreach package,$(ALL),$(eval $(call target_shorthand,$(package))))
+
+### dependencies
+define package_depends_on_file
+$(1):$(2)
+$($(1)-RPM):$(2)
+endef
+
+define target_dependfiles
+$(foreach file,$($(1)-DEPENDFILES),$(eval $(call package_depends_on_file,$(1),$(file))))
+endef
+
+define package_depends_on_package
+$(1):$(2)
+$(1):$($(2)-RPM)
+$($(1)-RPM):$($(2)-RPM)
+endef
+
+define target_depends
+$(foreach package,$($(1)-DEPENDS),$(eval $(call package_depends_on_package,$(1),$(package))))
+endef
+
+$(foreach package,$(ALL),$(eval $(call target_depends,$(package))))
+$(foreach package,$(ALL),$(eval $(call target_dependfiles,$(package))))
+
+
+### clean target
+# usage: target_clean package
+define target_clean
+$(1)-clean-codebase:
+ rm -rf $($(1)-CODEBASE)
+.PHONY: $(1)-clean-codebase
+CLEANS += $(1)-clean-codebase
+$(1)-clean-source:
+ rm -rf $($(1)-SOURCE)
+.PHONY: $(1)-clean-source
+CLEANS += $(1)-clean-source
+$(1)-clean-tarball:
+ rm -rf $($(1)-TARBALL)
+.PHONY: $(1)-clean-tarball
+CLEANS += $(1)-clean-tarball
+$(1)-clean-rpm:
+ rm -rf $($(1)-RPM)
+.PHONY: $(1)-clean-rpm
+CLEANS += $(1)-clean-rpm
+$(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
+.PHONY: $(1)-clean
+endef
+
+$(foreach package,$(ALL),$(eval $(call target_clean,$(package))))
+
+### clean precisely
clean:
- rm -rf BUILD RPMS SOURCES SPECS SRPMS .rpmmacros tmp parseSpec
+ $(MAKE) $(CLEANS)
+.PHONY: clean
-.PHONY: all $(ALL) $(foreach package,$(ALL),$(package)-clean) clean
+clean-help:
+ @echo Available clean targets
+ @echo $(CLEANS)
-else
+### brute force clean
+distclean1:
+ rm -rf pldistro.mk .rpmmacros spec2make SPECS MAKE
+distclean2:
+ rm -rf CODEBASES SOURCES BUILD RPMS SRPMS tmp
+distclean: distclean1 distclean2
+.PHONY: distclean1 distclean2 distclean
-# Define variables for Rules.mk
-#CVSROOT := $(if $($(package)-CVSROOT),$($(package)-CVSROOT),$(CVSROOT))
-#SVNPATH := $(if $($(package)-SVNPATH),$($(package)-SVNPATH),$(SVNPATH))
-TAG := $(if $($(package)-TAG),$($(package)-TAG),$(TAG))
-MODULE := $($(package)-MODULE)
-SPEC := $($(package)-SPEC)
-RPMFLAGS := $(if $($(package)-RPMFLAGS),$($(package)-RPMFLAGS),$(RPMFLAGS))
-RPMBUILD := $(if $($(package)-RPMBUILD),$($(package)-RPMBUILD),$(RPMBUILD))
-CVS_RSH := $(if $($(package)-CVS_RSH),$($(package)-CVS_RSH),$(CVS_RSH))
+# xxx tmp - I cannot use this on my mac for local testing
+ISMACOS=$(findstring Darwin,$(shell uname))
+ifneq "$(ISMACOS)" ""
+#################### produce reliable version information
+# for a given module
+VFORMAT="%30s := %s\n"
+define print_version
+$(1)-version:
+ @$(if $($(1)-SVNPATH),\
+ printf $(VFORMAT) $(1)-SVNPATH "$($(1)-SVNPATH)",\
+ printf $(VFORMAT) $(1)-CVSROOT "$($(1)-CVSROOT)" ; printf $(VFORMAT) $(1)-TAG "$($(1)-TAG)")
+endef
-include Rules.mk
+# compute all modules
+ALL-MODULES :=
+$(foreach package,$(ALL), $(eval ALL-MODULES+=$($(package)-MODULE)))
+ALL-MODULES:=$(sort $(ALL-MODULES))
+$(foreach module,$(ALL-MODULES), $(eval $(call print_version,$(module))))
+
+versions: $(foreach module, $(ALL-MODULES), $(module)-version)
+else
+versions:
+ @echo "warning : the 'versions' target is not supported on macos"
+endif
+
+#################### include install Makefile
+# the default is to use the distro-dependent install file
+# however the main distro file can redefine PLDISTROINSTALL
+ifndef PLDISTROINSTALL
+PLDISTROINSTALL := $(PLDISTRO)-install.mk
endif
+# only if present
+-include $(PLDISTROINSTALL)
+
+####################
+help:
+ @echo "Known pakages are"
+ @echo " $(ALL)"
+ @echo "Run make in two stages:"
+ @echo ""
+ @echo "make stage1=true PLDISTRO=onelab"
+ @echo " -> extracts all spec files in SPECS/ and mk files in MAKE/"
+ @echo " as well as save PLDISTRO for subsequent runs"
+ @echo ""
+ @echo "Then you can use the following targets"
+ @echo '$ make'
+ @echo " rebuilds everything"
+ @echo '$ make util-vserver'
+ @echo " makes the RPMS related to util-vserver"
+ @echo " equivalent to 'make util-vserver-rpm'"
+ @echo ""
+ @echo "Or, vertically - step-by-step for a given package"
+ @echo '$ make util-vserver-codebase'
+ @echo " performs codebase extraction in CODEBASES/util-vserver"
+ @echo '$ make util-vserver-source'
+ @echo " creates source link in SOURCES/util-vserver-<version>"
+ @echo '$ make util-vserver-tarball'
+ @echo " creates source tarball in SOURCES/util-vserver-<version>.<tarextension>"
+ @echo '$ make util-vserver-rpm'
+ @echo " build rpm(s) in RPMS/"
+ @echo '$ make util-vserver-srpm'
+ @echo " build source rpm in SRPMS/"
+ @echo ""
+ @echo "Or, horizontally, reach a step for all known packages"
+ @echo '$ make codebases'
+ @echo '$ make sources'
+ @echo '$ make tarballs'
+ @echo '$ make rpms'
+ @echo '$ make srpms'
+ @echo ""
+ @echo "Cleaning examples"
+ @echo "$ make clean"
+ @echo " removes the files made by make"
+ @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 "$ make util-vserver-clean-codebase"
+ @echo " and so on"
+
+
+#################### convenience, for debugging only
+# make +foo : prints the value of $(foo)
+# make ++foo : idem but verbose, i.e. foo=$(foo)
+++%: varname=$(subst +,,$@)
+++%:
+ @echo "$(varname)=$($(varname))"
++%: varname=$(subst +,,$@)
++%:
+ @echo "$($(varname))"
+++ /dev/null
-#
-# PlanetLab RPM generation
-#
-# Mark Huang <mlhuang@cs.princeton.edu>
-# Copyright (C) 2003-2006 The Trustees of Princeton University
-#
-# $Id: Rules.mk,v 1.37 2007/09/10 22:24:20 mef Exp $
-#
-
-# Base rpmbuild in the current directory
-export HOME := $(shell pwd)
-export CVSROOT CVS_RSH
-
-#
-# Create spec file
-#
-
-SPECFILE := SPECS/$(notdir $(SPEC))
-MULTI_MODULE := $(word 2,$(MODULE))
-# is there a single module ? to mimick cvs export -d behaviour
-ifeq "$(MULTI_MODULE)" ""
- _MAINMODULE := $(MODULE)
-else
- _MAINMODULE := $(firstword $(MODULE))
-endif
-
-$(SPECFILE):
- mkdir -p SPECS
- echo "%define pldistro $(PLDISTRO)" > $@
-ifeq ($(TAG),HEAD)
- # Define date for untagged builds
- echo "%define date $(shell date +%Y.%m.%d)" >> $@
-else
- # Define cvstag for tagged builds
- echo "%define cvstag $(TAG)" >> $@
-endif
- $(if $($(package)-CVSROOT), cvs -d $($(package)-CVSROOT) checkout -r $(TAG) -p $(_MAINMODULE)/$(SPEC) >> $@; ,\
- $(if $($(package)-SVNPATH), svn cat $($(package)-SVNPATH)/$(_MAINMODULE)/$(TAG)/$(SPEC) >> $@; ,\
- $(if $(CVSROOT), cvs -d $(CVSROOT) checkout -r $(TAG) -p $(_MAINMODULE)/$(SPEC) >> $@; ,\
- $(if $(SVNPATH), svn cat $(SVNPATH)/$(_MAINMODULE)/$(TAG)/$(SPEC) >> $@; ) \
- )\
- )\
- )
-
-#
-# Parse spec file into Makefile fragment
-#
-
-MK := tmp/$(package).mk
-
-parseSpec: CFLAGS := -g -Wall -D_GNU_SOURCE
-
-parseSpec: LDFLAGS := -lrpm -lrpmbuild
-
-$(MK): $(SPECFILE) parseSpec .rpmmacros
- mkdir -p tmp
- ./parseSpec $(RPMFLAGS) $(SPECFILE) > $@
-
-# Defines SOURCES, SRPM, RPMS
-include $(MK)
-
-#
-# Generate tarball(s)
-#
-
-# Get rid of any extensions
-stripext = \
-$(patsubst %.tar.bz2,%, \
-$(patsubst %.tar.gz,%, \
-$(patsubst %.tgz,%, \
-$(patsubst %.zip,%, \
-$(patsubst %.tar,%,$(1))))))
-
-SOURCEDIRS := $(call stripext,$(SOURCES))
-
-# Thierry - Jan 29 2007
-# Allow different modules to have different CVSROOT
-# and/or to be extracted from their SVNPATH
-#
-# is there a single module ? to mimick cvs export -d behaviour
-ifeq "$(MULTI_MODULE)" ""
-# single module: do as before
-SOURCES/$(package):
- mkdir -p SOURCES && cd SOURCES && \
- (\
- $(if $($(package)-CVSROOT), cvs -d $($(package)-CVSROOT) export -r $(TAG) -d $(package) $(MODULE); ,\
- $(if $($(package)-SVNPATH), svn export $($(package)-SVNPATH)/$(MODULE)/$(TAG) $(package) ; ,\
- $(if $(CVSROOT), cvs -d $(CVSROOT) export -r $(TAG) -d $(package) $(MODULE); ,\
- $(if $(SVNPATH), svn export $(SVNPATH)/$(MODULE)/$(TAG) $(package) ;) \
- )\
- )\
- )\
- )
-else
-# multiple modules : iterate
-SOURCES/$(package):
- mkdir -p SOURCES/$(package) && cd SOURCES/$(package) && \
- $(foreach module,$(MODULE),\
- $(if $($(module)-CVSROOT), cvs -d $($(module)-CVSROOT) export -r $(TAG) -d $(module) $(module); ,\
- $(if $($(module)-SVNPATH), svn export $($(module)-SVNPATH)/$(module)/$(TAG) $(module) ; ,\
- $(if $(CVSROOT), cvs -d $(CVSROOT) export -r $(TAG) -d $(module) $(module); ,\
- $(if $(SVNPATH), svn export $(SVNPATH)/$(module)/$(TAG) $(module) ;) \
- )\
- )\
- )\
- )
-endif
-
-# Make a hard-linked copy of the exported directory for each Source
-# defined in the spec file. However, our convention is that there
-# should be only one Source file and one CVS module per RPM. It's okay
-# if the CVS module consists of multiple directories, as long as the
-# spec file knows what's going on.
-$(SOURCEDIRS): SOURCES/$(package)
- cp -rl $< $@
-
-.SECONDARY: SOURCES/$(package) $(SOURCEDIRS)
-
-# Generate tarballs
-SOURCES/%.tar.bz2: SOURCES/%
- tar cpjf $@ -C SOURCES $*
-
-SOURCES/%.tar.gz: SOURCES/%
- tar cpzf $@ -C SOURCES $*
-
-SOURCES/%.tgz: SOURCES/%
- tar cpzf $@ -C SOURCES $*
-
-SOURCES/%.zip: SOURCES/%
- cd SOURCES && zip -r ../$@ $*
-
-SOURCES/%.tar: SOURCES/%
- tar cpf $@ -C SOURCES $*
-
-#
-# Build
-#
-
-all: $(RPMS) $(SRPM)
-
-# Build RPMS
-$(RPMS): $(SPECFILE) $(SOURCES)
- mkdir -p BUILD RPMS
- $(RPMBUILD) $(RPMFLAGS) -bb $<
-
-# Make the rest of the RPMS depend on the first one since building one
-# builds them all.
-ifneq ($(words $(RPMS)),1)
-$(wordlist 2,$(words $(RPMS)),$(RPMS)): $(firstword $(RPMS))
-endif
-
-# Build SRPM
-$(SRPM): $(SPECFILE) $(SOURCES)
- mkdir -p SRPMS
- $(RPMBUILD) $(RPMFLAGS) -bs $<
-
-# Base rpmbuild in the current directory
-.rpmmacros:
- echo "%_topdir $(HOME)" > $@
- echo "%_tmppath $(HOME)/tmp" >> $@
-
-# Remove files generated by this package
-clean:
- rm -rf \
- $(RPMS) $(SRPM) \
- $(patsubst SOURCES/%,BUILD/%,$(SOURCEDIRS)) \
- $(SOURCES) $(SOURCEDIRS) SOURCES/$(package) \
- $(MK) $(SPECFILE)
-
-.PHONY: all clean
-
-#################### convenience, for debugging only
-# make +foo : prints the value of $(foo)
-# make ++foo : idem but verbose, i.e. foo=$(foo)
-++%: varname=$(subst +,,$@)
-++%:
- @echo $(varname)=$($(varname))
-+%: varname=$(subst +,,$@)
-+%:
- @echo $($(varname))
# Marc E. Fiuczynski <mef@cs.princeton.edu>
# Copyright (C) 2007 The Trustees of Princeton University
#
-# $Id: build.common,v 1.3 2007/08/31 03:17:34 mef Exp $
+# $Id: build.common 1094 2007-11-16 08:38:42Z thierry $
#
function pl_getDefaultDistro() {
pl_DISTRO_RELEASE=$(pl_getRelease)
+# vserver expects something like fc4 or f7
+# for fedora only as of now
+case $pl_DISTRO in
+ [Ff]edora*)
+ if [ "$pl_DISTRO_RELEASE" -le 6 ] ; then
+ pl_DISTRO_NAME=fc$pl_DISTRO_RELEASE
+ else
+ pl_DISTRO_NAME=f$pl_DISTRO_RELEASE
+ fi ;;
+ *)
+ echo "build.common: WARNING - pl_DISTRO_NAME not set for distro=$pl_DISTRO" ;;
+esac
+
# get patch to appropriate yumgroups.xml file
# XXX This path should be relative to PLDISTRO, as defined in
# build/Makefile
pl_YUMGROUPSXML="../build/groups/v4_yumgroups.xml"
+# Thierry: quick & dirty improvement
+# this is updated by the toplevel build, from the appropriate pldistro-dep file
+# use another var for now for safety
+pl_DISTRO_YUMGROUPS="../../../RPMS/yumgroups.xml"
function pl_process_fedora_options () {
# Get options
function pl_getPackages() {
filename=$1
- packages=$(grep "^package:.*" $filename | awk ' {print $2}')
+ packages=$(grep "^package:" $filename | sed -e s,package:,,)
echo "$packages"
return 0
}
+# add -p before each package for mkfedora
+function pl_getPackagesOptions() {
+ pl_getPackages "$@" | awk '{for (i=1;i<=NF;i++) {print "-p " $i}}'
+}
+
function pl_getGroups() {
filename=$1
- groups=$(grep "^group:.*" $filename | awk ' {print $2}')
+ groups=$(grep "^group:" $filename | sed -e s,group:,,)
echo "$groups"
return 0
}
+
+# add -g before each group for mkfedora
+function pl_getGroupsOptions() {
+ pl_getGroups "$@" | awk '{for (i=1;i<=NF;i++) {print "-g " $i}}'
+}
+
+++ /dev/null
-#!/bin/bash
-#
-# PlanetLab release build script. Intended to be used by scripts and
-# crontabs to build nightly releases (default). Can also be invoked
-# manually to build a tagged release (-r) in the current directory.
-#
-# Mark Huang <mlhuang@cs.princeton.edu>
-# Copyright (C) 2003-2005 The Trustees of Princeton University
-#
-# $Id: build.sh,v 1.43 2007/02/01 16:03:33 mlhuang Exp $
-#
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-
-# Set defaults
-SVNPATH=https://svn.planet-lab.org/svn
-TAG=trunk
-MODULE=build
-BASE=$PWD
-PLDISTRO=planetlab
-VSERVER=
-
-# cron does not set USER?
-[ -z "$USER" ] && export USER=$LOGNAME
-
-# Get options
-while getopts "d:r:m:f:b:x:v:h" opt ; do
- case $opt in
- d)
- SVNPATH=$OPTARG
- ;;
- r)
- TAG=$OPTARG
- ;;
- m)
- MAILTO=$OPTARG
- ;;
- f)
- PLDISTRO="$OPTARG"
- ;;
- b)
- BASE=$OPTARG
- ;;
- x)
- BUILDS=$OPTARG
- ;;
- v)
- VSERVER=$OPTARG
- ;;
- h|*)
- echo "usage: `basename $0` [OPTION]..."
- echo " -d directory SVN repository root (default $SVNPATH)"
- echo " -r revision SVN revision to checkout (default $TAG)"
- echo " -v Vserver Vserver reference to build within (optional)"
- echo " -m address Notify recipient of failures (default: none)"
- echo " -f distro Distribution to build (default: $PLDISTRO)"
- echo " -b base Run operations in specified base directory (default $BASE)"
- echo " -x N Remove all but the last N runs from the base directory (default: none)"
- exit 1
- ;;
- esac
-done
-shift $(($OPTIND - 1))
-
-# Base operations in specified directory
-mkdir -p $BASE
-cd $BASE || exit $?
-BASEDIR=$(pwd)
-
-# Remove old runs
-if [ -n "$BUILDS" ] ; then
- ls -t | sed -n ${BUILDS}~1p | xargs rm -rf
-fi
-
-# Create a unique build base
-BASE=build_${TAG/trunk/`date +%Y.%m.%d`}
-[ -n "${VSERVER}" ] && BASE=${VSERVER}_${BASE}
-i=
-while ! mkdir ${BASE}${i} 2>/dev/null ; do
- [ -z ${i} ] && BASE=${BASE}.
- i=$((${i}+1))
- if [ $i -gt 100 ] ; then
- echo "$0: Failed to create release directory `pwd`/${BASE}${i}"
- exit 1
- fi
-done
-BASE=${BASE}${i}
-
-# Redirect output from here
-exec 2>&1
-exec &>${BASE}/log
-
-failure() {
- # Notify recipient of failure
- if [ -n "$MAILTO" ] ; then
- tail -c 8k ${BASE}/log | mail -s "Failures for ${BASE}" $MAILTO
- fi
- exit 1
-}
-
-vfailure() {
- # Notify recipient of failure
- vnamespace -e $BASE umount ${BASEDIR}/${BASE}/data
- vserver $BASE stop
- vserver --silent $BASE delete
- failure
- exit 1
-}
-
-trap failure ERR INT
-
-set -x
-
-VCMDPREFIX=
-if [ -n "$VSERVER" ] ; then
- vserver $BASE build -m clone --rootdir ${BASEDIR} -- --source /vservers/${VSERVER}
- vserver $BASE start
- trap vfailure ERR INT
- if [ -d /data ] ; then
- vnamespace -e $BASE mount -o ro --bind /data ${BASEDIR}/${BASE}/data
- fi
-
- # Checkout build directory
- VSUEXEC="vserver $BASE exec su - build -c"
-
- $VSUEXEC "svn checkout ${SVNPATH}/${MODULE}/${TAG} ${MODULE}"
-
- # Build
- #XXX vserver $BASE suexec build ${MODULE}/make.sh TAG=${TAG} PLDISTRO=${PLDISTRO}
-
- # Install to boot server
- # XXX not yet
-
- trap - ERR INT
- vnamespace -e $BASE umount ${BASEDIR}/${BASE}/data
- vserver $BASE stop
-else
- # Checkout build directory
- svn checkout ${SVNPATH}/${MODULE}/${TAG} ${BASE}
-
- # Build myplc-devel-native, install it to ensure we've got the right packages, and let it rip
- make TAG=${TAG} PLDISTRO=${PLDISTRO} -C ${BASE} BASE=$BASE BUILDS=$BUILDS MyPLC-devel-native
- sudo yum -y localinstall RPMS/i386/MyPLC-devel-native-*.*.rpm
-
- # Build everything
- make TAG=${TAG} PLDISTRO=${PLDISTRO} -C ${BASE} BASE=$BASE BUILDS=$BUILDS
-
- # Install to boot server
- # XXX not yet
- #make TAG=${TAG} PLDISTRO=${PLDISTRO} -C ${BASE} install BASE=$BASE BUILDS=$BUILDS
-fi
-
-exit 0
+++ /dev/null
-#
-#
-#
-
-SVNPATH := https://svn.planet-lab.org/svn
-TAG := trunk
-
-
-# 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
+++ /dev/null
-#!/bin/bash
-#
-# PlanetLab devbox release script. Intended to be used by scripts and
-# crontabs to build nightly releases (default).
-#
-# $Id: devbox.sh,v 1.4 2005/09/21 18:57:53 mef Exp $
-#
-
-# Set defaults
-CVSROOT=:pserver:anon@cvs.planet-lab.org:/cvs
-CVS_RSH=ssh
-MODULE=build
-TAG=HEAD
-BASE=$PWD
-
-# Export certain variables
-export CVS_RSH
-
-BASE=
-# Get options
-while getopts "d:r:m:b:x:h" opt ; do
- case $opt in
- d)
- CVSROOT=$OPTARG
- ;;
- r)
- TAG=$OPTARG
- ;;
- m)
- MAILTO=$OPTARG
- ;;
- b)
- BASE=$OPTARG
- ;;
- x)
- ;;
- h|*)
- echo "usage: `basename $0` [OPTION]..."
- echo " -d directory CVS repository root (default $CVSROOT)"
- echo " -r revision CVS revision to checkout (default $TAG)"
- echo " -m address Notify recipient of failures (default: none)"
- echo " -b base Run operations in specified base directory (default $BASE)"
- exit 1
- ;;
- esac
-done
-
-# Base operations in specified directory
-if [ -z "$BASE" ]; then
- BASE=`mktemp -d /tmp/DEVBOX.XXXXXX` || { echo $"could not make temp file" >& 2; exit 1; }
- mkdir -p $BASE
-fi
-cd $BASE || exit $?
-
-DAT=`date +%Y.%m.%d`
-# Redirect output from here
-exec 2>&1
-exec &>${BASE}/${DAT}/devbox.log
-
-# XXX For debugging
-set -x
-
-# Upload packages to boot server
-SERVER=build@boot.planet-lab.org
-REPOSITORY=/var/www/html/install-rpms
-
-for RELEASE in devbox alpha-devbox beta-devbox ; do
- TMPDEVBOXRELEASE=planetlab-${RELEASE}_${DAT}_tmp
- DEVBOXRELEASE=planetlab-${RELEASE}
-
- ssh $SERVER mkdir -p ${REPOSITORY}/${TMPDEVBOXRELEASE}
- if [ $? -ne 0 ] ; then
- echo "ERROR: mkdir -p ${REPOSITORY}/${TMPDEVBOXRELEASE} failed"
- exit 1
- fi
- BUILT=$(echo $DEVBOXRELEASE | sed "s,\-devbox,,")
- ssh $SERVER ln -nf ${REPOSITORY}/$BUILT/*.rpm ${REPOSITORY}/${TMPDEVBOXRELEASE}
-
- mkdir -p ${BASE}/${DAT}/${DEVBOXRELEASE}
- install -D -m 644 ${DAT}/groups/${RELEASE}_yumgroups.xml ${BASE}/${DAT}/${DEVBOXRELEASE}/yumgroups.xml
- scp ${BASE}/${DAT}/${DEVBOXRELEASE}/yumgroups.xml ${SERVER}:${REPOSITORY}/${TMPDEVBOXRELEASE}/yumgroups.xml
-
- ssh $SERVER rm -rf ${REPOSITORY}/${DEVBOXRELEASE}-old
- ssh $SERVER mv ${REPOSITORY}/${DEVBOXRELEASE} ${REPOSITORY}/${DEVBOXRELEASE}-old
- ssh $SERVER mv ${REPOSITORY}/${TMPDEVBOXRELEASE} ${REPOSITORY}/${DEVBOXRELEASE}
- ssh $SERVER rm -rf ${REPOSITORY}/${DEVBOXRELEASE}-old
-
- ssh $SERVER yum-arch ${REPOSITORY}/${DEVBOXRELEASE} >/dev/null
- ssh $SERVER createrepo -g yumgroups.xml ${REPOSITORY}/${DEVBOXRELEASE} >/dev/null
-done
-
-cd / || exit $?
-#rm -rf $BASE
-
-exit 0
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
-<comps>
-
- <group>
- <id>planetlab</id>
- <name>PlanetLab</name>
- <default>true</default>
- <description>PlanetLab Node Packages</description>
- <uservisible>false</uservisible>
- <packagelist>
- <packagereq type="mandatory">basesystem</packagereq>
- <packagereq type="mandatory">bash</packagereq>
- <packagereq type="mandatory">coreutils</packagereq>
- <packagereq type="mandatory">cpio</packagereq>
- <packagereq type="mandatory">e2fsprogs</packagereq>
- <packagereq type="mandatory">ed</packagereq>
- <packagereq type="mandatory">file</packagereq>
- <packagereq type="mandatory">filesystem</packagereq>
- <packagereq type="mandatory">glibc</packagereq>
- <packagereq type="mandatory">hdparm</packagereq>
- <packagereq type="mandatory">initscripts</packagereq>
- <packagereq type="mandatory">iproute</packagereq>
- <packagereq type="mandatory">iputils</packagereq>
- <packagereq type="mandatory">kbd</packagereq>
- <packagereq type="mandatory">kernel</packagereq>
- <packagereq type="mandatory">libtermcap</packagereq>
- <packagereq type="mandatory">passwd</packagereq>
- <packagereq type="mandatory">procps</packagereq>
- <packagereq type="mandatory">readline</packagereq>
- <packagereq type="mandatory">fedora-release</packagereq>
- <packagereq type="mandatory">rootfiles</packagereq>
- <packagereq type="mandatory">rpm</packagereq>
- <packagereq type="mandatory">setserial</packagereq>
- <packagereq type="mandatory">setup</packagereq>
- <packagereq type="mandatory">sysklogd</packagereq>
- <packagereq type="mandatory">SysVinit</packagereq>
- <packagereq type="mandatory">termcap</packagereq>
- <packagereq type="mandatory">util-linux</packagereq>
- <packagereq type="mandatory">vim-minimal</packagereq>
-
- <packagereq type="default">authconfig</packagereq>
- <packagereq type="default">shadow-utils</packagereq>
-
- <packagereq type="default">anacron</packagereq>
- <packagereq type="mandatory">at</packagereq>
- <packagereq type="default">authconfig</packagereq>
- <packagereq type="default">autofs</packagereq>
- <packagereq type="mandatory">bc</packagereq>
- <packagereq type="mandatory">bind-utils</packagereq>
- <packagereq type="mandatory">bzip2</packagereq>
- <packagereq type="mandatory">crontabs</packagereq>
- <packagereq type="default">dhclient</packagereq>
- <packagereq type="default">diffutils</packagereq>
- <packagereq type="default">ethtool</packagereq>
- <packagereq type="default" basearchonly="true">kernel-utils</packagereq>
- <packagereq type="mandatory">logrotate</packagereq>
- <packagereq type="mandatory">lsof</packagereq>
- <packagereq type="default">logwatch</packagereq>
- <packagereq type="mandatory">mailcap</packagereq>
- <packagereq type="default">nano</packagereq>
- <packagereq type="default">nc</packagereq>
- <packagereq type="mandatory">netdump</packagereq>
- <packagereq type="default">openssh-clients</packagereq>
- <packagereq type="mandatory">parted</packagereq>
- <packagereq type="mandatory">pciutils</packagereq>
- <packagereq type="mandatory">psacct</packagereq>
- <packagereq type="mandatory">quota</packagereq>
- <packagereq type="default">rsh</packagereq>
- <packagereq type="default">rsync</packagereq>
- <packagereq type="default">sendmail</packagereq>
- <packagereq type="default">sudo</packagereq>
- <packagereq type="mandatory">telnet</packagereq>
- <packagereq type="mandatory">traceroute</packagereq>
- <packagereq type="mandatory">time</packagereq>
- <packagereq type="mandatory">tmpwatch</packagereq>
- <packagereq type="default">tcpdump</packagereq>
- <packagereq type="default">openssh-server</packagereq>
- <packagereq type="default">vixie-cron</packagereq>
- <packagereq type="default">wget</packagereq>
- <packagereq type="default">yum</packagereq>
-
- <packagereq type="mandatory">curl</packagereq>
- <packagereq type="mandatory">gzip</packagereq>
- <packagereq type="mandatory">iptables</packagereq>
- <packagereq type="mandatory">lvm</packagereq>
- <packagereq type="mandatory">mkinitrd</packagereq>
- <packagereq type="mandatory">ntp</packagereq>
- <packagereq type="mandatory">perl</packagereq>
- <packagereq type="mandatory">python</packagereq>
- <packagereq type="mandatory">tar</packagereq>
- <packagereq type="mandatory">expect</packagereq>
-
- <packagereq type="mandatory">portmap</packagereq>
- <packagereq type="mandatory">nfs-utils</packagereq>
-
- <packagereq type="mandatory">schedutils</packagereq>
-
- <packagereq type="default">vconfig</packagereq>
-
- <packagereq type="mandatory">util-vserver</packagereq>
- <packagereq type="mandatory">util-vserver-build</packagereq>
- <packagereq type="mandatory">util-vserver-lib</packagereq>
- <packagereq type="mandatory">util-vserver-core</packagereq>
- <packagereq type="mandatory">util-vserver-sysv</packagereq>
- <packagereq type="mandatory">util-vserver-legacy</packagereq>
- <packagereq type="mandatory">util-vserver-python</packagereq>
- <packagereq type="mandatory">util-python</packagereq>
- <packagereq type="mandatory">NodeManager</packagereq>
- <packagereq type="mandatory">NodeUpdate</packagereq>
- <packagereq type="mandatory">PLBootServerRequest</packagereq>
- <packagereq type="mandatory">PlanetLabAccounts</packagereq>
- <packagereq type="mandatory">PlanetLabConf</packagereq>
- <packagereq type="mandatory">pycurl</packagereq>
- <packagereq type="mandatory">vnet</packagereq>
- <packagereq type="mandatory">hotplug</packagereq>
- <packagereq type="mandatory">pcmcia-cs</packagereq>
- <packagereq type="mandatory">madwifi</packagereq>
- <packagereq type="mandatory">wireless-tools</packagereq>
-
- <packagereq type="mandatory">PlanetLabID</packagereq>
- <packagereq type="mandatory">autofs</packagereq>
- <packagereq type="mandatory">planetlab_sudo</packagereq>
- <packagereq type="mandatory">pl_sshd</packagereq>
- <packagereq type="mandatory">ipod</packagereq>
- <packagereq type="mandatory">vserver-reference</packagereq>
- <packagereq type="mandatory">vserver-system-packages</packagereq>
- <packagereq type="mandatory">proper</packagereq>
- <packagereq type="mandatory">pl_mom</packagereq>
- <packagereq type="mandatory">PlanetLabAuth</packagereq>
- <packagereq type="mandatory">netflow-utils</packagereq>
- <packagereq type="mandatory">PLCAPI</packagereq>
- </packagelist>
- </group>
-
- <group>
- <id>vserver</id>
- <name>VServer</name>
- <uservisible>true</uservisible>
- <description>VServer Reference Image</description>
- <packagelist>
- <packagereq type="mandatory">bash</packagereq>
- <packagereq type="mandatory">coreutils</packagereq>
- <packagereq type="mandatory">iputils</packagereq>
- <packagereq type="mandatory">kernel-vserver</packagereq>
-
- <packagereq type="mandatory">bzip2</packagereq>
- <packagereq type="mandatory">crontabs</packagereq>
- <packagereq type="default">diffutils</packagereq>
- <packagereq type="mandatory">logrotate</packagereq>
- <packagereq type="default">openssh-clients</packagereq>
- <packagereq type="mandatory">passwd</packagereq>
- <packagereq type="default">rsh</packagereq>
- <packagereq type="default">rsync</packagereq>
- <packagereq type="default">sudo</packagereq>
- <packagereq type="default">tcpdump</packagereq>
- <packagereq type="mandatory">telnet</packagereq>
- <packagereq type="mandatory">traceroute</packagereq>
- <packagereq type="mandatory">time</packagereq>
- <packagereq type="default">vixie-cron</packagereq>
- <packagereq type="default">wget</packagereq>
- <packagereq type="default">yum</packagereq>
-
- <packagereq type="mandatory">curl</packagereq>
- <packagereq type="mandatory">gzip</packagereq>
- <packagereq type="mandatory">perl</packagereq>
- <packagereq type="mandatory">python</packagereq>
- <packagereq type="mandatory">tar</packagereq>
- </packagelist>
- </group>
-
- <group>
- <id>bootcd</id>
- <name>BootCD</name>
- <uservisible>true</uservisible>
- <description>BootCD Image</description>
- <packagelist>
- <packagereq type="mandatory">dhclient</packagereq>
- <packagereq type="mandatory">bash</packagereq>
- <packagereq type="mandatory">coreutils</packagereq>
- <packagereq type="mandatory">iputils</packagereq>
- <packagereq type="mandatory">kernel</packagereq>
- <packagereq type="mandatory">hotplug</packagereq>
- <packagereq type="mandatory">pcmcia-cs</packagereq>
- <packagereq type="mandatory">madwifi</packagereq>
- <packagereq type="mandatory">wireless-tools</packagereq>
-
- <packagereq type="mandatory">bzip2</packagereq>
- <packagereq type="mandatory">crontabs</packagereq>
- <packagereq type="default">diffutils</packagereq>
- <packagereq type="mandatory">logrotate</packagereq>
- <packagereq type="default">openssh-clients</packagereq>
- <packagereq type="mandatory">passwd</packagereq>
- <packagereq type="default">rsh</packagereq>
- <packagereq type="default">rsync</packagereq>
- <packagereq type="default">sudo</packagereq>
- <packagereq type="default">tcpdump</packagereq>
- <packagereq type="mandatory">telnet</packagereq>
- <packagereq type="mandatory">traceroute</packagereq>
- <packagereq type="mandatory">time</packagereq>
- <packagereq type="default">vixie-cron</packagereq>
- <packagereq type="default">wget</packagereq>
- <packagereq type="default">yum</packagereq>
- <packagereq type="mandatory">curl</packagereq>
- <packagereq type="mandatory">gzip</packagereq>
- <packagereq type="mandatory">perl</packagereq>
- <packagereq type="mandatory">python</packagereq>
- <packagereq type="mandatory">tar</packagereq>
- <packagereq type="mandatory">pciutils</packagereq>
- <packagereq type="mandatory">kbd</packagereq>
- <packagereq type="mandatory">authconfig</packagereq>
- <packagereq type="mandatory">hdparm</packagereq>
- <packagereq type="mandatory">lvm</packagereq>
- <packagereq type="mandatory">lvm2</packagereq>
- <packagereq type="mandatory">kexec-tools</packagereq>
- <packagereq type="mandatory">gnupg</packagereq>
- <packagereq type="mandatory">nano</packagereq>
- <packagereq type="mandatory">parted</packagereq>
- <packagereq type="mandatory">pyparted</packagereq>
- <packagereq type="mandatory">openssh-server</packagereq>
- <packagereq type="mandatory">openssh-clients</packagereq>
- <packagereq type="mandatory">ncftp</packagereq>
- <packagereq type="mandatory">dosfstools</packagereq>
- <packagereq type="mandatory">dos2unix</packagereq>
- <packagereq type="mandatory">bind-utils</packagereq>
- <packagereq type="mandatory">sharutils</packagereq>
- </packagelist>
- </group>
-
-</comps>
+++ /dev/null
-#!/bin/bash
-#
-# make(1) wrapper to build PlanetLab RPMS inside a myplc-devel
-# development environment.
-#
-# 1. $BASE is the build/ directory containing this script.
-# 2. Builds myplc-devel using host tools.
-# 3. Mounts $BASE onto the home directory of the build user inside
-# myplc-devel.
-# 4. Executes "make" on the specified targets.
-#
-# Can be used to manally restart a build also, e.g.,
-#
-# cd build/nightly/2007.02.07/
-# ./make.sh kernel
-#
-# Mark Huang <mlhuang@cs.princeton.edu>
-# Copyright (C) 2007 The Trustees of Princeton University
-#
-# $Id: make.sh,v 1.2 2007/02/07 23:49:42 mlhuang Exp $
-#
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-
-BASE=$(cd "$(dirname $0)" && pwd -P)
-
-# Delete .rpmmacros and parseSpec files in case we are restarting
-rm -f $BASE/.rpmmacros $BASE/parseSpec
-
-# Build development environment first
-make -C $BASE myplc-devel
-
-# Build everything else inside the development environment
-export PLC_ROOT=$(echo $BASE/BUILD/myplc-devel-*/MyPLC/devel/root)
-export PLC_DATA=$(echo $BASE/BUILD/myplc-devel-*/MyPLC/devel/data)
-
-cleanup() {
- sudo umount $PLC_ROOT/data/fedora
- sudo umount $PLC_ROOT/data/build
- sudo $BASE/BUILD/myplc-devel-*/MyPLC/host.init stop
- sudo chown -h -R $USER $PLC_DATA
-}
-
-trap "cleanup" ERR INT
-
-# Start development environment
-sudo $BASE/BUILD/myplc-devel-*/MyPLC/host.init start
-
-# Make sure "build" user has proper sudoers setup
-if [ $(sudo grep "build.*ALL=(ALL).*NOPASSWD:.*ALL" $PLC_ROOT/etc/sudoers | wc -l) -eq 0 ] ; then
- sudo echo "build ALL=(ALL) NOPASSWD: ALL" >> $PLC_ROOT/etc/sudoers
-fi
-
-# Cross mount the current build directory to the build user home directory
-sudo mount -o bind,rw $BASE $PLC_ROOT/data/build
-
-# Also cross mount /data/fedora if it exists
-if [ -d /data/fedora ] ; then
- sudo mkdir -p $PLC_ROOT/data/fedora
- sudo mount -o bind,ro /data/fedora $PLC_ROOT/data/fedora
-fi
-
-# Delete .rpmmacros and parseSpec files so that they get regenerated
-# appropriately in the development environment.
-rm -f $BASE/.rpmmacros $BASE/parseSpec
-
-# Enable networking
-sudo cp -f /etc/hosts /etc/resolv.conf $PLC_ROOT/etc/
-
-# Run the rest of the build
-sudo chroot $PLC_ROOT su - build -c "make $@"
-rc=$?
-
-# Clean up
-cleanup
-trap - ERR INT
-
-exit $rc
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2004-2006 The Trustees of Princeton University
#
-# $Id: mkfedora,v 1.33 2007/08/31 02:23:08 mef Exp $
+# $Id: mkfedora 1073 2007-11-15 09:56:03Z thierry $
#
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
# Default yum repositories to try
mirrors=(
file:///data/fedora
+http://localhost/fedora
ftp://smoke.cs.princeton.edu/pub/mirrors/fedora
http://coblitz.codeen.org/coblitz.planet-lab.org/pub/fedora
ftp://mirror.cs.princeton.edu/pub/mirrors/fedora
curl --fail --silent --max-time 60 "$1"
}
+# hard to find two mirrors with a similar layout
+# set list of attempted locations according to releasever
+if [ $releasever -ge 7 ] ; then
+ attempts="
+$releasever/Everything/$basearch/os
+core/$releasever/Everything/$basearch/os \
+linux/core/$releasever/$basearch/os
+"
+else
+ attempts="
+linux/core/$releasever/$basearch/os
+core/$releasever/$basearch/os
+$releasever/$basearch/os
+"
+fi
+
for mirror in "${mirrors[@]}" ; do
- if [ $releasever -ge 7 ] ; then
- for baseurl in \
- $mirror/$releasever/Everything/$basearch/os ; do
- if fetch $baseurl/repodata/repomd.xml >/dev/null ; then
- break
- fi
- unset baseurl
- done
- else
- for baseurl in \
- $mirror/linux/core/$releasever/$basearch/os \
- $mirror/core/$releasever/$basearch/os \
- $mirror/$releasever/$basearch/os ; do
- if fetch $baseurl/repodata/repomd.xml >/dev/null ; then
- break
- fi
- unset baseurl
- done
- fi
+ for attempt in $attempts; do
+ baseurl=$mirror/$attempt
+ if fetch $baseurl/repodata/repomd.xml >/dev/null ; then
+ break
+ fi
+ unset baseurl
+ done
if [ -n "$baseurl" ] ; then
break
fi
done
if [ -z "$baseurl" ] ; then
- if [ $releasever -ge 7 ] ; then
- echo "Error: $releasever/Everything/$basearch/os/repodata/repomd.xml"
- echo " could not be found in any of the following locations:"
- echo
- for mirror in ${mirrors[@]} ; do
- echo $mirror/linux
- done
- else
- echo "Error: $releasever/$basearch/os/repodata/repomd.xml"
- echo " could not be found in any of the following locations:"
- echo
- for mirror in ${mirrors[@]} ; do
- echo $mirror/linux/core
- echo $mirror/core
- echo $mirror
- done
- fi
+ echo "Error: $releasever/$basearch/os/repodata/repomd.xml"
+ echo " could not be found in any of the following locations:"
+ echo
+ for mirror in ${mirrors[@]} ; do
+ for attempt in $attempts ; do
+ echo $mirror/$attempt
+ done
+ done
echo
usage
fi
+++ /dev/null
-/*
- * Parses RPM spec file into Makefile fragment. See
- *
- * http://fedora.redhat.com/docs/drafts/rpm-guide-en/ch-programming-c.html
- *
- * Mark Huang <mlhuang@cs.princeton.edu>
- * Copyright (C) 2006 The Trustees of Princeton University
- *
- * $Id: parseSpec.c,v 1.7 2007/07/23 15:12:44 mef Exp $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libgen.h>
-#include <errno.h>
-#include <rpm/rpmlib.h>
-#include <rpm/rpmts.h>
-#include <rpm/rpmcli.h>
-#include <rpm/rpmbuild.h>
-#include <rpm/rpmspec.h>
-
-/* the structure describing the options we take and the defaults */
-static struct poptOption optionsTable[] = {
- { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
- "Common options for all rpm modes and executables:",
- NULL },
-
- POPT_AUTOALIAS
- POPT_AUTOHELP
- POPT_TABLEEND
-};
-
-/* Stolen from rpm/build/spec.c:rpmspecQuery() */
-Spec
-rpmspecGet(rpmts ts, const char * arg)
-{
- char * buildRoot = NULL;
- int recursing = 0;
- char * passPhrase = "";
- char *cookie = NULL;
- int anyarch = 1;
- int force = 1;
-
- if (parseSpec(ts, arg, "/", buildRoot, recursing, passPhrase,
- cookie, anyarch, force)) {
- fprintf(stderr, "query of specfile %s failed, can't parse\n", arg);
- return NULL;
- }
-
- return rpmtsSpec(ts);
-}
-
-int
-main(int argc, char *argv[])
-{
- poptContext context;
- rpmts ts = NULL;
- int ec = 0;
- Spec spec;
- struct Source *source;
- Package pkg;
- const char *name, *version, *release, *arch, *unused;
-
- /* BEGIN: support to pull out --target from the args list */
- int alen, i;
- char *target = NULL;
- int args = 1;
- int tlen = strlen("--target");
-
- /* walk argv list looking for --target */
- while ((args+1)<argc) {
- if(strncmp(argv[args],"--target",tlen)==0){
- char **dash;
-
- /* get arch component of the --target option */
- dash = (char**)strchr(argv[args+1],'-');
- if (dash != NULL) *dash=NULL;
-
- /* copy arch component of --target option to target */
- alen = strnlen(argv[args+1],32);
- target = (char*)malloc(alen+1);
- if (target == NULL) return errno;
- strncpy(target,argv[args+1],alen);
- target[alen]='\0';
-
- /* change argc, argv to take out the "--target xxx" */
- for (i=args;i<argc;i++) argv[i]=argv[i+2];
- argc-=2;
-
- break;
- }
- args++;
- }
- argv[1]=argv[argc-1];
- argv[2]=0;
- argc=2;
- /* END: support to pull out --target from the args list */
-
- /* Parse common options for all rpm modes and executables */
- context = rpmcliInit(argc, argv, optionsTable);
-
- /* Create transaction state */
- ts = rpmtsCreate();
-
- /* Parse spec file. The rpmcli functions don't allow you to
- * access the Spec structure directly, so we call our own
- * version of rpmSpecQuery() directly. */
- spec = rpmspecGet(ts, argv[1]);
- if (!spec)
- goto done;
-
- /* Print sources */
- for (source = spec->sources; source; source = source->next) {
- char fullSource[PATH_MAX];
-
- strncpy(fullSource, source->fullSource, sizeof(fullSource));
- printf("SOURCES += SOURCES/%s\n", basename(fullSource));
- }
-
- /* Get SRPM name from name of first package */
- pkg = spec->packages;
- name = version = release = NULL;
- (void) headerNVR(pkg->header, &name, &version, &release);
- if (name && version && release)
- printf("SRPM := SRPMS/%s-%s-%s.src.rpm\n",
- name, version, release);
-
- /* Print non-empty packages */
- for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
- name = version = release = arch = NULL;
- (void) headerNEVRA(pkg->header, &name, &unused, &version, &release, &arch);
- if (name && version && release && arch) {
- if (!pkg->fileList)
- printf("# Empty\n# ");
-
- if (target != NULL) {
- if (strcmp(arch,target)!=0) {
- arch=target;
- }
- }
- printf("RPMS += RPMS/%s/%s-%s-%s.%s.rpm\n",
- arch, name, version, release, arch);
- }
- }
-
- spec = freeSpec(spec);
-
- done:
- ts = rpmtsFree(ts);
- context = rpmcliFini(context);
- return ec;
-}
--- /dev/null
+#XXX We need to rethink this installation support for several reasons:
+# 1) it is pldistro specific
+# 2) may involve installing files for different node groups (e.g., alpha, beta, etc.)
+# 3) may involve N rpm repositories to where it should be uploaded
+#
+# Not clear to me at all that this should be incorporated into a
+# Makefile at all. Instead it should be something that gets wrapped
+# into a myplc (sub) rpm package and then is installed by that way.
+
+#
+# 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
--- /dev/null
+build-SVNPATH := http://svn.planet-lab.org/svn/build/trunk
+Linux-2.6-SVNPATH := http://svn.planet-lab.org/svn/Linux-2.6/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
+NodeManager-SVNPATH := http://svn.planet-lab.org/svn/NodeManager/trunk
+pl_sshd-SVNPATH := http://svn.planet-lab.org/svn/pl_sshd/trunk
+libhttpd++-SVNPATH := http://svn.planet-lab.org/svn/libhttpd++/trunk
+proper-SVNPATH := http://svn.planet-lab.org/svn/proper/trunk
+CoDemux-SVNPATH := http://svn.planet-lab.org/svn/CoDemux/trunk
+ulogd-SVNPATH := http://svn.planet-lab.org/svn/ulogd/trunk
+PlanetFlow-SVNPATH := http://svn.planet-lab.org/svn/PlanetFlow/trunk
+Mom-SVNPATH := http://svn.planet-lab.org/svn/Mom/trunk
+iptables-SVNPATH := http://svn.planet-lab.org/svn/iptables/trunk
+iproute2-SVNPATH := http://svn.planet-lab.org/svn/iproute2/trunk
+util-python-SVNPATH := http://svn.planet-lab.org/svn/util-python/trunk
+vsys-SVNPATH := http://svn.planet-lab.org/svn/vsys/trunk
+PLCAPI-SVNPATH := http://svn.planet-lab.org/svn/PLCAPI/trunk
+WWW-SVNPATH := http://svn.planet-lab.org/svn/WWW/trunk
+VserverReference-SVNPATH := http://svn.planet-lab.org/svn/VserverReference/trunk
+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
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2003-2006 The Trustees of Princeton University
#
-# $Id: planetlab.mk,v 1.71 2007/09/25 18:38:47 faiyaza Exp $
+# $Id: planetlab.mk 1082 2007-11-15 13:49:05Z thierry $
#
#
# 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
#
-# TAG or package-TAG: CVS/SVN tag to use
-# package-MODULE: CVS/SVN module name to use
-# package-SPEC: RPM spec file template
+# 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
-# package-CVS_RSH: If not ssh for cvs
#
# Add to ALL if you want the package built as part of the default set.
#
#
# 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
#
-TAGSFILE = default-tags.mk
-include $(TAGSFILE)
-
#
# kernel
#
-
kernel-$(HOSTARCH)-MODULE := Linux-2.6
kernel-$(HOSTARCH)-SPEC := scripts/kernel-2.6-planetlab.spec
ifeq ($(HOSTARCH),i386)
kernel-$(HOSTARCH)-RPMFLAGS:= --target $(HOSTARCH)
endif
-ALL += kernel-$(HOSTARCH)
+KERNELS += kernel-$(HOSTARCH)
+
+kernel: $(KERNELS)
+kernel-clean: $(foreach package,$(KERNELS),$(package)-clean)
-kernel-clean: kernel-$(HOSTARCH)-clean
-kernel: kernel-$(HOSTARCH)
+ALL += $(KERNELS)
#
# util-vserver
#
-
util-vserver-MODULE := util-vserver
util-vserver-SPEC := util-vserver.spec
util-vserver-RPMFLAGS:= --without dietlibc
+util-vserver-DEPENDS := libnl
ALL += util-vserver
#
# NodeUpdate
#
-
NodeUpdate-MODULE := NodeUpdate
NodeUpdate-SPEC := NodeUpdate.spec
ALL += NodeUpdate
-#
-# PlanetLabConf: DEPRECATED.
-#
-# conf_files does the same thing in NM
-#
-
-#PlanetLabConf-MODULE := PlanetLabConf
-#PlanetLabConf-SPEC := PlanetLabConf/PlanetLabConf.spec
-#ALL += PlanetLabConf
-
#
# ipod
#
-
PingOfDeath-MODULE := PingOfDeath
PingOfDeath-SPEC := ipod.spec
ALL += PingOfDeath
#
-# sudo: DEPRECATED
+# NodeManager
#
-# Added functionality provided by this package to www/PlanetLabConf/sudoers.
-#
-
-#sudo-MODULE := sudo
-#sudo-SPEC := sudo/planetlab_sudo.spec
-#ALL += sudo
-
-#
-# pycurl: DEPRECATE
-#
-# [tony] use FC6+ release
-#
-
-#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: DEPRECATE
-#
-# Not used by anything.
-#
-
-#BootServerRequest-MODULE := BootServerRequest
-#BootServerRequest-SPEC := BootServerRequest/PLBootServerRequest.spec
-#ALL += BootServerRequest
-#
-#
-#
-# Node Manager
-#
-
NodeManager-MODULE := NodeManager
NodeManager-SPEC := NodeManager.spec
ALL += NodeManager
#
# pl_sshd
#
-
pl_sshd-MODULE := pl_sshd
pl_sshd-SPEC := pl_sshd.spec
ALL += pl_sshd
# Deprecate when vsys takes over [sapan].
# keep in build for proper.
#
-
libhttpd++-MODULE := libhttpd++
libhttpd++-SPEC := libhttpd++.spec
ALL += libhttpd++
#
# Proper: Privileged Operations Service
#
-
proper-MODULE := proper
proper-SPEC := proper.spec
proper-RPMBUILD := sudo bash ./rpmbuild.sh
+# proper uses scripts in util-python for building
+proper-DEPENDS := libhttpd++ util-python
ALL += proper
-proper: libhttpd++
-
#
# CoDemux: Port 80 demux
#
-
CoDemux-MODULE := CoDemux
CoDemux-SPEC := codemux.spec
CoDemux-RPMBUILD := sudo bash ./rpmbuild.sh
ALL += CoDemux
-#
-# MySQL
-#
-
-mysql-MODULE := mysql
-mysql-SPEC := mysql.spec
-#ALL += mysql
-
#
# ulogd
#
-
ulogd-MODULE := ulogd
ulogd-SPEC := ulogd.spec
+ulogd-DEPENDS := $(KERNELS) proper
ALL += ulogd
-ulogd: kernel proper #mysql
-
#
-# netflow
+# PlanetFlow
#
-
PlanetFlow-MODULE := PlanetFlow
-PlanetFlow-RPMFLAGS := --define "distroname '$(DISTRO)'" --define "distrorelease $(RELEASE)"
PlanetFlow-SPEC := netflow.spec
+PlanetFlow-SPECVARS := distroname=$(DISTRO) distrorelease=$(RELEASE)
ALL += PlanetFlow
-PlanetFlow: #mysql
-
#
# PlanetLab Mom: Cleans up your mess
#
-
Mom-MODULE := Mom
Mom-SPEC := pl_mom.spec
ALL += Mom
#
# iptables
#
-
iptables-MODULE := iptables
iptables-SPEC := iptables.spec
+iptables-DEPENDS := $(KERNELS)
ALL += iptables
-iptables: kernel
-
#
# iproute
#
-
iproute-MODULE := iproute2
iproute-SPEC := iproute.spec
ALL += iproute
-#
-# kexec-tools: DEPRECATE
-#
-# [marc] use FC6+ release
-#
-
-#kexec-tools-MODULE := kexec-tools
-#kexec-tools-SPEC := kexec-tools/kexec-tools.spec
-#ALL += kexec-tools
-
#
# util-python
#
# [marc] deprecate with proper
#
-
util-python-MODULE := util-python
util-python-SPEC := util-python.spec
ALL += util-python
-# proper uses scripts in util-python for building
-proper: util-python
-
#
# vsys
#
endif
endif
-
#
# PLCAPI
#
-
PLCAPI-MODULE := PLCAPI
PLCAPI-SPEC := PLCAPI.spec
ALL += PLCAPI
#
# PLCWWW
#
-
PLCWWW-MODULE := WWW
PLCWWW-SPEC := PLCWWW.spec
ALL += PLCWWW
-#
-# vserver-reference
-#
-
-VserverReference-MODULE := VserverReference build
-VserverReference-SPEC := vserver-reference.spec
-# Package must be built as root
-VserverReference-RPMBUILD := sudo bash ./rpmbuild.sh
-ALL += VserverReference
-
-# vserver-reference may require current packages
-VserverReference: $(filter-out vserver-reference,$(ALL))
-
-# ... and the groups manifest
-VserverReference: RPMS/yumgroups.xml
-
-
#
# BootManager
#
-
BootManager-MODULE := BootManager build
BootManager-SPEC := bootmanager.spec
# Package must be built as root
BootManager-RPMBUILD := sudo bash ./rpmbuild.sh
ALL += BootManager
+# we do not want BootCD to depend on vserver-reference, do we ?
+ALL-REGULARS := $(ALL)
+
#
-# BootCD
+# vserver-reference
#
+VserverReference-MODULE := VserverReference build
+VserverReference-SPEC := vserver-reference.spec
+# Package must be built as root
+VserverReference-RPMBUILD := sudo bash ./rpmbuild.sh
+# package requires all regular packages
+VserverReference-DEPENDS := $(ALL-REGULARS)
+VserverReference-DEPENDFILES := RPMS/yumgroups.xml
+ALL += VserverReference
+#
+# BootCD
+#
BootCD-MODULE := 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
#
# BootstrapFS
#
-
BootstrapFS-MODULE := BootstrapFS build
BootstrapFS-SPEC := bootstrapfs.spec
-# Package must be built as root
BootstrapFS-RPMBUILD := sudo bash ./rpmbuild.sh
+# package requires all regular packages
+BootstrapFS-DEPENDS := $(ALL-REGULARS)
+BootstrapFS-DEPENDFILES := RPMS/yumgroups.xml
ALL += BootstrapFS
-# BootstrapFS requires current packages
-BootstrapFS: $(filter-out BootstrapFS,$(ALL))
-
-# ... and the groups manifest
-BootstrapFS: RPMS/yumgroups.xml
-
#
# MyPLC
#
-
-MyPLC-MODULE := MyPLC build WWW
+MyPLC-MODULE := 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 may require current packages
-MyPLC: $(filter-out MyPLC,$(ALL))
-
-# ...and the yum manifest
-MyPLC: RPMS/yumgroups.xml
-
-
#
# MyPLC native
#
-
-MyPLC-native-MODULE := MyPLC build WWW
+MyPLC-native-MODULE := MyPLC build
MyPLC-native-SPEC := myplc-native.spec
# Package must be built as root
MyPLC-native-RPMBUILD := sudo bash ./rpmbuild.sh
-ALL += MyPLC-native
-
-# MyPLC may require current packages
-MyPLC-native: $(filter-out MyPLC,$(ALL))
-
-# ...and the yum manifest
-MyPLC-native: RPMS/yumgroups.xml
+# Thierry : I don't think we depend on these at build-time
+#MyPLC-native-DEPENDS := $(MyPLC-DEPENDS)
+# Thierry : dunno about this one, let's stay safe
+MyPLC-native-DEPENDFILES := $(MyPLC-DEPENDFILES)
+#ALL += MyPLC-native
#
# MyPLC development environment
#
-
MyPLC-devel-MODULE := MyPLC build
MyPLC-devel-SPEC := myplc-devel.spec
-# Package must be built as root
MyPLC-devel-RPMBUILD := sudo bash ./rpmbuild.sh
#ALL += MyPLC-devel
#
# MyPLC native development environment
#
-
MyPLC-devel-native-MODULE := MyPLC
-MyPLC-devel-native-RPMFLAGS := --define "distroname '$(DISTRO)'" --define "distrorelease $(RELEASE)"
+MyPLC-devel-native-SPECVARS := distroname=$(DISTRO) distrorelease=$(RELEASE)
MyPLC-devel-native-SPEC := myplc-devel-native.spec
-ALL += MyPLC-devel-native
+#ALL += MyPLC-devel-native
#
# libnl
# (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
-util-vserver: libnl
-
-RPMS/yumgroups.xml:
- install -D -m 644 groups/v4_yumgroups.xml RPMS/yumgroups.xml
-
-#XXX We need to rethink this installation support for several reasons:
-# 1) it is pldistro specific
-# 2) may involve installing files for different node groups (e.g., alpha, beta, etc.)
-# 3) may involve N rpm repositories to where it should be uploaded
-#
-# Not clear to me at all that this should be incorporated into a
-# Makefile at all. Instead it should be something that gets wrapped
-# into a myplc (sub) rpm package and then is installed by that way.
-
-#
-# 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
+++ /dev/null
-#
-# PlanetLab Central components list
-#
-# Mark Huang <mlhuang@cs.princeton.edu>
-# Copyright (C) 2003-2005 The Trustees of Princeton University
-#
-# $Id: plc.mk,v 1.10 2006/03/10 21:44:07 mlhuang 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.
-#
-
-#
-# Default values
-#
-
-CVSROOT := :pserver:anon@cvs.planet-lab.org:/cvs
-TAG := HEAD
-
-#
-# plc
-#
-
-plc-CVSROOT := :ext:cvs.planet-lab.org:/cvs
-plc-MODULE := plc
-plc-SPEC := plc/plc.spec
-ALL += plc
-
-#
-# Proper: Privileged Operations Service
-#
-
-proper-MODULE := proper
-proper-SPEC := proper/proper.spec
-ALL += proper
-
-#
-# util-python
-#
-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
-
-#
-# ulogd
-#
-
-ulogd-MODULE := ulogd
-ulogd-SPEC := ulogd/ulogd.spec
-ALL += ulogd
-
-ulogd: proper
-
-#
-# netflow
-#
-
-netflow-MODULE := netflow
-netflow-SPEC := netflow/netflow.spec
-ALL += netflow
-
-#
-# Request Tracker 3
-#
-
-rt3-MODULE := rt3
-rt3-SPEC := rt3/etc/rt.spec
-ALL += rt3
-
-#
-# Mail::SpamAssassin
-#
-
-spamassassin-MODULE := spamassassin
-spamassassin-SPEC := spamassassin/spamassassin.spec
-ALL += spamassassin
-
-#
-# TWiki
-#
-
-twiki-MODULE := twiki
-twiki-SPEC := twiki/TWiki.spec
-ALL += twiki
-
-#
-# plcapilib
-#
-
-plcapilib-MODULE := plcmdline
-plcapilib-SPEC := plcmdline/plcapilib.spec
-ALL += plcapilib
-
-#
-# Installation rules
-#
-
-# Put packages in boot repository
-ARCHIVE := /var/www/html/archive
-
-# Put nightly alpha builds in a subdirectory
-ifeq ($(TAG),HEAD)
-ARCHIVE := $(ARCHIVE)/plc-alpha
-REPOS := /var/www/html/plc-alpha
-endif
-
-install:
-ifeq ($(BASE),)
- @echo make install is only meant to be called from ./build.sh
-else
-ifneq ($(BUILDS),)
- # Remove old runs
- cd $(ARCHIVE) && ls -t | sed -n $(BUILDS)~1p | xargs rm -rf
-endif
- install -D -m 644 groups/stock_fc2_groups.xml RPMS/yumgroups.xml
- # Populate repository
- mkdir -p $(ARCHIVE)/$(BASE)
- rsync --delete --links --perms --times --group \
- $(sort $(subst -debuginfo,,$(wildcard RPMS/yumgroups.xml RPMS/*/*))) $(ARCHIVE)/$(BASE)/
- yum-arch $(ARCHIVE)/$(BASE) >/dev/null
- createrepo $(ARCHIVE)/$(BASE) >/dev/null
-ifeq ($(TAG),HEAD)
- ln -nsf $(ARCHIVE)/$(BASE) $(REPOS)
-endif
-endif
-
-.PHONY: install
--- /dev/null
+/*
+ * Parses RPM spec file into Makefile fragment. See
+ *
+ * http://fedora.redhat.com/docs/drafts/rpm-guide-en/ch-programming-c.html
+ *
+ * Mark Huang <mlhuang@cs.princeton.edu>
+ * Copyright (C) 2006 The Trustees of Princeton University
+ *
+ * $Id: spec2make.c 968 2007-11-07 16:15:55Z thierry $
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libgen.h>
+#include <errno.h>
+#include <rpm/rpmlib.h>
+#include <rpm/rpmts.h>
+#include <rpm/rpmcli.h>
+#include <rpm/rpmbuild.h>
+#include <rpm/rpmspec.h>
+
+extern size_t strnlen(const char *s, size_t maxlen);
+
+/* the structure describing the options we take and the defaults */
+static struct poptOption optionsTable[] = {
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
+ "Common options for all rpm modes and executables:",
+ NULL },
+
+ POPT_AUTOALIAS
+ POPT_AUTOHELP
+ POPT_TABLEEND
+};
+
+/* Stolen from rpm/build/spec.c:rpmspecQuery() */
+Spec
+rpmspecGet(rpmts ts, const char * arg)
+{
+ char * buildRoot = NULL;
+ int recursing = 0;
+ char * passPhrase = "";
+ char *cookie = NULL;
+ int anyarch = 1;
+ int force = 1;
+
+ if (parseSpec(ts, arg, "/", buildRoot, recursing, passPhrase,
+ cookie, anyarch, force)) {
+ fprintf(stderr, "query of specfile %s failed, can't parse\n", arg);
+ return NULL;
+ }
+
+ return rpmtsSpec(ts);
+}
+
+int
+main(int argc, char *argv[])
+{
+ poptContext context;
+ rpmts ts = NULL;
+ int ec = 0;
+ Spec spec;
+ struct Source *source;
+ Package pkg;
+ const char *name, *version, *release, *arch, *unused;
+ const char *package_name;
+
+ /* BEGIN: support to pull out --target from the args list */
+ int alen, i;
+ char *target = NULL;
+ int args = 1;
+ int tlen = strlen("--target");
+
+
+ /* walk argv list looking for --target */
+ while ((args+1)<argc) {
+ if(strncmp(argv[args],"--target",tlen)==0){
+ char **dash;
+
+ /* get arch component of the --target option */
+ dash = (char**)strchr(argv[args+1],'-');
+ if (dash != NULL) *dash=NULL;
+
+ /* copy arch component of --target option to target */
+ alen = strnlen(argv[args+1],32);
+ target = (char*)malloc(alen+1);
+ if (target == NULL) return errno;
+ strncpy(target,argv[args+1],alen);
+ target[alen]='\0';
+
+ /* change argc, argv to take out the "--target xxx" */
+ for (i=args;i<argc;i++) argv[i]=argv[i+2];
+ argc-=2;
+
+ break;
+ }
+ args++;
+ }
+ argv[1]=argv[argc-2];
+ argv[2]=argv[argc-1];
+ argv[3]=0;
+ argc=3;
+ /* END: support to pull out --target from the args list */
+
+ /* Parse common options for all rpm modes and executables */
+ context = rpmcliInit(argc, argv, optionsTable);
+
+ /* Create transaction state */
+ ts = rpmtsCreate();
+
+ /* Parse spec file. The rpmcli functions don't allow you to
+ * access the Spec structure directly, so we call our own
+ * version of rpmSpecQuery() directly. */
+ spec = rpmspecGet(ts, argv[1]);
+ package_name = argv[2];
+ if (!spec) {
+ ec = 1;
+ goto done;
+ }
+
+ /* Print sources */
+ for (source = spec->sources; source; source = source->next) {
+ char fullSource[PATH_MAX];
+
+ strncpy(fullSource, source->fullSource, sizeof(fullSource));
+ printf("%s-TARBALL += SOURCES/%s\n", package_name, basename(fullSource));
+ /* computes the SOURCEDIR variable by removing .tar.gz or .tar.bz2 */
+ {
+ char *suffixes[] = {".tar.gz",".tgz",".tar.bz2", NULL};
+ char **suffix;
+ char *suffix_index;
+
+ for (suffix=suffixes ; *suffix ; suffix++) {
+ printf("# trying %s\n",*suffix);
+ suffix_index=strstr(fullSource,*suffix);
+ if (suffix_index) {
+ char sourcename[PATH_MAX];
+ strncpy(sourcename,fullSource,suffix_index-fullSource);
+ *suffix_index='\0';
+ printf ("%s-SOURCE := SOURCES/%s\n",package_name,basename(sourcename));
+ printf ("%s-CODEBASE := CODEBASES/%s\n",package_name,package_name);
+ break;
+ }
+ }
+ }
+
+ }
+
+ /* Get SRPM name from name of first package */
+ pkg = spec->packages;
+ name = version = release = NULL;
+ (void) headerNVR(pkg->header, &name, &version, &release);
+ if (name && version && release)
+ printf("%s-SRPM := SRPMS/%s-%s-%s.src.rpm\n",
+ package_name, name, version, release);
+
+ /* Print non-empty packages */
+ for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
+ name = version = release = arch = NULL;
+ (void) headerNEVRA(pkg->header, &name, &unused, &version, &release, &arch);
+ if (name && version && release && arch) {
+ if (!pkg->fileList)
+ printf("# Empty\n# ");
+
+ if (target != NULL) {
+ if (strcmp(arch,target)!=0) {
+ arch=target;
+ }
+ }
+ printf("%s-RPM += RPMS/%s/%s-%s-%s.%s.rpm\n",
+ package_name, arch, name, version, release, arch);
+ }
+ }
+
+ /* export some macros to make */
+ {
+ char *macros[] = { "release" , "name" , "version" , "subversion" , NULL } ;
+ char **nav;
+ char *macro=malloc(32);
+ for (nav=macros; *nav; nav++) {
+ sprintf(macro,"%%{%s}",*nav);
+ char *value = rpmExpand(macro,NULL);
+ printf ("%s-rpm-%s := %s\n",package_name,*nav,value);
+ }
+ }
+
+ spec = freeSpec(spec);
+
+ done:
+ ts = rpmtsFree(ts);
+ context = rpmcliFini(context);
+ return ec;
+}
--- /dev/null
+#!/bin/bash
+# this can help you create/update your fedora mirror
+
+COMMAND=$(basename $0)
+
+dry_run=
+root=/data/fedora/linux
+rsyncurl=rsync://fr.rpmfind.net/linux/fedora
+fcdistro=fc6
+arch=i386
+
+
+function usage () {
+ echo "Usage: $COMMAND [-n] [-v] [-r root] [-u rsyncurl] [-f fcdistro] [-a arch]"
+ echo "Defaults to -r $root -u $rsyncurl -f $fcdistro -a $arch"
+ echo "Use vserver conventions for fcdistro, e.g. fc6 and f7"
+ exit 1
+}
+
+while getopts "nvr:u:f:a:h" opt ; do
+ case $opt in
+ n) dry_run=-n ;;
+ v) set -x ;;
+ r) root=$OPTARG ;;
+ u) rsyncurl=$OPTARG ;;
+ f) fcdistro=$OPTARG ;;
+ a) arch=$OPTARG ;;
+ h|*) usage ;;
+ esac
+done
+
+case $fcdistro in
+ fc*[1-6])
+ findex=$(echo $fcdistro | sed -e s,fc,,g)
+ ;;
+ *)
+ findex=$(echo $fcdistro | sed -e s,f,,g)
+ ;;
+esac
+
+echo "root=$root"
+echo rsyncurl="$rsyncurl"
+echo "fcdistro=$fcdistro"
+echo "findex=$findex"
+echo "arch=$arch"
+
+case $findex in
+ 2|4|6)
+ echo "============================== $findex core"
+ mkdir -p ${root}/core/$findex/$arch/os/
+ rsync $dry_run -avz --exclude debug/ ${rsyncurl}/core/$findex/$arch/os/ ${root}/core/$findex/$arch/os/
+ echo "============================== $findex updates"
+ mkdir -p ${root}/core/updates/$findex/$arch/
+ rsync $dry_run -avz --exclude debug/ ${rsyncurl}/core/updates/$findex/$arch/ ${root}/core/updates/$findex/$arch/
+ echo "============================== $findex extras"
+ mkdir -p ${root}/extras/$findex/$arch/
+ rsync $dry_run -avz --exclude debug/ ${rsyncurl}/extras/$findex/$arch/ ${root}/extras/$findex/$arch/
+ ;;
+ 7)
+ echo "============================== $findex core"
+ mkdir -p ${root}/core/$findex/$arch/os/
+ rsync $dry_run -avz --exclude debug/ ${rsyncurl}/core/$findex/Everything/$arch/os/ ${root}/core/$findex/$arch/os/
+ echo "============================== $findex updates"
+ mkdir -p ${root}/core/updates/$findex/$arch/
+ rsync $dry_run -avz --exclude debug/ ${rsyncurl}/core/updates/$findex/$arch/ ${root}/core/updates/$findex/$arch/
+ ;;
+ 8)
+ # somehow the layout on my favorite mirror is different in 7 and 8, /Everything/ has gone
+ echo "============================== $findex core"
+ mkdir -p ${root}/core/$findex/$arch/os/
+ rsync $dry_run -avz --exclude debug/ ${rsyncurl}/core/$findex/$arch/os/ ${root}/core/$findex/$arch/os/
+ echo "============================== $findex updates"
+ mkdir -p ${root}/core/updates/$findex/$arch/
+ rsync $dry_run -avz --exclude debug/ ${rsyncurl}/core/updates/$findex/$arch/ ${root}/core/updates/$findex/$arch/
+ ;;
+ *)
+ echo "Unknown fedora index $findex - exiting"
+ exit 1
+ ;;
+esac
--- /dev/null
+#!/bin/bash
+# -*-shell-*-
+
+COMMAND=$(basename $0)
+
+function failure () {
+ echo "$COMMAND : Bailing out"
+ exit 1
+}
+
+# overwrite vserver's internal yum config from what is in
+# .distributions/<distrib>/yum/yum.conf and /yum.repos.d
+# note : on fc6 I've had trouble with yum.conf, I haven't created a custom yum.conf
+# when using the default yum.conf,
+# vserver build -m yum complained that /vservers/<v>/var/log/yum.log could not be created
+
+function configure_yum_in_vserver () {
+ set -x
+ set -e
+ trap failure ERR INT
+
+ vserver=$1; shift
+ fcdistro=$1; shift
+
+ cd /etc/vservers/.distributions/${fcdistro}
+ if [ -f yum/yum.conf ] ; then
+ echo "Initializing yum.conf in $vserver from $(pwd)/yum"
+ cp yum/yum.conf /vservers/$vserver/etc/yum.conf
+ else
+ echo "Cannot initialize yum.conf in $vserver - using $fcdistro default"
+ fi
+
+ if [ -d yum.repos.d ] ; then
+ echo "Initializing yum.repos.d in $vserver from $(pwd)/yum.repos.d"
+ rm -rf /vservers/$vserver/etc/yum.repos.d
+ tar cf - yum.repos.d | tar -C /vservers/$vserver/etc -xvf -
+ else
+ echo "Cannot initialize yum.repos.d in $vserver"
+ fi
+ cd -
+}
+
+function setup_vserver () {
+
+ set -x
+ set -e
+ trap failure ERR INT
+
+ vserver=$1; shift
+ fcdistro=$1; shift
+ personality=$1; shift
+
+ # create the new vserver
+ [ ! -d /etc/vservers/$vserver ] && $personality vserver $VERBOSE $vserver build -m yum -- -d $fcdistro
+
+ if [ ! -z "$personality" ] ; then
+ l32=$(grep $personality /etc/vservers/$vserver/personality | wc -l)
+ [ $l32 -eq 0 ] && echo $personality >> /etc/vservers/$vserver/personality
+ fi
+
+ # set up appropriate vserver capabilities to mount, mknod and IPC_LOCK
+ BCAPFILE=/etc/vservers/$vserver/bcapabilities
+ touch $BCAPFILE
+ cap=$(grep ^CAP_SYS_ADMIN /etc/vservers/$vserver/bcapabilities | wc -l)
+ [ $cap -eq 0 ] && echo 'CAP_SYS_ADMIN' >> /etc/vservers/$vserver/bcapabilities
+ cap=$(grep ^CAP_MKNOD /etc/vservers/$vserver/bcapabilities | wc -l)
+ [ $cap -eq 0 ] && echo 'CAP_MKNOD' >> /etc/vservers/$vserver/bcapabilities
+ cap=$(grep ^CAP_IPC_LOCK /etc/vservers/$vserver/bcapabilities | wc -l)
+ [ $cap -eq 0 ] && echo 'CAP_IPC_LOCK' >> /etc/vservers/$vserver/bcapabilities
+
+ # start the vserver so we can do the following operations
+ $personality vyum $vserver -- -y install yum
+ $personality vserver $VERBOSE $vserver pkgmgmt internalize
+ $personality vserver $VERBOSE $vserver start
+ $personality vserver $VERBOSE $vserver exec rm -f /var/lib/rpm/__db*
+ $personality vserver $VERBOSE $vserver exec rpm --rebuilddb
+
+ configure_yum_in_vserver $vserver $fcdistro
+
+ # set up resolv.conf
+ cp /etc/resolv.conf /vservers/$vserver/etc/resolv.conf
+
+}
+
+function devel_tools () {
+
+ set -x
+ set -e
+ trap failure ERR INT
+
+ vserver=$1; shift
+ fcdistro=$1; shift
+ pldistro=$1; shift
+ personality=$1; shift
+
+ # check for .lst file based on pldistro
+ lst=${pldistro}-${fcdistro}-devel.lst
+ if [ -f $lst ] ; then
+ echo "$COMMAND: Using $lst"
+ else
+ echo "$COMMAND : Cannot locate $lst - exiting"
+ usage
+ fi
+
+ # install individual packages, then groups
+ packages=$(grep "^package:" $lst | sed -e s,package:,,)
+ groups=$(grep "^group:" $lst | sed -e s,group:,,)
+
+ [ -n "$packages" ] && $personality vserver $vserver exec yum -y install $packages
+ [ -n "$groups" ] && $personality vserver $vserver exec yum -y groupinstall $groups
+ return 0
+}
+
+function post_install () {
+
+ set -x
+ set -e
+ trap failure ERR INT
+
+ vserver=$1; shift
+ personality=$1; shift
+
+### From myplc-devel-native.spec
+# be careful to backslash $ in this, otherwise it's the root context that's going to do the evaluation
+ cat << EOF | $personality vserver $VERBOSE $vserver exec bash -x
+ # set up /dev/loop* in vserver
+ for i in \$(seq 0 7) ; do
+ mknod -m 640 /dev/loop\$i b 7 \$i
+ done
+
+ # create symlink for /dev/fd
+ ln -fs /proc/self/fd /dev/fd
+
+ # modify /etc/rpm/macros to not use /sbin/new-kernel-pkg
+ sed -i 's,/sbin/new-kernel-pkg:,,' /etc/rpm/macros
+ if [ -h "/sbin/new-kernel-pkg" ] ; then
+ filename=\$(readlink -f /sbin/new-kernel-pkg)
+ if [ "\$filename" == "/sbin/true" ] ; then
+ echo "WARNING: /sbin/new-kernel-pkg symlinked to /sbin/true"
+ echo "\tmost likely /etc/rpm/macros has /sbin/new-kernel-pkg declared in _netsharedpath."
+ echo "\tPlease remove /sbin/new-kernel-pkg from _netsharedpath and reintall mkinitrd."
+ exit 1
+ fi
+ fi
+
+ uid=2000
+ gid=2000
+
+ # add a "build" user to the system
+ builduser=\$(grep "^build:" /etc/passwd | wc -l)
+ if [ \$builduser -eq 0 ] ; then
+ groupadd -o -g \$gid build;
+ useradd -o -c 'Automated Build' -u \$uid -g \$gid -n -M -s /bin/bash build;
+ fi
+
+# Allow build user to build certain RPMs as root
+ if [ -f /etc/sudoers ] ; then
+ buildsudo=\$(grep "^build.*ALL=(ALL).*NOPASSWD:.*ALL" /etc/sudoers | wc -l)
+ if [ \$buildsudo -eq 0 ] ; then
+ echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
+ fi
+ sed -i 's,^Defaults.*requiretty,#Defaults requiretty,' /etc/sudoers
+ fi
+#
+EOF
+
+}
+
+function usage () {
+ set +x
+ echo "Usage: $COMMAND [-s] [-p] [-v] vserver-name distribution pldistro [personality]"
+ echo "Requirements: you need to have a vserver-compliant kernel,"
+ echo " as well as the util-vserver RPM installed"
+ echo "Description:"
+ echo " This command creates a fresh vserver instance, with the specified name"
+ echo " The root filesystem is created from the specified distribution, e.g. fc6"
+ echo " The third argument denotes a pldistro, e.g. onelab"
+ echo " The last, optional, argument defaults to linux32"
+ echo "This is done in three steps"
+ echo " (*) setup phase : vserver creation, yum internalization and config (from /etc/vservers)"
+ echo " (*) tools install : the tools required for building are installed"
+ echo " to this end we search for a .lst file that specifies the pkgs & groups"
+ echo " assuming the above that pldistro is onelab:"
+ echo " (*) we first check for onelab-devel-fc6.lst"
+ echo " (*) and then for onelab-devel.lst"
+ echo " (*) post-install : create a build user, + various tunings required"
+ echo "Options:"
+ echo " -s : skips the setup phase"
+ echo " -t : skips the tools phase"
+ echo " -p : skips the post-install"
+ echo " -v : passes -v to calls to vserver"
+ exit 1
+}
+
+### parse args and
+function main () {
+
+ set -e
+ trap failure ERR INT
+
+ DO_SETUP=true
+ DO_TOOLS=true
+ DO_POST=true
+ VERBOSE=
+ while getopts "stpvh" opt ; do
+ case $opt in
+ s) DO_SETUP="" ;;
+ t) DO_TOOLS="" ;;
+ p) DO_POST="" ;;
+ v) VERBOSE="-v" ;;
+ h|*) usage ;;
+ esac
+ done
+
+ shift $(($OPTIND - 1))
+
+ [[ -z "$@" ]] && usage
+ vserver=$1 ; shift
+ [[ -z "$@" ]] && usage
+ fcdistro=$1 ; shift
+ [[ -z "$@" ]] && usage
+ pldistro=$1 ; shift
+ if [[ -z "$@" ]] ; then
+ personality=linux32
+ else
+ personality=$1; shift
+ fi
+ [[ -n "$@" ]] && usage
+
+ [ -n "$DO_SETUP" ] && setup_vserver $vserver $fcdistro $personality
+ [ -n "$DO_TOOLS" ] && devel_tools $vserver $fcdistro $pldistro $personality
+ [ -n "$DO_POST" ] && post_install $vserver $personality
+
+}
+
+main "$@"
--- /dev/null
+#!/bin/bash
+REVISION=$(echo '$Revision: 1099 $' | sed -e 's,\$,,g' -e 's,^\w*:\s,,' )
+
+COMMANDPATH=$0
+COMMAND=$(basename $0)
+
+# default values, tunable with command-line options
+DEFAULT_FCDISTRO=fc6
+DEFAULT_PLDISTRO=planetlab
+DEFAULT_BASE="@DATE@--@PLDISTRO@-@FCDISTRO@"
+DEFAULT_SVNPATH="http://svn.planet-lab.org/svn/build/trunk"
+
+DEFAULT_MAILTO_onelab="onelab-build@one-lab.org"
+# tmp - send all mails to onelab
+#DEFAULT_MAILTO_planetlab="devel@planet-lab.org"
+DEFAULT_MAILTO_planetlab=$DEFAULT_MAILTO_onelab
+
+# web publishing results
+DEFAULT_WEBPATH="/build/@PLDISTRO@/@BASE@"
+
+# for the test part
+TESTBUILDURL="http://build.one-lab.org/"
+TESTBOX=onelab-test.inria.fr
+TESTBOXSSH=root@onelab-test.inria.fr
+TESTSVNPATH="http://svn.one-lab.org/new_plc_api/trunk/plctest"
+TESTSCRIPT=TestMain.py
+####################
+# assuming vserver runs in UTC
+DATE=$(date -u +'%Y.%m.%d')
+
+# Notify recipient of failure or success, manage various stamps
+function failure() {
+ set -x
+ if [ -n "$MAILTO" ] ; then
+ tail -c 8k $LOG | mail -s "Failures for build ${BASE}" $MAILTO
+ fi
+ cp $LOG ${WEBPATH}.log.txt
+ (echo -n "============================== $COMMAND: failure at" ; date ; tail -c 20k $LOG) > ${WEBPATH}.broken.txt
+ exit 1
+}
+
+function success () {
+ set -x
+ if [ -n "$MAILTO" ] ; then
+ (echo "http://build.one-lab.org/$PLDISTRO/$BASE" ; echo "Completed on $(date)" ) | mail -s "Successfull build for ${BASE}" $MAILTO
+ fi
+ cp $LOG ${WEBPATH}.log.txt
+ touch ${WEBPATH}.ok.txt
+ exit 0
+}
+
+# run in the vserver - do not manage success/failure, will be done from the root ctx
+function build () {
+ set -x
+ set -e
+
+ echo -n "============================== Starting $COMMAND:build on "
+ date
+
+ cd /
+
+ # if TAGSRELEASE specified : update PLDISTROTAGS with this tag
+ if [ -n "$TAGSRELEASE" ] ; then
+ cd build
+ svn up -r $TAGSRELEASE $PLDISTROTAGS
+ cd -
+ fi
+
+ show_env
+
+ echo "Running make IN $(pwd)"
+ make stage1=true "${MAKEOPTS[@]}" PLDISTROTAGS=${PLDISTROTAGS} PLDISTRO=${PLDISTRO} "${MAKEVARS[@]}" -C /build
+ # in case we use an older build that does not know about versions
+ set +e
+ make "${MAKEOPTS[@]}" PLDISTROTAGS=${PLDISTROTAGS} PLDISTRO=${PLDISTRO} "${MAKEVARS[@]}" -C /build versions
+ set -e
+ make "${MAKEOPTS[@]}" PLDISTROTAGS=${PLDISTROTAGS} PLDISTRO=${PLDISTRO} "${MAKEVARS[@]}" -C /build $MAKETARGETS
+
+}
+
+# this was formerly run in the myplc-devel chroot but now is run in the root context,
+# this is so that the .ssh config gets done manually, and once and for all
+function runtest () {
+ set -x
+ set -e
+
+ echo -n "============================== Starting $COMMAND:runtest on $(date)"
+ here=$(pwd)
+
+ ### the URL to the myplc package
+ cd /vservers/$BASE/build/RPMS/i386
+ rpm=$(ls myplc-[0-9]*.rpm)
+ if [ ${#rpm[@]} != 1 ] ; then
+ echo "$COMMAND: Cannot locate rpm for testing"
+ exit 1
+ fi
+ url=${TESTBUILDURL}${PLDISTRO}/${BASE}/RPMS/i386/${rpm}
+
+ # find the place where the plctest material was checked out
+ cd /vservers/$BASE/build/CODEBASES/PLCAPI
+ if [ ! -d plctest/ ] ; then
+ echo "$COMMAND : Cannot not locate plctest/ - exiting"
+ exit 1
+ fi
+ # compute test directory name on test box
+ testdir=plctest-${BASE}
+ # rsync/push test material onto the test box
+ ssh ${TESTBOXSSH} mkdir -p ${testdir}
+ rsync -a -v plctest/ ${TESTBOXSSH}:${testdir}
+ # invoke test on testbox
+ ssh ${TESTBOXSSH} python -u ${testdir}/${TESTSCRIPT} ${url}
+ #invoke make install from build to the testbox
+ # looks suspicious : we'd need this *during* myplc run, not at the end
+ # in addition we are not in the vserver here so running make can have weird effects
+ # make install PLCHOST=${TESTBOX}
+
+ if [ "$?" != 0 ] ; then
+ failure
+ fi
+
+ cd $here
+ echo -n "============================== End $COMMAND:runtest on $(date)"
+}
+
+function show_env () {
+ set +x
+ echo FCDISTRO=$FCDISTRO
+ echo PLDISTRO=$PLDISTRO
+ echo BASE=$BASE
+ echo SVNPATH=$SVNPATH
+ echo MAKEVARS="${MAKEVARS[@]}"
+ echo MAKEOPTS="${MAKEOPTS[@]}"
+ echo PLDISTROTAGS="$PLDISTROTAGS"
+ echo TAGSRELEASE="$TAGSRELEASE"
+ echo WEBPATH="$WEBPATH"
+ if [ -d /vservers ] ; then
+ echo PLDISTROTAGS="$PLDISTROTAGS"
+ else
+ echo "XXXXXXXXXXXXXXXXXXXX Contents of tags definition file /build/$PLDISTROTAGS"
+ cat /build/$PLDISTROTAGS
+ echo "XXXXXXXXXXXXXXXXXXXX end tags definition"
+ fi
+ set -x
+}
+
+function usage () {
+ echo "Usage: $COMMAND [option] make-targets"
+ echo "This is $REVISION"
+ echo "Supported options"
+ echo " -n dry-run : -n passed to make - vserver gets created though - no mail sent"
+ echo " -f FCDISTRO - defaults to $DEFAULT_FCDISTRO"
+ echo " -d PLDISTRO - defaults to $DEFAULT_PLDISTRO"
+ echo " -b BASE - defaults to $DEFAULT_BASE"
+ echo " @NAME@ replaced as appropriate"
+ echo " -t PLDISTROTAGS - defaults to \${PLDISTRO}-tags.mk"
+ echo " -r TAGSRELEASE - a release number that refers to PLDISTROTAGS - defaults to HEAD"
+ echo " -s SVNPATH - where to fetch the build module"
+ echo " -o : overwrite - re-run in base directory, do not create vserver"
+ echo " -m MAILTO"
+ echo " -a MAKEVAR=value - space in values are not supported"
+ echo " -w WEBPATH - defaults to $DEFAULT_WEBPATH"
+ echo " -B : run build only"
+ echo " -T : run test only"
+ echo " -v : be verbose"
+ exit 1
+}
+
+function main () {
+
+ set -e
+
+ # preserve arguments for passing them again later
+ declare -a argv
+ for arg in "$@"; do argv=(${argv[@]} "$arg") ; done
+
+ # parse arguments
+ MAKEVARS=()
+ MAKEOPTS=()
+ DO_BUILD=true
+ DO_TEST=true
+ while getopts "nf:d:b:t:r:s:om:a:w:BTvh" opt ; do
+ case $opt in
+ n) DRY_RUN="true" ; MAKEOPTS=(${MAKEOPTS[@]} -n) ;;
+ f) FCDISTRO=$OPTARG ;;
+ d) PLDISTRO=$OPTARG ;;
+ b) BASE=$OPTARG ;;
+ t) PLDISTROTAGS=$OPTARG ;;
+ r) TAGSRELEASE=$OPTARG ;;
+ s) SVNPATH=$OPTARG ;;
+ o) USEOLD=true ;;
+ m) MAILTO=$OPTARG ;;
+ a) MAKEVARS=(${MAKEVARS[@]} "$OPTARG") ;;
+ w) WEBPATH=$OPTARG ;;
+ B) DO_TEST= ;;
+ T) DO_BUILD= ; USEOLD=true ;;
+ v) set -x ;;
+ h|*) usage ;;
+ esac
+ done
+
+ shift $(($OPTIND - 1))
+ MAKETARGETS="$@"
+
+ # set defaults
+ [ -z "$FCDISTRO" ] && FCDISTRO=$DEFAULT_FCDISTRO
+ [ -z "$PLDISTRO" ] && PLDISTRO=$DEFAULT_PLDISTRO
+ [ -z "$PLDISTROTAGS" ] && PLDISTROTAGS="${PLDISTRO}-tags.mk"
+ [ -z "$BASE" ] && BASE="$DEFAULT_BASE"
+ [ -z "$WEBPATH" ] && WEBPATH="$DEFAULT_WEBPATH"
+ [ -z "$SVNPATH" ] && SVNPATH="$DEFAULT_SVNPATH"
+ #
+ if [ "$PLDISTRO" = "onelab" ] ; then
+ [ -z "$MAILTO" ] && MAILTO="$DEFAULT_MAILTO_onelab"
+ else
+ [ -z "$MAILTO" ] && MAILTO="$DEFAULT_MAILTO_planetlab"
+ fi
+ [ -n "$DRY_RUN" ] && MAILTO=""
+
+ ### set BASE from DISTRO, if unspecified
+ sedargs="-e s,@DATE@,${DATE},g -e s,@FCDISTRO@,${FCDISTRO},g -e s,@PLDISTRO@,${PLDISTRO},g"
+ BASE=$(echo ${BASE} | sed $sedargs)
+ WEBPATH=$(echo ${WEBPATH} | sed $sedargs -e s,@BASE@,"$BASE",g)
+
+ if [ ! -d /vservers ] ; then
+ # in the vserver
+ echo "==================== Within vserver BEG $(date)"
+ build
+ echo "==================== Within vserver END $(date)"
+
+ else
+ trap failure ERR INT
+ # we run in the root context :
+ # (*) create or check for the vserver to use
+ # (*) copy this command in the vserver
+ # (*) invoke it
+
+ if [ -n "$USEOLD" ] ; then
+ ### Re-use a vserver (finish an unfinished build..)
+ if [ ! -d /vservers/${BASE} ] ; then
+ echo $COMMAND : cannot find vserver $BASE
+ exit 1
+ fi
+ # manage LOG - beware it might be a symlink so nuke it first
+ LOG=/vservers/${BASE}.txt
+ rm -f $LOG
+ exec > $LOG 2>&1
+ set -x
+ echo "XXXXXXXXXX $COMMAND: using existing vserver $BASE" $(date)
+ show_env
+ # update build
+ vserver ${BASE} exec svn update /build
+ else
+ # create vserver: check it does not exist yet
+ i=
+ while [ -d /vservers/${BASE}${i} ] ; do
+ # we name subsequent builds <base>-n<i> so the logs and builds get sorted properly
+ [ -z ${i} ] && BASE=${BASE}-n
+ i=$((${i}+1))
+ if [ $i -gt 100 ] ; then
+ echo "$COMMAND: Failed to create build vserver /vservers/${BASE}${i}"
+ exit 1
+ fi
+ done
+ BASE=${BASE}${i}
+ # need update
+ WEBPATH=$(echo ${WEBPATH} | sed $sedargs -e s,@BASE@,"$BASE",g)
+ # manage LOG - beware it might be a symlink so nuke it first
+ LOG=/vservers/${BASE}.txt
+ rm -f $LOG
+ exec > $LOG 2>&1
+ set -x
+ echo "XXXXXXXXXX $COMMAND: creating vserver $BASE" $(date)
+ show_env
+
+ ### extract vbuild-init-vserver.sh and run it
+ svn cat $SVNPATH/vbuild-init-vserver.sh > /tmp/vbuild-init-vserver-$$.sh
+ # get .lst
+ lst=${PLDISTRO}-${FCDISTRO}-devel.lst
+ svn cat $SVNPATH/$lst > /tmp/$lst
+
+ # Create vserver
+ cd /tmp
+ chmod +x vbuild-init-vserver-$$.sh
+ /tmp/vbuild-init-vserver-$$.sh ${BASE} ${FCDISTRO} ${PLDISTRO}
+ # cleanup
+ rm -f /tmp/vbuild-init-vserver-$$.sh /tmp/$lst
+ cd -
+ # Extract build
+ vserver ${BASE} exec svn checkout ${SVNPATH} /build
+ fi
+ echo "XXXXXXXXXX $COMMAND: preparation of vserver $BASE done" $(date)
+
+ # The log inside the vserver contains everything
+ LOG2=/vservers/${BASE}/log.txt
+ (echo "==================== Transcript of vserver creation -- BEG $(date)" ; \
+ cat $LOG ; \
+ echo "==================== Transcript of vserver creation -- END $(date)" ; \
+ echo "xxxxxxxxxx Messing with logs, symlinking $LOG2 to $LOG" ) >> $LOG2
+ ### not too nice : nuke the former log, symlink it to the new one
+ rm $LOG; ln -s $LOG2 $LOG
+ LOG=$LOG2
+ # redirect log again
+ exec >> $LOG 2>&1
+
+ if [ -n "$DO_BUILD" ] ; then
+
+ cp $COMMANDPATH /vservers/${BASE}/build/
+
+ # invoke this command in the vserver for building (-T)
+ vserver ${BASE} exec /build/$COMMAND "${argv[@]}" -b "${BASE}"
+ fi
+
+ # publish to the web so runtest can find them
+ rm -rf $WEBPATH ; mkdir -p $WEBPATH
+ tar -C /vservers/$BASE/build -cf - RPMS SRPMS | tar -C $WEBPATH -xf -
+
+ set +e
+ if [ -n "$DO_TEST" ] ; then
+ runtest
+ fi
+
+ success
+
+ fi
+
+}
+
+##########
+main "$@"