infra/pkg-download: make the DOWNLOAD macro fully parameterised

Currently, the DOWNLOAD macro is context-dependent and expects
the PKG variable to be set to the current package.

This is not so nice.

Change the macro to expect the upper-case package name as a
parameter, rather than expect it from a variable.

Adapt the caller accordingly.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
Yann E. MORIN 2019-04-15 21:47:26 +02:00 committed by Arnout Vandecappelle (Essensium/Mind)
parent 9b33a74450
commit 5a0d681394
2 changed files with 14 additions and 13 deletions

View File

@ -93,23 +93,24 @@ endif
# source from the list returned by DOWNLOAD_URIS. # source from the list returned by DOWNLOAD_URIS.
# #
# Argument 1 is the source location # Argument 1 is the source location
# Argument 2 is the upper-case package name
# #
################################################################################ ################################################################################
define DOWNLOAD define DOWNLOAD
$(Q)mkdir -p $($(PKG)_DL_DIR) $(Q)mkdir -p $($(2)_DL_DIR)
$(Q)$(EXTRA_ENV) flock $($(PKG)_DL_DIR)/ $(DL_WRAPPER) \ $(Q)$(EXTRA_ENV) flock $($(2)_DL_DIR)/ $(DL_WRAPPER) \
-c '$($(PKG)_DL_VERSION)' \ -c '$($(2)_DL_VERSION)' \
-d '$($(PKG)_DL_DIR)' \ -d '$($(2)_DL_DIR)' \
-D '$(DL_DIR)' \ -D '$(DL_DIR)' \
-f '$(notdir $(1))' \ -f '$(notdir $(1))' \
-H '$($(PKG)_HASH_FILE)' \ -H '$($(2)_HASH_FILE)' \
-n '$($(PKG)_BASENAME_RAW)' \ -n '$($(2)_BASENAME_RAW)' \
-N '$($(PKG)_RAWNAME)' \ -N '$($(2)_RAWNAME)' \
-o '$($(PKG)_DL_DIR)/$(notdir $(1))' \ -o '$($(2)_DL_DIR)/$(notdir $(1))' \
$(if $($(PKG)_GIT_SUBMODULES),-r) \ $(if $($(2)_GIT_SUBMODULES),-r) \
$(foreach uri,$(call DOWNLOAD_URIS,$(1),$(PKG)),-u $(uri)) \ $(foreach uri,$(call DOWNLOAD_URIS,$(1),$(2)),-u $(uri)) \
$(QUIET) \ $(QUIET) \
-- \ -- \
$($(PKG)_DL_OPTS) $($(2)_DL_OPTS)
endef endef

View File

@ -149,7 +149,7 @@ $(BUILD_DIR)/%/.stamp_downloaded:
break ; \ break ; \
fi ; \ fi ; \
done done
$(foreach p,$($(PKG)_ALL_DOWNLOADS),$(call DOWNLOAD,$(p))$(sep)) $(foreach p,$($(PKG)_ALL_DOWNLOADS),$(call DOWNLOAD,$(p),$(PKG))$(sep))
$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep)) $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
$(Q)mkdir -p $(@D) $(Q)mkdir -p $(@D)
@$(call step_end,download) @$(call step_end,download)
@ -158,7 +158,7 @@ $(BUILD_DIR)/%/.stamp_downloaded:
# Retrieve actual source archive, e.g. for prebuilt external toolchains # Retrieve actual source archive, e.g. for prebuilt external toolchains
$(BUILD_DIR)/%/.stamp_actual_downloaded: $(BUILD_DIR)/%/.stamp_actual_downloaded:
@$(call step_start,actual-download) @$(call step_start,actual-download)
$(call DOWNLOAD,$($(PKG)_ACTUAL_SOURCE_SITE)/$($(PKG)_ACTUAL_SOURCE_TARBALL)) $(call DOWNLOAD,$($(PKG)_ACTUAL_SOURCE_SITE)/$($(PKG)_ACTUAL_SOURCE_TARBALL),$(PKG))
$(Q)mkdir -p $(@D) $(Q)mkdir -p $(@D)
@$(call step_end,actual-download) @$(call step_end,actual-download)
$(Q)touch $@ $(Q)touch $@