]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
build: fetch: Support second URL as download source
authorSimon Kuenzer <simon.kuenzer@neclab.eu>
Fri, 9 Apr 2021 09:58:38 +0000 (11:58 +0200)
committerUnikraft <monkey@unikraft.io>
Fri, 9 Jul 2021 09:48:40 +0000 (09:48 +0000)
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 <simon.kuenzer@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #181

support/build/Makefile.rules

index e6de319c3918e7e5e1c048b65419549faac1bb76..d9fb65a2d6dc481d98dd0ec49b31e547d69a7182 100644 (file)
@@ -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
+
 
 #################################################
 #