X-Git-Url: http://git.onelab.eu/?p=pyaspects.git;a=blobdiff_plain;f=Makefile;h=cc421416ca22d6549ee5ef3f664d5922761cdde0;hp=36243e232fb0618cf16da22e0daa71fa139446e4;hb=HEAD;hpb=c3f7ac87ad15b2936dbdfe7099cd37ee3f7ae6b1 diff --git a/Makefile b/Makefile index 36243e2..cc42141 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,44 @@ -# $Id$ - -WEBFETCH := wget -SHA1SUM = sha1sum - -# default - overridden by the build -SPECFILE = pyaspects.spec - -main.URL := http://github.com/downloads/baris/pyaspects/pyaspects-0.1.tar.gz -main.SHA1SUM := 5dd32280d510533904dd76f8c27f385984d3b749 -main.FILE := $(notdir $(main.URL)) - -# Thierry - when called from within the build, PWD is /build -SOURCEFILES := $(main.FILE) - -$(main.FILE): #FORCE - @if [ ! -e "$@" ] ; then echo "$(WEBFETCH) $(main.URL)" ; $(WEBFETCH) $(main.URL) ; fi - @if [ ! -e "$@" ] ; then echo "Could not download source file: $@ does not exist" ; exit 1 ; fi - @if test "$$(sha1sum $@ | awk '{print $$1}')" != "$(main.SHA1SUM)" ; then \ - echo "sha1sum of the downloaded $@ does not match the one from 'sources' file" ; \ - echo "Local copy: $$(sha1sum $@)" ; \ - echo "In sources: $$(grep $@ sources)" ; \ - exit 1 ; \ +# +WEBFETCH := wget +SHA1SUM := sha1sum + +ALL += pyaspects +pyaspects-URL1 := http://mirror.onelab.eu/third-party/pyaspects-0.4.1.tar.gz +pyaspects-URL2 := http://build.planet-lab.org/third-party/pyaspects-0.4.1.tar.gz +pyaspects-SHA1SUM := 6b9f0b5711b98ed2a6c6a85713325158de96193a +pyaspects := $(notdir $(pyaspects-URL1)) + +all: $(ALL) +.PHONY: all + +############################## +define download_target +$(1): $($(1)) +.PHONY: $(1) +$($(1)): + @if [ ! -e "$($(1))" ] ; then \ + { echo Using primary; echo "$(WEBFETCH) $($(1)-URL1)" ; $(WEBFETCH) $($(1)-URL1) ; } || \ + { echo Using secondary; echo "$(WEBFETCH) $($(1)-URL2)" ; $(WEBFETCH) $($(1)-URL2) ; } ; fi + @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi + @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \ + echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \ + echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \ + echo "In Makefile: $($(1)-SHA1SUM)" ; \ + false ; \ else \ - ls -l $@ ; \ + ls -l $($(1)) ; \ fi +endef -sources: $(SOURCEFILES) +$(eval $(call download_target,pyaspects)) + +sources: $(ALL) .PHONY: sources +#################### +# default - overridden by the build +SPECFILE = pyaspects.spec + PWD=$(shell pwd) PREPARCH ?= noarch RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)" @@ -49,4 +60,4 @@ clean: @echo "$(varname)=$($(varname))" +%: varname=$(subst +,,$@) +%: - @echo "$($(varname))" \ No newline at end of file + @echo "$($(varname))"