DOWNLOAD: change $1=DIRECTORY_URL, $2=FILE_NAME to $1=FULL_FILE_URL, $2=FILE_NAME
authorAlvaro G. M <alvaro.gamez@hazent.com>
Fri, 16 Mar 2012 13:42:53 +0000 (14:42 +0100)
committerPeter Korsgaard <jacmet@sunsite.dk>
Sun, 18 Mar 2012 21:21:16 +0000 (22:21 +0100)
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: Alvaro G. M <alvaro.gamez@hazent.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Stephan Hoffmann <sho@relinux.de>
Downloading Microblaze LE toolchain works on a clean install
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
20 files changed:
docs/manual/adding-packages-handwritten.txt
linux/linux.mk
package/Makefile.package.in
package/cups/cups.mk
package/fis/fis.mk
package/games/doom-wad/doom-wads.mk
package/gettext/gettext.mk
package/netkitbase/netkitbase.mk
package/netkittelnet/netkittelnet.mk
package/newt/newt.mk
package/tinyhttpd/tinyhttpd.mk
package/ttcp/ttcp.mk
package/uemacs/uemacs.mk
package/vpnc/vpnc.mk
package/xfsprogs/xfsprogs.mk
toolchain/gcc/gcc-uclibc-4.x.mk
toolchain/gdb/gdb.mk
toolchain/kernel-headers/kernel-headers.mk
toolchain/toolchain-external/ext-tool.mk
toolchain/uClibc/uclibc.mk

index 54ccf650d8c6275d288f085ab4a8dec27659863f..beb25f6877dd6ec4b34e5a69d0213f6d911f40b5 100644 (file)
@@ -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) -
index ae236d45ddbb08f5278afd62f8279e12b0bb5cc2..58cbe8e9257066e3e1479fc5c51c12ba20edc8a2 100644 (file)
@@ -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
index 59adce1b010a342ec2a782cdb217b08f743381e1..f7b65666fafc48ec8dab7f593dd69308dba51aed 100644 (file)
@@ -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)
index 4e8db71aa92c359a985864112a55693a0058d1fa..9efd6e98d5d26fcfaa026c0dd78945228a7bbcba 100644 (file)
@@ -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) -
index 29424491c2447dbcb529fd153a9b7cee060d9360..0975f3fb0eaa99906917a24fc4332190f54dae98 100644 (file)
@@ -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)
 
index bae2420919fbc40d24ea0721de307778c1e80f63..c0bf4fbfc027989834d407dc66ca8a133b61cc0c 100644 (file)
@@ -10,7 +10,7 @@ DOOM_WAD_SITE = ftp://ftp.idsoftware.com/idstuff/doom/
 DOOM_WAD_DIR=$(BUILD_DIR)/doom-wad-$(DOOM_WAD_VERSION)
 
 $(DL_DIR)/$(DOOM_WAD_SOURCE):
-        $(call DOWNLOAD,$(DOOM_WAD_SITE),$(DOOM_WAD_SOURCE))
+        $(call DOWNLOAD,$(DOOM_WAD_SITE)/$(DOOM_WAD_SOURCE))
 
 doom-wad-source: $(DL_DIR)/$(DOOM_WAD_SOURCE)
 
index f4c8c7671c9bc07be7e7d2505d2d4e360ebad35a..f3605da6f5e34d9228a213edd567cc66a7e8f3db 100644 (file)
@@ -18,7 +18,7 @@ LIBINTL_TARGET_BINARY:=usr/lib/libintl.so
 endif
 
 $(DL_DIR)/$(GETTEXT_SOURCE):
-        $(call DOWNLOAD,$(GETTEXT_SITE),$(GETTEXT_SOURCE))
+        $(call DOWNLOAD,$(GETTEXT_SITE)/$(GETTEXT_SOURCE))
 
 gettext-source: $(DL_DIR)/$(GETTEXT_SOURCE)
 
index dde8f9f6c0a764f2c94642db1e71b50eeeb0bc01..83991f2088c4b5c87744ba52c12db547af0d3a2c 100644 (file)
@@ -12,7 +12,7 @@ NETKITBASE_BINARY:=inetd/inetd
 NETKITBASE_TARGET_BINARY:=usr/sbin/inetd
 
 $(DL_DIR)/$(NETKITBASE_SOURCE):
-        $(call DOWNLOAD,$(NETKITBASE_SITE),$(NETKITBASE_SOURCE))
+        $(call DOWNLOAD,$(NETKITBASE_SITE)/$(NETKITBASE_SOURCE))
 
 netkitbase-source: $(DL_DIR)/$(NETKITBASE_SOURCE)
 
