depends: fix fallback downloads

In some cases, failed downloads wouldn't trigger a fallback download attempt.
Namely, checksum mismatches.
This commit is contained in:
Cory Fields 2016-03-03 01:01:30 -05:00
parent dc4ec6d3db
commit fe740f1469
1 changed files with 10 additions and 6 deletions

View File

@ -19,15 +19,19 @@ define int_get_all_dependencies
$(sort $(foreach dep,$(2),$(2) $(call int_get_all_dependencies,$(1),$($(dep)_dependencies))))
endef
define fetch_file
(test -f $$($(1)_source_dir)/$(4) || \
( mkdir -p $$($(1)_download_dir) && echo Fetching $(1)... && \
( $(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" || \
$(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(FALLBACK_DOWNLOAD_PATH)/$(3)" ) && \
define fetch_file_inner
( mkdir -p $$($(1)_download_dir) && echo Fetching $(3) from $(2) && \
$(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" && \
echo "$(5) $$($(1)_download_dir)/$(4).temp" > $$($(1)_download_dir)/.$(4).hash && \
$(build_SHA256SUM) -c $$($(1)_download_dir)/.$(4).hash && \
mv $$($(1)_download_dir)/$(4).temp $$($(1)_source_dir)/$(4) && \
rm -rf $$($(1)_download_dir) ))
rm -rf $$($(1)_download_dir) )
endef
define fetch_file
( test -f $$($(1)_source_dir)/$(4) || \
( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \
$(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5))))
endef
define int_get_build_recipe_hash