download: add flock call before dl-wrapper

In order to introduce the cache mechanisms, we need to have a lock on the
$(LIBFOO_DL_DIR), otherwise it would be impossible to do parallel download
(a shared DL_DIR for two buildroot instances) without risking conflicts.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Maxime Hadjinlian 2018-04-02 16:58:00 +02:00 committed by Peter Korsgaard
parent 072374918d
commit 573f8c750f

View File

@ -19,6 +19,7 @@ SSH := $(call qstrip,$(BR2_SSH))
export LOCALFILES := $(call qstrip,$(BR2_LOCALFILES))
DL_WRAPPER = support/download/dl-wrapper
FLOCK = flock $($(PKG)_DL_DIR)/
# DL_DIR may have been set already from the environment
ifeq ($(origin DL_DIR),undefined)
@ -93,7 +94,7 @@ define DOWNLOAD
$(Q)mkdir -p $($(PKG)_DL_DIR)
$(Q)$(if $(filter bzr cvs hg svn,$($(PKG)_SITE_METHOD)),
BR_NO_CHECK_HASH_FOR=$(notdir $(call qstrip,$(1)))) \
$(EXTRA_ENV) $(DL_WRAPPER) \
$(EXTRA_ENV) $(FLOCK) $(DL_WRAPPER) \
-c '$($(PKG)_DL_VERSION)' \
-f '$(notdir $(1))' \
-H '$(PKGDIR)/$($(PKG)_RAWNAME).hash' \