From patchwork Wed Oct 25 20:10:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 830367 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMh8q4FPpz9t4V for ; Thu, 26 Oct 2017 07:10:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5E2B888DA9; Wed, 25 Oct 2017 20:10:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nrcb1t5iZggq; Wed, 25 Oct 2017 20:10:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 7BCC488E33; Wed, 25 Oct 2017 20:10:41 +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 D7AF61C4386 for ; Wed, 25 Oct 2017 20:10:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3AEBF87FFA for ; Wed, 25 Oct 2017 20:10:12 +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 AyfstQ0lsufJ for ; Wed, 25 Oct 2017 20:10:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 1233887FF5 for ; Wed, 25 Oct 2017 20:10:09 +0000 (UTC) Received: from localhost.localdomain ([188.99.114.251]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MFtf4-1dvsU51394-00EwhR; Wed, 25 Oct 2017 22:10:07 +0200 From: Peter Seiderer To: buildroot@buildroot.org Date: Wed, 25 Oct 2017 22:10:01 +0200 Message-Id: <20171025201003.16105-12-ps.report@gmx.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171025201003.16105-1-ps.report@gmx.net> References: <20171025201003.16105-1-ps.report@gmx.net> X-Provags-ID: V03:K0:/QImg4Yq08h+FWcJSn0FIpr/djFen8cvnGzqTuEGvsI9m9xF8Hx wUuIbzC+Zz/k8xSQdk2O61D+B1BVsHYxWrzxnJ4tdJcARi0RV07MG5wTm3jLTwVJvxz5wO8 9tO8mjw+QT5qWG/AdJsMiCpTG7/X7rpff4JIb8y4W3UjnWqNICVH/po/8U+Ary6vVOc23xU rBJRl9HV+wZY1BjDddHSQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:xkX2g1qULMM=:ilPXRbZs1TgJOIv0XNfnSp g1ier5oHwb8tS8ZcaF9v8fg+XDSncPpRciNhOpuhnKwDR9P+7pw6CgdCxLIJ4zd38hEFwBDbV 5lUD3AvwQINKxXRhKjkaXZGHlShCI6N/Oui2vodYkwprxqVZMzMjzvurn1p0SpizM0X66cfuT 96WB2ppJwFVoRXGf77MOjD1dnkTrll2FGdQ3YlYXAAweL1UEqJfB1A/S4Sa14O/YwM1iJfJth hFJ646q0dbgKDXsyXl1I00E41+9Wdfx1kwkYqgeb2X+gVA5es22FNigHsrqe2BpmteNduabqq krjzJPUWCfJNPX11YhsqHFIP6zvVa5No0ItoHIVfWGyc7GehrGKe4UlZHlhBG11piff1agfNn /72SA1AWjji7SnhLrS4b/5wzUWFx6NjdGcoHec79cOSfXHoChZM/0TG6K7PrZ5GuiYHfvQ5VA y2zLyMTAKofVFiNXOiqeJPs1S6yEKRx3KYDYPpkC1UtqNTPxBMpbl2UrQobgj11koTgrwK/Zi UgGxj4B9YqIEkAEMY5jUQW6jWOjpfRDv7wRx0gmOksOWKvnhZSwQ/ryXCw/IQO+L9YC4taDcb 9QPLigrGWmbDQFL+o+aOeX1ZleGTmbl189b4lrNrJi7pzgeWfK6ChdryYk1tlf9ocP+fa26rz DGhQeBOvsk9yOhgzycVHF5if7VoWZZ5t251fXvSOqwqfmlvbh2nCTGN1eXi2HhMSIXjKsDyes 608SYDBL6sJ2Qxg1xLOJKNe7nLk8fhRXRaInFx2IXq3PO3pUFQmtk+dB5ICudUh+OnO5EnG4o s7nV3WvyUGQK4PM9HodyLOEhhBl0Q== Cc: Maxime Hadjinlian Subject: [Buildroot] [PATCH v2 11/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" From: Maxime Hadjinlian 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 --- Changes v1 --> v2: - from https://github.com/maximeh/buildroot/commit/2f4cd2529b0681eb673b3d1a5cb7801cd55122a9.patch --- 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 b76d0ec289..307c415f64 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)),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 49caf3717b..67e9742767 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