spec files stored in SPECS/ again - uses tmp/ for specdir when srpm->rpm as well
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 30 Nov 2007 09:12:59 +0000 (09:12 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 30 Nov 2007 09:12:59 +0000 (09:12 +0000)
Makefile

index 2441af5..5ddc8cd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -237,7 +237,7 @@ repo: RPMS/yumgroups.xml
 #
 define stage1_variables
 $(1)_spec = $(notdir $($(1)-SPEC))
-$(1)_specpath = CODESPECS/$(notdir $($(1)-SPEC))
+$(1)_specpath = SPECS/$(notdir $($(1)-SPEC))
 $(1)_module = $(firstword $($(1)-MODULES))
 endef
 
@@ -264,7 +264,7 @@ $(foreach package, $(ALL), $(eval $(call package_hasdate,$(package))))
 # cannot use variables in such rules, we need to inline everything, sigh
 define target_spec
 $($(1)_specpath):
-       mkdir -p CODESPECS
+       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)
@@ -439,16 +439,20 @@ rpms: $(ALLRPMS)
        @echo $(words $(ALLRPMS)) binary rpms OK
 .PHONY: rpms
 
+# use tmp dirs when building binary rpm so make remains idempotent 
+# otherwise SOURCES/ or SPEC gets touched again - which leads to rebuilding
+rpm_use_tmp_dirs = --define "_sourcedir $(HOME)/tmp" --define "_specdir $(HOME)/tmp"
+
 # usage: build_binary_rpm package
 # xxx hacky - invoke createrepo if DEPENDFILES mentions RPMS/yumgroups.xml
 define target_binary_rpm 
 $($(1)-RPMS): $($(1)-SRPM)
-       mkdir -p BUILD RPMS SPECS tmp
+       mkdir -p BUILD RPMS tmp
        @(echo -n "XXXXXXXXXXXXXXX -- BEG RPM $(1) " ; date)
        $(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPENDFILES)), $(createrepo) , )
        $(if $($(1)-RPMBUILD),\
-         $($(1)-RPMBUILD) $($(1)-RPMFLAGS) --rebuild --define "_sourcedir $(HOME)/tmp" $($(1)-SRPM), \
-         $(RPMBUILD)  $($(1)-RPMFLAGS) --rebuild --define "_sourcedir $(HOME)/tmp" $($(1)-SRPM))
+         $($(1)-RPMBUILD) $($(1)-RPMFLAGS) --rebuild $(rpm_use_tmp_dirs) $($(1)-SRPM), \
+         $(RPMBUILD)  $($(1)-RPMFLAGS) --rebuild $(rpm_use_tmp_dirs) $($(1)-SRPM))
        @(echo -n "XXXXXXXXXXXXXXX -- END RPM $(1) " ; date)
 endef
 
@@ -544,9 +548,9 @@ clean-help:
 
 ### brute force clean
 distclean1:
-       rm -rf pldistro.mk .rpmmacros spec2make CODESPECS MAKE 
+       rm -rf pldistro.mk .rpmmacros spec2make SPECS MAKE 
 distclean2:
-       rm -rf CODEBASES SOURCES BUILD RPMS SRPMS SPECS tmp
+       rm -rf CODEBASES SOURCES BUILD RPMS SRPMS tmp
 distclean: distclean1 distclean2
 .PHONY: distclean1 distclean2 distclean
 
@@ -592,7 +596,7 @@ help:
        @echo "Run make in two stages:"
        @echo ""
        @echo "make stage1=true PLDISTRO=onelab"
-       @echo " -> extracts all spec files in CODESPECS/ and mk files in MAKE/"
+       @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"