fix for remote pldistros
[build.git] / Makefile
index 6afcdd5..b936a4a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -94,7 +94,7 @@
 ####################
 
 # exported to spec files as plrelease
-PLANETLAB_RELEASE = 5.0
+PLANETLAB_RELEASE = 4.3
 
 #
 # Default values
@@ -109,6 +109,9 @@ RPM-INSTALL-DEVEL := rpm --force -Uvh
 # need to ignore result, kernel-headers cannot be uninstalled as glibc depends on it
 RPM-UNINSTALL-DEVEL := rpm -e
 
+# see also below
+REMOTE-PLDISTROS="wextoolbox"
+
 #################### Makefile
 # Default target
 all:
@@ -119,9 +122,15 @@ PLDISTRO := planetlab
 RPMBUILD := rpmbuild
 export CVS_RSH := ssh
 
-########## pldistro.mk holds PLDISTRO - it is generated at stage1 (see below)
+########## savedpldistro.mk holds PLDISTRO - it is generated at stage1 (see below)
 ifeq "$(stage1)" ""
-include pldistro.mk
+include savedpldistro.mk
+endif
+
+# when re-running the nightly build after failure, we need to gather the former values
+# do this by running make stage1=skip +PLDISTRO
+ifeq "$(stage1)" "skip"
+include savedpldistro.mk
 endif
 
 #################### include onelab.mk
@@ -148,6 +157,31 @@ endif
 # use default if necessary
 build-SVNPATH ?= $(default-build-SVNPATH)
 
+####################
+define remote_pldistro
+$(1).mk: config.$(1)/$(1).mk
+       @echo 'creating $(1) from config subdir'
+       cp config.$(1)/$(1).mk $(1).mk
+
+$(2).mk: config.$(1)/$(2).mk
+       @echo 'creating $(1) tags from config subdir'
+       cp config.$(1)/$(2).mk $(2).mk
+
+config.$(1)/$(1).mk: config.$(1)
+config.$(1)/$(2).mk: config.$(1)
+
+config.$(1): config.$(1).svnpath
+       @echo "Fetching details for pldistro $(1)"
+       svn export $(shell grep -v "^#" config.$(1).svnpath) config.$(1)
+
+DISTCLEANS += $(1).mk $(2).mk config.$(1)
+
+endef
+
+# somehow this does not work, handle manually instead
+#$(foreach distro, $(REMOTE-PLDISTROS), $(eval $(call remote_pldistro,$(distro),$(distro)-tags)))
+$(eval $(call remote_pldistro,wextoolbox,wextoolbox-tags))
+
 ########## stage1 and stage1iter
 # extract specs and compute .mk files by running 
 # make stage1=true
@@ -299,6 +333,7 @@ endif
        rm -f $@ 
        echo "%_topdir $(HOME)" >> $@
        echo "%_tmppath $(HOME)/tmp" >> $@
+       echo "%__spec_install_pre %{___build_pre}" >> $@
        ./getrpmmacros.sh >> $@
 
 ### this utility allows to extract various info from a spec file
@@ -318,19 +353,22 @@ $(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:
+savedpldistro.mk:
        echo "PLDISTRO:=$(PLDISTRO)" > $@
        echo "PLDISTROTAGS:=$(PLDISTROTAGS)" >> $@
        echo "build-SVNPATH:=$(build-SVNPATH)" >> $@
        echo "PERSONALITY:=$(PERSONALITY)" >> $@
        echo "MAILTO:=$(MAILTO)" >> $@
        echo "BASE:=$(BASE)" >> $@
+       echo "WEBPATH:=$(WEBPATH)" >> $@
+       echo "TESTBUILDURL:=$(TESTBUILDURL)" >> $@
+       echo "WEBROOT:=$(WEBROOT)" >> $@
 
-savepldistro: pldistro.mk
-.PHONY: savepldistro
+savedpldistro: savedpldistro.mk
+.PHONY: savedpldistro
 
 # always refresh this
-all: savepldistro
+all: savedpldistro
 
 #################### regular make
 
@@ -586,7 +624,7 @@ clean-help:
 
 ### brute force clean
 distclean1:
-       rm -rf pldistro.mk .rpmmacros spec2make header.spec SPECS MAKE 
+       rm -rf savedpldistro.mk .rpmmacros spec2make header.spec SPECS MAKE $(DISTCLEANS)
 distclean2:
        rm -rf CODEBASES SOURCES BUILD RPMS SRPMS tmp
 distclean: distclean1 distclean2
@@ -691,9 +729,10 @@ info: packages modules branches
 
 ####################
 tests_svnpath:
-       @$(if $(TESTS_SVNPATH), echo $(TESTS_SVNPATH) > $@, \
+       @$(if $(tests-SVNPATH), echo $(tests-SVNPATH) > $@, \
        echo "http://svn.planet-lab.org/svn/tests/trunk" > $@)
 
+
 ####################
 help:
        @echo "********** Run make in two stages:"