for dealing with the util-vserver module, specifically the scholz branch
[build.git] / Makefile
index df1c22c..04f5c47 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -97,6 +97,7 @@ PLANETLAB_RELEASE = 4.2
 HOSTARCH := $(shell uname -i)
 DISTRO := $(shell ./getdistro.sh)
 RELEASE := $(shell ./getrelease.sh)
+DISTRONAME := $(shell ./getdistroname.sh)
 RPM-INSTALL-DEVEL := rpm --force -Uvh
 # cannot force rpm -e
 RPM-UNINSTALL-DEVEL := rpm -e
@@ -207,6 +208,7 @@ define stage1_variables
 $(1).spec = $(notdir $($(1)-SPEC))
 $(1).specpath = SPECS/$(1).spec
 $(1).module = $(firstword $($(1)-MODULES))
+$(1)-SVNPATH = $(strip $($(1)-SVNPATH))
 endef
 
 $(foreach package, $(ALL), $(eval $(call stage1_variables,$(package))))
@@ -227,20 +229,26 @@ endef
 
 $(foreach package, $(ALL), $(eval $(call package_hasdate,$(package))))
 
+### the common header for generated specfiles
+# useful when trying new specfiles manually
+header.spec:
+       (echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $@
+       echo "%define distro $(DISTRO)" >> $@
+       echo "%define distrorelease $(RELEASE)" >> $@
+       echo "%define distroname $(DISTRONAME)" >> $@
+       echo "%define pldistro $(PLDISTRO)" >> $@
+       echo "%define plrelease $(PLANETLAB_RELEASE)" >> $@
+
 ### extract spec file from scm
 define target_spec
-$($(1).specpath):
+$($(1).specpath): header.spec
        mkdir -p SPECS
-       (echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $($(1).specpath)
-       echo "%define distroname $(DISTRO)" >> $($(1).specpath)
-       echo "%define distrorelease $(RELEASE)" >> $($(1).specpath)
-       echo "%define pldistro $(PLDISTRO)" >> $($(1).specpath)
-       echo "%define plrelease $(PLANETLAB_RELEASE)" >> $($(1).specpath)
+       cat header.spec > $($(1).specpath)
        $(if $($(1).has-date),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) ;))
-       echo "# included from codebase specfile" >> $($(1).specpath)
+       echo "# included from $($(1)-SPEC)" >> $($(1).specpath)
        $(if $($($(1).module)-SVNPATH),\
           svn cat $($($(1).module)-SVNPATH)/$($(1)-SPEC) >> $($(1).specpath) || rm $($(1).specpath),\
           cvs -d $($($(1).module)-CVSROOT) checkout \
@@ -585,11 +593,12 @@ version-build:
        @echo -n 'Build build-time: ' ; date '+%H:%M-%Z'
        @echo -n 'Build build-hostname: ' ; hostname
        @echo    "Build build-base: $(NIGHTLY_BASE)"
-       @echo    "Build planetab-distro: $(PLDISTRO)"
+       @echo    "Build planetlab-distro: $(PLDISTRO)"
        @echo    "Build planetlab-tags: $(PLDISTROTAGS)"
        @echo -n 'Build planetlab-tagsid: ' ; fgrep '$$''Id' $(PLDISTROTAGS)
        @echo    "Build target-arch: $(HOSTARCH)"
        @echo    "Build target-distro: $(DISTRO)"
+       @echo    "Build target-distroname: $(DISTRONAME)"
        @echo    "Build target-release: $(RELEASE)"     
        @echo    "Build target-personality: $(NIGHTLY_PERSONALITY)"