[Buildroot] [PATCH 4/4] pkg-download: check hasahes for locally cached files
Thomas Petazzoni
thomas.petazzoni at free-electrons.com
Sat Dec 6 12:53:09 UTC 2014
Dear Yann E. MORIN,
On Sat, 6 Dec 2014 13:44:41 +0100, Yann E. MORIN wrote:
> Please also note that this in fact does not change the current
> behaviour. Even today, we are checking the hashes for locally cached
> files, so this solution adds no overhead.
>
> To understand why, here's a summary of what happened before and after
> thise series:
>
> before: after:
>
> check if file is cached check if the file is cached
> if not cached, if cached,
> download the file check the hashes
> check the hashes if match,
> stop
> rm cached file
> downlaod file
> check hashes
>
> So, as you can see, in case the file is already cached locally, and the
> hashes match, we don't do much more than today, except the checks are
> not done in the same order, which allows us to attempt a re-download in
> case of hash mismatch.
define DOWNLOAD_WGET
test -e $(DL_DIR)/$(2) || \
$(EXTRA_ENV) support/download/wrapper wget \
$(DL_DIR)/$(2) \
'$(call qstrip,$(1))' && \
$(call VERIFY_HASH,$(PKGDIR)/$($(PKG)_NAME).hash,$(DL_DIR)/$(2))
endef
Hum, the construct
test -e <foo> || download && check-hash
is not very easy to understand in terms of priorities, but indeed,
regardless of whether the download is executed or not, the check-hash
part is executed.
Thanks for the explanation!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
More information about the buildroot
mailing list