diff mbox series

[6/8] download: add flock call before dl-wrapper

Message ID 20180402145802.17611-6-maxime.hadjinlian@gmail.com
State Accepted
Commit 573f8c750fbd18f2f2de23bfdc8e360ed30a8687
Headers show
Series [1/8] pkg-generic: add a subdirectory to the DL_DIR | expand

Commit Message

Maxime Hadjinlian April 2, 2018, 2:58 p.m. UTC
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).

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/pkg-download.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Peter Korsgaard April 2, 2018, 3:46 p.m. UTC | #1
>>>>> "Maxime" == Maxime Hadjinlian <maxime.hadjinlian@gmail.com> writes:

 > 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).

I've extended the commit message a bit and committed, thanks.
diff mbox series

Patch

diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index 7ca6fcc757..4fdb283acc 100644
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -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' \