Yann E. MORIN 9bb7d10eea pkg-download: check hashes for locally cached files
In some cases, upstream just update their releases in-place, without
renaming them. When that package is updated in Buildroot, a new hash to
match the new upstream release is included in the corresponding .hash

As a consequence, users who previously downloaded that package's tarball
with an older version of Buildroot, will get stuck with an old archive
for that package, and after updating their Buildroot copy, will be greeted
with a failed download, due to the local file not matching the new

Also, an upstream would sometime serve us HTML garbage instead of the
actual tarball we requested, like SourceForge does from time for as-yet
unknown reasons.

So, to avoid this situation, check the hashes prior to doing the
download. If the hashes match, consider the locally cached file genuine,
and do not download it. However, if the locally cached file does not
match the known hashes we have for it, it is promptly removed, and a
download is re-attempted.

Note: this does not add any overhead compared to the previous situation,
because we were already checking hashes of locally cached files. It just
changes the order in which we do the checks. For the records, here is the
overhead of hashing a 231MiB file (qt-everywhere-opensource-src-4.8.6.tar.gz)
on a core-i5 @2.5GHz:

            cache-cold  cache-hot
    sha1      1.914s      0.762s
    sha256    2.109s      1.270s

But again, this overhead already existed before this patch.

Signed-off-by: "Yann E. MORIN" <>
Cc: Thomas Petazzoni <>
Cc: Peter Korsgaard <>
Cc: Gustavo Zacarias <>
Reviewed-by: Thomas Petazzoni <>
Signed-off-by: Thomas Petazzoni <>
2014-12-11 23:59:41 +01:00
dependencies support/scripts/ cleanup the output of the 32 bits gcc test 2014-12-08 22:32:35 +01:00
download pkg-download: check hashes for locally cached files 2014-12-11 23:59:41 +01:00
dummy-external core: allow external code to be integrated 2013-12-08 22:39:42 +01:00
gnuconfig Update config.guess and config.sub scripts to latest versions. 2013-10-27 15:29:38 +01:00
kconfig infra: replace BUILDROOT_CONFIG with BR2_CONFIG 2014-02-09 17:00:13 +01:00
legal-info legal-info: infrastructure to collect legally-relevant material 2012-07-17 19:05:49 +02:00
libtool support/libtool: improve version 1.5 static patching 2014-07-31 16:35:49 +02:00
misc Set CMAKE_SYSTEM_PROCESSOR. 2014-12-09 23:00:12 +01:00
scripts Rename BR2_PREFER_STATIC_LIB to BR2_STATIC_LIBS 2014-12-11 22:48:13 +01:00