PLDISTRO := planetlab
RPMBUILD := rpmbuild
-########## savedpldistro.mk holds PLDISTRO - it is generated at stage1 (see below)
+########## envfrompreviousrun.mk holds PLDISTRO and others - it is generated at stage1 (see below)
ifeq "$(stage1)" ""
-include savedpldistro.mk
+include envfrompreviousrun.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
+include envfrompreviousrun.mk
endif
#################### include onelab.mk
# this used to be set in the -tags.mk files, but that turned out to require
# error-prone duplicate changes
# so now the nightly build script sets this to what it is currently using
-# in case we run this manually, i.e. if neither build-SVNPATH nor build-GITPATH is set
-ifeq "$(build-SVNPATH)$(build-GITPATH)" ""
-build-GITPATH-local := $(shell git config remote.origin.url)
-ifneq "$(build-GITPATH-local)" ""
-build-GITPATH := $(build-GITPATH-local)
-else
-build-SVNPATH := $(lastword $(shell svn info 2> /dev/null | grep URL:))
-endif
+# in case we run this manually, i.e. if build-GITPATH is not set
+ifeq "$(build-GITPATH)" ""
+build-GITPATH := $(shell git config remote.origin.url)
endif
#################### pldistros that are defined remotely
$(1).specpath := SPECS/$(notdir $($(1)-SPEC))
$(1).moduledir := MODULES/$$($(1).module)
$(1).codespec := MODULES/$$($(1).module)/$($(1)-SPEC)
+$(1).spec2makeflags := $(if $($(1)-WHITELIST-RPMS),--whitelist-rpms $($(1)-WHITELIST-RPMS),)
endef
$(foreach package, $(ALL), $(eval $(call stage1_package_vars,$(package))))
### the tests area
# use this makefile to extract tests rather than extracting manually in vbuild-nightly
+build-clean:
+ rm -rf MODULES/build
+.PHONY: build-clean
+
tests-clean:
rm -rf MODULES/tests
.PHONY: tests-clean
### this utility allows to extract various info from a spec file
### and to define them in makefiles
+# use the C code where it works as it's the original one, use the python code otherwise
spec2make: spec2make.c
- $(CC) -g -Wall $< -o $@ -lrpm -lrpmbuild -lrpmio -lpopt
+ $(CC) -g -Wall $< -o $@ -lrpm -lrpmbuild -lrpmio -lpopt || ln -s spec2make.py $@
### run spec2make on the spec file and include the result
# usage: spec2make package
+# with old rpms (f8&c5) and too recent specfiles (the kernel), we need a patch to spec2make
+# so when <package-NEEDSPECK2MAKEHACK is set, we run spec2make with the --hack flag
define target_mk
MAKE/$(1).mk: $($(1).specpath) spec2make .rpmmacros
mkdir -p MAKE
- ./spec2make $($(1)-RPMFLAGS) $($(1).specpath) $(1) > MAKE/$(1).mk || { rm MAKE/$(1).mk; exit 1; }
+ ./spec2make $($(1).spec2makeflags) $($(1)-RPMFLAGS) $($(1).specpath) $(1) > MAKE/$(1).mk || { rm MAKE/$(1).mk; exit 1; }
endef
$(foreach package,$(ALL),$(eval $(call target_mk,$(package))))
-# stores PLDISTRO in a file
+# stores env variables in a file
# this is done at stage1. later run wont get confused
-SAVED_VARS=PLDISTRO PLDISTROTAGS build-SVNPATH PERSONALITY MAILTO BASE WEBPATH TESTBUILDURL WEBROOT
-savedpldistro.mk:
+SAVED_VARS=PLDISTRO PLDISTROTAGS build-GITPATH PERSONALITY MAILTO BASE WEBPATH TESTBUILDURL WEBROOT
+# also remember variable settings in alias, like sfa-GITPATH=git://git.f-lab.fr/sfa.git@generic
+# but don't save stage1
+ASSIGNS=$(foreach chunk,$(MAKEFLAGS),$(if $(findstring =,$(chunk)),$(if $(findstring stage1,$(chunk)),,$(chunk)),))
+envfrompreviousrun.mk:
@echo "# do not edit" > $@
@$(foreach var,$(SAVED_VARS),echo "$(var):=$($(var))" >> $@ ;)
+ @$(foreach chunk,$(ASSIGNS),echo "override $(chunk)" | sed -e s,=,:=, >> $@;)
@echo "# do not edit" > aliases
@echo -n "alias m=\"make " >> aliases
@$(foreach var,$(SAVED_VARS),echo -n " $(var)=$($(var))" >> aliases ;)
+ @echo -n $(ASSIGNS) >> aliases
@echo "\"" >> aliases
@echo "alias m1=\"m stage1=true\"" >> aliases
-savedpldistro: savedpldistro.mk
-.PHONY: savedpldistro
+envfrompreviousrun: envfrompreviousrun.mk
+.PHONY: envfrompreviousrun
# always refresh this
-all: savedpldistro
+all: envfrompreviousrun
#################### regular make
@echo $(words $(ALLSRPMS)) source rpms OK
.PHONY: srpms
+
+# install the DEVEL-RPMS rpms if defined
+define handle_stock_devel_rpms_pre
+ $(if $($(1)-DEVEL-RPMS), echo "Installing for $(1)-DEVEL-RPMS" ; $(YUM-INSTALL-DEVEL) $($(1)-DEVEL-RPMS))
+endef
+
### these macro handles the DEPEND-DEVEL-RPMS and EXCLUDE-DEVEL-RPMS tags for a hiven package
# before building : rpm-install DEPEND-DEVEL-RPMS and rpm-uninstall EXCLUDE
-define handle_devel_rpms_pre
+define handle_local_devel_rpms_pre
$(if $($(1).all-devel-rpm-paths), echo "Installing for $(1)-DEPEND-DEVEL-RPMS" ; $(RPM-INSTALL-DEVEL) $($(1).all-devel-rpm-paths))
$(if $($(1)-EXCLUDE-DEVEL-RPMS), echo "Uninstalling for $(1)-EXCLUDE-DEVEL-RPMS" ; $(RPM-UNINSTALL-DEVEL) $($(1)-EXCLUDE-DEVEL-RPMS))
endef
-define handle_devel_rpms_post
+define handle_local_devel_rpms_post
-$(if $($(1)-DEPEND-DEVEL-RPMS), echo "Unstalling for $(1)-DEPEND-DEVEL-RPMS" ; $(RPM-UNINSTALL-DEVEL) $($(1)-DEPEND-DEVEL-RPMS))
$(if $($(1)-EXCLUDE-DEVEL-RPMS), "Reinstalling for $(1)-EXCLUDE-DEVEL-RPMS" ; $(YUM-INSTALL-DEVEL) $($(1)-EXCLUDE-DEVEL-RPMS) )
endef
$($(1).srpm): $($(1).specpath) .rpmmacros $($(1).tarballs)
mkdir -p BUILD SRPMS tmp
@(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using SOURCES) " ; date)
- $(call handle_devel_rpms_pre,$(1))
+ $(call handle_stock_devel_rpms_pre,$(1))
+ $(call handle_local_devel_rpms_pre,$(1))
$($(1).rpmbuild) -bs $($(1).specpath)
- $(call handle_devel_rpms_post,$(1))
+ $(call handle_local_devel_rpms_post,$(1))
@(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
else
$($(1).srpm): $($(1).specpath) .rpmmacros $($(1).source)
mkdir -p BUILD SRPMS tmp
@(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using make srpm) " ; date)
- $(call handle_devel_rpms_pre,$(1))
+ $(call handle_stock_devel_rpms_pre,$(1))
+ $(call handle_local_devel_rpms_pre,$(1))
make -C $($(1).source) srpm SPECFILE=$(HOME)/$($(1).specpath) EXPECTED_SRPM=$(notdir $($(1).srpm)) && \
rm -f SRPMS/$(notdir $($(1).srpm)) && \
ln $($(1).source)/$(notdir $($(1).srpm)) SRPMS/$(notdir $($(1).srpm))
- $(call handle_devel_rpms_post,$(1))
+ $(call handle_local_devel_rpms_post,$(1))
@(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
endif
endef
mkdir -p RPMS tmp
@(echo -n "XXXXXXXXXXXXXXX -- BEG RPM $(1) " ; date)
$(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPEND-FILES)), $(createrepo) , )
- $(call handle_devel_rpms_pre,$(1))
+ $(call handle_stock_devel_rpms_pre,$(1))
+ $(call handle_local_devel_rpms_pre,$(1))
$($(1).rpmbuild) --rebuild $(RPM-USE-TMP-DIRS) $($(1).srpm)
- $(call handle_devel_rpms_post,$(1))
+ $(call handle_local_devel_rpms_post,$(1))
@(echo -n "XXXXXXXXXXXXXXX -- END RPM $(1) " ; date)
# for manual use only - in case we need to investigate the results of an rpmbuild
$(1)-compile: $($(1).srpm)
mkdir -p COMPILE tmp
@(echo -n "XXXXXXXXXXXXXXX -- BEG compile $(1) " ; date)
$(if $(findstring RPMS/yumgroups.xml,$($(1)-DEPEND-FILES)), $(createrepo) , )
- $(call handle_devel_rpms_pre,$(1))
+ $(call handle_stock_devel_rpms_pre,$(1))
+ $(call handle_local_devel_rpms_pre,$(1))
$($(1).rpmbuild) --recompile $(RPM-USE-TMP-DIRS) $($(1).srpm)
- $(call handle_devel_rpms_post,$(1))
+ $(call handle_local_devel_rpms_post,$(1))
@(echo -n "XXXXXXXXXXXXXXX -- END compile $(1) " ; date)
.PHONY: $(1)-compile
endef
### brute force clean
distclean1:
- rm -rf savedpldistro.mk .rpmmacros spec2make header.spec SPECS MAKE $(DISTCLEANS)
+ rm -rf envfrompreviousrun.mk .rpmmacros spec2make header.spec SPECS MAKE $(DISTCLEANS)
distclean2:
rm -rf MODULES SOURCES BUILD BUILDROOT RPMS SRPMS tmp
distclean: distclean1 distclean2