index e9f40cad0350fbaed84b5de68916a46f00b2848d..ff053187262bd5470fb87a31e3f08acb1f12d60e 100644 (file)
@@ -12,7 +12,7 @@ NETKITTELNET_BINARY:=telnetd/telnetd
 NETKITTELNET_TARGET_BINARY:=usr/sbin/telnetd
 
 $(DL_DIR)/$(NETKITTELNET_SOURCE):
-        $(call DOWNLOAD,$(NETKITTELNET_SITE),$(NETKITTELNET_SOURCE))
+        $(call DOWNLOAD,$(NETKITTELNET_SITE)/$(NETKITTELNET_SOURCE))
 
 netkittelnet-source: $(DL_DIR)/$(NETKITTELNET_SOURCE)
 
index eb944a92fd19b01b49f1f895d6d114f5aee991ea..ac450e0c80dfdf60e7cc0e6f52bcabe8f62cae90 100644 (file)
@@ -11,7 +11,7 @@ NEWT_VERSION=0.51.0
 NEWT_CFLAGS=-Os -g -fPIC
 
 $(DL_DIR)/$(NEWT_SOURCE):
-       $(call DOWNLOAD,$(NEWT_SITE),$(NEWT_SOURCE))
+       $(call DOWNLOAD,$(NEWT_SITE)/$(NEWT_SOURCE))
 
 $(NEWT_DIR)/.source: $(DL_DIR)/$(NEWT_SOURCE)
        $(NEWT_CAT) $(DL_DIR)/$(NEWT_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
index 739849f33bf461d653437a78a213df42e018660e..0f95d06fbe18d94be7f15da3c8032baffa250409 100644 (file)
@@ -12,7 +12,7 @@ TINYHTTPD_BINARY:=httpd
 TINYHTTPD_TARGET_BINARY:=usr/sbin/tinyhttpd
 
 $(DL_DIR)/$(TINYHTTPD_SOURCE):
-        $(call DOWNLOAD,$(TINYHTTPD_SITE),$(TINYHTTPD_SOURCE))
+        $(call DOWNLOAD,$(TINYHTTPD_SITE)/$(TINYHTTPD_SOURCE))
 
 tinyhttpd-source: $(DL_DIR)/$(TINYHTTPD_SOURCE)
 
index 006b74ca9c7cfa65cdb6a5f8f69742b881ec3f94..1acf12048ae2a11d6a85164d1c7fe79be226c8ea 100644 (file)
@@ -10,7 +10,7 @@ TTCP_SOURCE=ttcp$(TTCP_VERSION).c
 TTCP_DIR=$(BUILD_DIR)/ttcp$(TTCP_VERSION)
 
 $(DL_DIR)/$(TTCP_SOURCE):
-        $(call DOWNLOAD,$(TTCP_SOURCE_URL),$(TTCP_SOURCE))
+        $(call DOWNLOAD,$(TTCP_SOURCE_URL)/$(TTCP_SOURCE))
 
 $(TTCP_DIR)/.unpacked: $(DL_DIR)/$(TTCP_SOURCE)
        -mkdir $(TTCP_DIR)
index 8355a7f960a7626b8c4d5fad2231e1421e49b2a4..62b0911af0b709656dc011bfd0a12da80bae889d 100644 (file)
@@ -12,7 +12,7 @@ UEMACS_BINARY:=em
 UEMACS_TARGET_BINARY:=usr/bin/emacs
 
 $(DL_DIR)/$(UEMACS_SOURCE):
-        $(call DOWNLOAD,$(UEMACS_SITE),$(UEMACS_SOURCE))
+        $(call DOWNLOAD,$(UEMACS_SITE)/$(UEMACS_SOURCE))
 
 uemacs-source: $(DL_DIR)/$(UEMACS_SOURCE)
 
index 5a8c7003682cb5fc98fefc24bd99aaa90fc73e50..d8d9654a47f08f49b4f9646eb5897cdd5b5cefab 100644 (file)
@@ -15,7 +15,7 @@ VPNC_TARGET_BINARY:=$(VPNC_DEST_DIR)/vpnc
 VPNC_TARGET_SCRIPT:=$(TARGET_DIR)/etc/vpnc/default.conf
 
 $(DL_DIR)/$(VPNC_SOURCE):
-       $(call DOWNLOAD,$(VPNC_SITE),$(VPNC_SOURCE))
+       $(call DOWNLOAD,$(VPNC_SITE)/$(VPNC_SOURCE))
 
 $(VPNC_DIR)/.unpacked: $(DL_DIR)/$(VPNC_SOURCE)
        $(VPNC_CAT) $(DL_DIR)/$(VPNC_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
index 68db2f789094495ae50dff642c80e958712be546..52fec0964fb68fe424fe73bebcde1fcf7e99ada0 100644 (file)
@@ -18,7 +18,7 @@ XFSPROGS_STRIP_LIBDEP:= \
        repair/xfs_repair quota/xfs_quota
 
 $(DL_DIR)/$(XFSPROGS_SOURCE):
-        $(call DOWNLOAD,$(XFSPROGS_SITE),$(XFSPROGS_SOURCE))
+        $(call DOWNLOAD,$(XFSPROGS_SITE)/$(XFSPROGS_SOURCE))
 
 xfsprogs-source: $(DL_DIR)/$(XFSPROGS_SOURCE)
 
index 5eb750504881085ea98bad41d1b4c5cb3e285500..d9547fbfbec826f656674c9ecbb21ceaa10698f1 100644 (file)
@@ -172,7 +172,7 @@ endif
 
 $(DL_DIR)/$(GCC_SOURCE):
        mkdir -p $(DL_DIR)
-       $(call DOWNLOAD,$(GCC_SITE),$(GCC_SOURCE))
+       $(call DOWNLOAD,$(GCC_SITE)/$(GCC_SOURCE))
 
 gcc-unpacked: $(GCC_DIR)/.patched
 $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
index 56faf499770e8c7428b02524d3a8e20371dd9122..b5c085bca854e81f5cc8d5cf69e31ae4ceb86d45 100644 (file)
@@ -24,7 +24,7 @@ endif
 GDB_DIR:=$(TOOLCHAIN_DIR)/gdb-$(GDB_VERSION)
 
 $(DL_DIR)/$(GDB_SOURCE):
-       $(call DOWNLOAD,$(GDB_SITE),$(GDB_SOURCE))
+       $(call DOWNLOAD,$(GDB_SITE)/$(GDB_SOURCE))
 
 gdb-unpacked: $(GDB_DIR)/.unpacked
 $(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE)
index 72c600766d5a6f123515a770437068f644621ef8..c464c373de83c548cd2545d39dcb4d49337893e2 100644 (file)
@@ -81,7 +81,7 @@ $(DL_DIR)/$(LINUX_HEADERS_SOURCE):
 ifeq ($(BR2_KERNEL_HEADERS_SNAP),y)
        $(error No local $@ found, cannot continue. Are you sure you wanted to enable BR2_KERNEL_HEADERS_SNAP?)
 endif
-       $(call DOWNLOAD,$(LINUX_HEADERS_SITE),$(LINUX_HEADERS_SOURCE))
+       $(call DOWNLOAD,$(LINUX_HEADERS_SITE)/$(LINUX_HEADERS_SOURCE))
 
 kernel-headers: $(LINUX_HEADERS_DIR)/.configured
 
index 31ba50f97b7b4cb82532370ee32d46d3f8dc34a3..3c97de16b07f099320cc0b71abe46dae284256af 100644 (file)
@@ -253,10 +253,10 @@ endif
 # components than usual.
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2010RC1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1),y)
 $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1):
