From patchwork Tue Jul 4 16:22:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Hadjinlian X-Patchwork-Id: 784178 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x28Sc2ZY3z9t0j for ; Wed, 5 Jul 2017 02:23:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="W4DqPaTe"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 84B72879D1; Tue, 4 Jul 2017 16:23:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kK8yfp4jLHyi; Tue, 4 Jul 2017 16:23:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id EA33C87BA6; Tue, 4 Jul 2017 16:23:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id A81B11C0021 for ; Tue, 4 Jul 2017 16:22:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A20F98750F for ; Tue, 4 Jul 2017 16:22:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P21ELXNNUUne for ; Tue, 4 Jul 2017 16:22:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 4A57D87794 for ; Tue, 4 Jul 2017 16:22:29 +0000 (UTC) Received: by mail-wm0-f51.google.com with SMTP id 62so200872799wmw.1 for ; Tue, 04 Jul 2017 09:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fqWd3dTsJKny0UrW5ipmpMb5PAQOvNEiSwazaoUZ8Gw=; b=W4DqPaTeVLgvfWA9IE2PF/X+/X0rt1OWVf+rQ6UiX7cSxGVzzgxcbFoSIrPLMm5JVV wOGXtFc1e9HdKZzyYx4rtDVZCEy5kZm8uDjq7RndiulQfH0NNURhaB/fkWSMgY2RS/Hk UCaEab+b9a4LcQm6HBuCplBCr+6A10CDxaSgJm3hozFOzO/2NYi5HgnvtwMgyJcMVVFP yHW+Vu83INXeQ2P6fXotM3XNp+AF9rjIY8kuQ0GmM9KSA+Koi16LQmKj3P80v95l+n3g sOW66gaSK15tcLFw36H+j872fd7UffrBYL3zYp2R40J0BhwpzWzsI0v0y8DCZmzriZHq IwsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fqWd3dTsJKny0UrW5ipmpMb5PAQOvNEiSwazaoUZ8Gw=; b=C6Nc+4YC+Xbz20ZpQNbZEeyKCH10764It4z7kzDkuDfBQKSjs0mYl2sVsL/P0ek+KT IsYxHHxlmbatfvFClgd4aog1kQH5y+Uk6kTBINcWa79kESuPa2Xj3nZZIWKTcgu9AocQ XuSyRptwlUqovBakWjXN4JFvXpwGSxLLU6me0qy8TIqvbX8iKaqd2Ey55KwU7EVWNKnG I6vYnKqSQEbwVgTDXKPCGsNrgXbZzoI7KxtFPbNtJmmWkRbNEQYEIEQkjT6nxRtDDXAC 1lT+34EFa+ei7ODo9tFtBYA+zPC+IAvp8pt1DuduTxYfvVmxx8blm7Wj/TpduusyZWlL i/cQ== X-Gm-Message-State: AIVw112hmrOaygh8IDmJme1zRHEVYb2SCGmt9awYrExDLdj/h21E4NVi Xvu2TMMWR8k4k93y4jQ= X-Received: by 10.28.49.7 with SMTP id x7mr15420460wmx.57.1499185347529; Tue, 04 Jul 2017 09:22:27 -0700 (PDT) Received: from cerise.bzh.lan (2a01cb0886107300297010e522b1c364.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:2970:10e5:22b1:c364]) by smtp.gmail.com with ESMTPSA id u187sm3582012wmd.26.2017.07.04.09.22.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 09:22:26 -0700 (PDT) From: Maxime Hadjinlian To: buildroot@buildroot.org Date: Tue, 4 Jul 2017 18:22:10 +0200 Message-Id: <20170704162211.13238-13-maxime.hadjinlian@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170704162211.13238-1-maxime.hadjinlian@gmail.com> References: <20170704162211.13238-1-maxime.hadjinlian@gmail.com> Subject: [Buildroot] [PATCH 12/13] download: add flock call before dl-wrapper X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 --- 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