buildroot/support
Hollis Blanchard 38de434123 download: fix file:// BR2_PRIMARY_SITE (download cache)
wget is the only downloader currently usable with BR2_PRIMARY_SITE, and that
doesn't work at all for file:// URLs. The symptoms are these:

	support/download/dl-wrapper -c '2.4.47' -d '/PATH/build/sw/source/attr' -D '/PATH/build/sw/source' -f 'attr-2.4.47.src.tar.gz' -H 'package/attr//attr.hash' -n 'attr-2.4.47' -N 'attr' -o '/PATH/build/sw/source/attr/attr-2.4.47.src.tar.gz'  -u file\|urlencode+file:///NFS/buildroot_dl_cache/attr -u file\|urlencode+file:///NFS/buildroot_dl_cache -u http+http://download.savannah.gnu.org/releases/attr -u http\|urlencode+http://sources.buildroot.net/attr -u http\|urlencode+http://sources.buildroot.net  --
	file:///NFS/buildroot_dl_cache/attr/attr-2.4.47.src.tar.gz: Unsupported scheme `file'.
	ERROR: attr-2.4.47.src.tar.gz has wrong sha256 hash:
	ERROR: expected: 25772f653ac5b2e3ceeb89df50e4688891e21f723c460636548971652af0a859
	ERROR: got     : e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
	ERROR: Incomplete download, or man-in-the-middle (MITM) attack

In the case of custom Linux kernel versions, this is fatal, because there isn't
necessarily a hash file to indicate that wget's empty tarball is wrong.

This seems to have been broken by commit c8ef0c03b0, because:
1. BR2_PRIMARY_SITE always appends "urlencode" (package/pkg-download.mk)
2. Anything with the "|urlencode" suffix in $uri will end up using wget due to
   the backend case wildcarding.
3. The wget backend rejects file:/// URLs ("unsupported scheme"), and we end up
   with an empty .tar.gz file in the downloads directory.

Fix that by shell-extracting the backend name from the left of "|". I'm not
positive if all URLs will have a "|", so this code only looks for a "|" left of
the "+".

Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-08-21 00:24:29 +02:00
..
config-fragments support/config-fragments/autobuild: update pre-built Buildroot toolchains 2018-06-30 18:00:30 +02:00
dependencies support/dependencies: check for system-provided bison and flex 2018-08-20 16:01:42 +02:00
docker support/docker: use the distro-provided flake8 2018-06-17 20:54:02 +02:00
download download: fix file:// BR2_PRIMARY_SITE (download cache) 2018-08-21 00:24:29 +02:00
gnuconfig support/gnuconfig: bump version to 2016-05-15 2016-06-05 22:26:57 +02:00
kconfig support/kconfig: Add missing target to README.buildroot 2018-05-13 22:09:01 +02:00
legal-info legal-info: add hash for our own license file 2017-07-05 16:31:40 +02:00
libtool support/libtool: add patch for newer versions 2014-12-21 13:21:56 +01:00
misc support/misc/toolchainfile.cmake.in: use TARGET_LDFLAGS for shared and module libraries 2018-07-19 09:33:37 +02:00
scripts support/scripts/pkg-stats: use parenthesis for print 2018-05-19 13:48:21 +02:00
testing support/testing: add test for file capabilities 2018-08-10 08:25:51 +02:00