pkg-download: support 'file://' in BR2_PRIMARY_SITE
authorJérôme Pouiller <jezz@sysmic.org>
Wed, 18 Nov 2015 09:03:25 +0000 (10:03 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 19 Nov 2015 22:03:42 +0000 (23:03 +0100)
This feature was already discuted here:

  http://lists.busybox.net/pipermail/buildroot/2015-April/125419.html

Personally, I have a big central directory with all tarballs I have
ever downloaded. I use this feature to isolate tarballs necessary to
build a configuration:

  make project_defconfig
  make BR2_DL_DIR=/tmp/mirror-project BR2_PRIMARY_SITE=file:///home/user/dl source
  tar -C /tmp -czvf mirror-project.tgz mirror-project

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Config.in
package/pkg-download.mk

index d7953611487944dd2c5ffec11a473a5387ccab30..1809eebd3e86530c024c0cff7faece5e9f8e26a8 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -165,8 +165,10 @@ config BR2_PRIMARY_SITE
          Primary site to download from. If this option is set then buildroot
          will try to download package source first from this site and try the
          default if the file is not found.
-         Valid URIs are URIs recognized by $(WGET) and scp URIs of the form
-         scp://[user@]host:path.
+         Valid URIs are:
+           - URIs recognized by $(WGET)
+           - local URIs of the form file://absolutepath
+           - scp URIs of the form scp://[user@]host:path.
 
 config BR2_PRIMARY_SITE_ONLY
        bool "Only allow downloads from primary download site"
index c86b9abcff75a40d355012f91e25cec7eb7c0fa6..f08f6160999b06b651392053563927201a1fb31f 100644 (file)
@@ -214,6 +214,7 @@ endef
 define DOWNLOAD_INNER
        $(Q)if test -n "$(call qstrip,$(BR2_PRIMARY_SITE))" ; then \
                case "$(call geturischeme,$(BR2_PRIMARY_SITE))" in \
+                       file) $(call $(3)_LOCALFILES,$(BR2_PRIMARY_SITE)/$(2),$(2)) && exit ;; \
                        scp) $(call $(3)_SCP,$(BR2_PRIMARY_SITE)/$(2),$(2)) && exit ;; \
                        *) $(call $(3)_WGET,$(BR2_PRIMARY_SITE)/$(2),$(2)) && exit ;; \
                esac ; \