-       $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_1),$(TOOLCHAIN_EXTERNAL_SOURCE_1))
+       $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_1)/$(TOOLCHAIN_EXTERNAL_SOURCE_1))
 
 $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2):
-       $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_2),$(TOOLCHAIN_EXTERNAL_SOURCE_2))
+       $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_2)/$(TOOLCHAIN_EXTERNAL_SOURCE_2))
 
 $(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2)
        mkdir -p $(@D)
@@ -279,7 +279,7 @@ endif
 else
 # Download and extraction of a toolchain
 $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE):
-       $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE),$(TOOLCHAIN_EXTERNAL_SOURCE))
+       $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE)$(TOOLCHAIN_EXTERNAL_SOURCE),$(TOOLCHAIN_EXTERNAL_SOURCE))
 
 $(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE)
        mkdir -p $(@D)
index ee474bbb61fac8657636db32e21bcdb7ac1eebb8..32cbe460522c87f4f45cc7874fafb395842a495b 100644 (file)
@@ -67,7 +67,7 @@ UCLIBC_ARM_TYPE:=CONFIG_$(call qstrip,$(BR2_ARM_TYPE))
 UCLIBC_SPARC_TYPE:=CONFIG_SPARC_$(call qstrip,$(BR2_SPARC_TYPE))
 
 $(DL_DIR)/$(UCLIBC_SOURCE):
-       $(call DOWNLOAD,$(UCLIBC_SITE),$(UCLIBC_SOURCE))
+       $(call DOWNLOAD,$(UCLIBC_SITE)/$(UCLIBC_SOURCE))
 
 uclibc-unpacked: $(UCLIBC_DIR)/.unpacked
 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)