From: Simon Kuenzer Date: Fri, 9 Apr 2021 09:58:38 +0000 (+0200) Subject: build: fetch: Support second URL as download source X-Git-Tag: RELEASE-0.6~145 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=02ee6810b68456e4048ce5ca9a6b0ea2af2c2266;p=unikraft%2Funikraft.git build: fetch: Support second URL as download source Introduces `fetch2` and `fetchas2`, two build system commands that work like `fetch` and `fetchas` but support a secondary URL to download archives from. The secondary URL is used when the download failed with the primary URL. Signed-off-by: Simon Kuenzer Reviewed-by: Alexander Jung Tested-by: Unikraft CI GitHub-Pull-Request: #181 --- diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules index e6de319c3..d9fb65a2d 100644 --- a/support/build/Makefile.rules +++ b/support/build/Makefile.rules @@ -390,12 +390,30 @@ $(BUILD_DIR)/$(1)/$(3): $(call unarchive,$(1),$(BUILD_DIR)/$(1)/$(3),$(4)) endef +# fetchas2 works like fetchas but supports a secondary URL +# fetchas2 $libname,$url,$url2,$target_fname(no_path!),$dir_with_patches(optional) +define fetchas2 = +$(BUILD_DIR)/$(1)/$(4): + $(call verbose_cmd,WGET,$(1)':' $(2) [retry-with: $(3)], \ + $(WGET) -q --show-progress --progress=bar -O $(BUILD_DIR)/$(1)/$(4) $(2) || \ + $(WGET) -q --show-progress --progress=bar -O $(BUILD_DIR)/$(1)/$(4) $(3) || \ + $(RM) $(BUILD_DIR)/$(1)/$(4)) + +$(call unarchive,$(1),$(BUILD_DIR)/$(1)/$(4),$(5)) +endef + # Downloads an archive from remote and invokes unarchive # fetch $libname,$url,$dir_with_patches(optional) define fetch = $(call fetchas,$(1),$(2),$(notdir $(2)),$(3)) endef +# fetch2 works like fetch but supports a secondary URL +# fetch2 $libname,$url,$url2,$dir_with_patches(optional) +define fetch2 = +$(call fetchas2,$(1),$(2),$(3),$(notdir $(2)),$(4)) +endef + ################################################# #