Commit 0a4856ce authored by Alvaro G. M's avatar Alvaro G. M Committed by Peter Korsgaard
Browse files

DOWNLOAD: change $1=DIRECTORY_URL, $2=FILE_NAME to $1=FULL_FILE_URL, $2=FILE_NAME



This modifies the definition of DOWNLOAD to receive two arguments:
the first one is the full URL of the file to download, whereas the second
(and optional) is the name the file will have once downloaded.

Same thing with the SOURCE_CHECK_WGET and SCP functions.

All calls to these functions have been changed to the shortest form of
the new API, except for toolchains acquisition. Since there is quite a
number of different toolchains this call to DOWNLOAD is better set to the
generic one.

Signed-off-by: default avatarAlvaro G. M <alvaro.gamez@hazent.com>
Acked-by: default avatarArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: default avatarStephan Hoffmann <sho@relinux.de>
Downloading Microblaze LE toolchain works on a clean install
Signed-off-by: default avatarPeter Korsgaard <jacmet@sunsite.dk>
parent 6372f4e6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ existing manual makefiles and to help understand how they work.*
11: LIBFOO_TARGET_BINARY = usr/bin/foo
12:
13: $(DL_DIR)/$(LIBFOO_SOURCE):
14: 	$(call DOWNLOAD,$(LIBFOO_SITE),$(LIBFOO_SOURCE))
14: 	$(call DOWNLOAD,$(LIBFOO_SITE)/$(LIBFOO_SOURCE))
15:
16: $(LIBFOO_DIR)/.source: $(DL_DIR)/$(LIBFOO_SOURCE)
17: 	$(ZCAT) $(DL_DIR)/$(LIBFOO_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ define LINUX_DOWNLOAD_PATCHES
	$(if $(LINUX_PATCHES),
		@$(call MESSAGE,"Download additional patches"))
	$(foreach patch,$(filter ftp://% http://%,$(LINUX_PATCHES)),\
		$(call DOWNLOAD,$(dir $(patch)),$(notdir $(patch)))$(sep))
		$(call DOWNLOAD,$(patch))$(sep))
endef

LINUX_POST_DOWNLOAD_HOOKS += LINUX_DOWNLOAD_PATCHES
+11 −7
Original line number Diff line number Diff line
@@ -203,11 +203,11 @@ endef
# to prepend the path with a slash: scp://[user@]host:/absolutepath
define DOWNLOAD_SCP
	test -e $(DL_DIR)/$(2) || \
	$(SCP) $(call stripurischeme,$(call qstrip,$(1)))/$(2) $(DL_DIR)
	$(SCP) '$(call stripurischeme,$(call qstrip,$(1)))' $(DL_DIR)/$(2)
endef

define SOURCE_CHECK_SCP
	$(SSH) $(call domain,$(1),:) ls $(call notdomain,$(1)/$(2),:) > /dev/null
	$(SSH) $(call domain,$(1),:) ls '$(call notdomain,$(1),:)' > /dev/null
endef

define SHOW_EXTERNAL_DEPS_SCP
@@ -241,12 +241,12 @@ endef
# download fails).
define DOWNLOAD_WGET
	test -e $(DL_DIR)/$(2) || \
	$(WGET) -O $(DL_DIR)/$(2) $(call qstrip,$(1))/$(2) || \
	$(WGET) -O $(DL_DIR)/$(2) '$(call qstrip,$(1))' || \
	(rm -f $(DL_DIR)/$(2) ; exit 1)
endef

define SOURCE_CHECK_WGET
  $(WGET) --spider $(call qstrip,$(1))/$(2)
  $(WGET) --spider '$(call qstrip,$(1))'
endef

define SHOW_EXTERNAL_DEPS_WGET
@@ -280,6 +280,10 @@ endef
################################################################################

define DOWNLOAD
	$(call DOWNLOAD_INNER,$(1),$(if $(2),$(2),$(notdir $(1))))
endef

define DOWNLOAD_INNER
	$(Q)if test -n "$(call qstrip,$(BR2_PRIMARY_SITE))" ; then \
		case "$(call geturischeme,$(BR2_PRIMARY_SITE))" in \
			scp) $(call $(DL_MODE)_SCP,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \
@@ -298,7 +302,7 @@ define DOWNLOAD
		esac ; \
	fi ; \
	if test -n "$(call qstrip,$(BR2_BACKUP_SITE))" ; then \
		$(call $(DL_MODE)_WGET,$(BR2_BACKUP_SITE),$(2)) && exit ; \
		$(call $(DL_MODE)_WGET,$(BR2_BACKUP_SITE)/$(2),$(2)) && exit ; \
	fi ; \
	exit 1
endef
@@ -322,8 +326,8 @@ ifeq ($(DL_MODE),DOWNLOAD)
		(test -z $($(PKG)_PATCH) || test -e $(DL_DIR)$($(PKG)_PATCH))) || \
		$(call MESSAGE,"Downloading")
endif
	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_SOURCE)))
	$(if $($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_PATCH)))
	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
	$(if $($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_PATCH)))
	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
ifeq ($(DL_MODE),DOWNLOAD)
	$(Q)mkdir -p $(@D)
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ else
endif

$(DL_DIR)/$(CUPS_SOURCE):
	 $(call DOWNLOAD,$(CUPS_SITE),$(CUPS_SOURCE))
	 $(call DOWNLOAD,$(CUPS_SITE)/$(CUPS_SOURCE))

$(CUPS_DIR)/.unpacked: $(DL_DIR)/$(CUPS_SOURCE)
	$(CUPS_CAT) $(DL_DIR)/$(CUPS_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ FIS_BINARY:=fis
FIS_TARGET_BINARY:=sbin/fis

$(DL_DIR)/$(FIS_SOURCE):
	 $(call DOWNLOAD,$(FIS_SITE),$(FIS_SOURCE))
	 $(call DOWNLOAD,$(FIS_SITE)/$(FIS_SOURCE))

fis-source: $(DL_DIR)/$(FIS_SOURCE)

Loading