From 0a4856ce27027e939fdcd350fb0b246cbda75e93 Mon Sep 17 00:00:00 2001 From: "Alvaro G. M" Date: Fri, 16 Mar 2012 14:42:53 +0100 Subject: 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: Alvaro G. M Acked-by: Arnout Vandecappelle (Essensium/Mind) Tested-by: Stephan Hoffmann Downloading Microblaze LE toolchain works on a clean install Signed-off-by: Peter Korsgaard --- package/Makefile.package.in | 18 +++++++++++------- package/cups/cups.mk | 2 +- package/fis/fis.mk | 2 +- package/games/doom-wad/doom-wads.mk | 2 +- package/gettext/gettext.mk | 2 +- package/netkitbase/netkitbase.mk | 2 +- package/netkittelnet/netkittelnet.mk | 2 +- package/newt/newt.mk | 2 +- package/tinyhttpd/tinyhttpd.mk | 2 +- package/ttcp/ttcp.mk | 2 +- package/uemacs/uemacs.mk | 2 +- package/vpnc/vpnc.mk | 2 +- package/xfsprogs/xfsprogs.mk | 2 +- 13 files changed, 23 insertions(+), 19 deletions(-) (limited to 'package') diff --git a/package/Makefile.package.in b/package/Makefile.package.in index 59adce1b0..f7b65666f 100644 --- a/package/Makefile.package.in +++ b/package/Makefile.package.in @@ -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) diff --git a/package/cups/cups.mk b/package/cups/cups.mk index 4e8db71aa..9efd6e98d 100644 --- a/package/cups/cups.mk +++ b/package/cups/cups.mk @@ -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) - diff --git a/package/fis/fis.mk b/package/fis/fis.mk index 29424491c..0975f3fb0 100644 --- a/package/fis/fis.mk +++ b/package/fis/fis.mk @@ -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) diff --git a/package/games/doom-wad/doom-wads.mk b/package/games/doom-wad/doom-wads.mk index bae242091..c0bf4fbfc 100644 --- a/package/games/doom-wad/doom-wads.mk +++ b/package/games/doom-wad/doom-wads.mk @@ -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) diff --git a/package/gettext/gettext.mk b/package/gettext/gettext.mk index f4c8c7671..f3605da6f 100644 --- a/package/gettext/gettext.mk +++ b/package/gettext/gettext.mk @@ -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) diff --git a/package/netkitbase/netkitbase.mk b/package/netkitbase/netkitbase.mk index dde8f9f6c..83991f208 100644 --- a/package/netkitbase/netkitbase.mk +++ b/package/netkitbase/netkitbase.mk @@ -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) diff --git a/package/netkittelnet/netkittelnet.mk b/package/netkittelnet/netkittelnet.mk index e9f40cad0..ff0531872 100644 --- a/package/netkittelnet/netkittelnet.mk +++ b/package/netkittelnet/netkittelnet.mk @@ -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) diff --git a/package/newt/newt.mk b/package/newt/newt.mk index eb944a92f..ac450e0c8 100644 --- a/package/newt/newt.mk +++ b/package/newt/newt.mk @@ -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) - diff --git a/package/tinyhttpd/tinyhttpd.mk b/package/tinyhttpd/tinyhttpd.mk index 739849f33..0f95d06fb 100644 --- a/package/tinyhttpd/tinyhttpd.mk +++ b/package/tinyhttpd/tinyhttpd.mk @@ -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) diff --git a/package/ttcp/ttcp.mk b/package/ttcp/ttcp.mk index 006b74ca9..1acf12048 100644 --- a/package/ttcp/ttcp.mk +++ b/package/ttcp/ttcp.mk @@ -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) diff --git a/package/uemacs/uemacs.mk b/package/uemacs/uemacs.mk index 8355a7f96..62b0911af 100644 --- a/package/uemacs/uemacs.mk +++ b/package/uemacs/uemacs.mk @@ -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) diff --git a/package/vpnc/vpnc.mk b/package/vpnc/vpnc.mk index 5a8c70036..d8d9654a4 100644 --- a/package/vpnc/vpnc.mk +++ b/package/vpnc/vpnc.mk @@ -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) - diff --git a/package/xfsprogs/xfsprogs.mk b/package/xfsprogs/xfsprogs.mk index 68db2f789..52fec0964 100644 --- a/package/xfsprogs/xfsprogs.mk +++ b/package/xfsprogs/xfsprogs.mk @@ -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) -- cgit v1.2.3