[Buildroot] [PATCH 12/13] download: add flock call before dl-wrapper
Maxime Hadjinlian
maxime.hadjinlian at gmail.com
Tue Jul 4 16:22:10 UTC 2017
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).
To make sure the directory exists, the mkdir call has been removed from
the dl-wrapper and put in the infrastructure.
Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian at gmail.com>
---
package/pkg-download.mk | 4 +++-
support/download/dl-wrapper | 1 -
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index 47671e21a7..c67f1ba4e1 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)
@@ -91,7 +92,8 @@ endif
define DOWNLOAD
$(Q)$(if $(filter bzr cvs hg svn,$($(PKG)_SITE_METHOD)),export BR_NO_CHECK_HASH_FOR=$(notdir $(1));) \
- $(EXTRA_ENV) $(DL_WRAPPER) \
+ $(Q)mkdir -p $($(PKG)_DL_DIR)/
+ $(EXTRA_ENV) $(FLOCK) $(DL_WRAPPER) \
-c $($(PKG)_DL_VERSION) \
-f $(notdir $(1)) \
-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper
index f14a60c173..50c14a2e16 100755
--- a/support/download/dl-wrapper
+++ b/support/download/dl-wrapper
@@ -50,7 +50,6 @@ main() {
if [ -z "${output}" ]; then
error "no output specified, use -o\n"
fi
- mkdir -p "$(dirname "${output}")"
# If the output file already exists and:
# - there's no .hash file: do not download it again and exit promptly
--
2.13.2
More information about the buildroot
mailing list