From patchwork Tue Dec 30 11:41:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Porcedda X-Patchwork-Id: 424623 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 828F7140119 for ; Tue, 30 Dec 2014 22:41:29 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B5C4D2F9D9; Tue, 30 Dec 2014 11:41:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T35L19Ul-XDr; Tue, 30 Dec 2014 11:41:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 5638330649; Tue, 30 Dec 2014 11:41:24 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 6632D1C1081 for ; Tue, 30 Dec 2014 11:41:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5F227852C8 for ; Tue, 30 Dec 2014 11:41:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4vXNggS5X8oH for ; Tue, 30 Dec 2014 11:41:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by hemlock.osuosl.org (Postfix) with ESMTPS id 85C04851E0 for ; Tue, 30 Dec 2014 11:41:17 +0000 (UTC) Received: by mail-we0-f177.google.com with SMTP id q59so882389wes.36 for ; Tue, 30 Dec 2014 03:41:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OFP1s6n0xfe/sc7GAYaPP0+b6o53d9AGeokKs4cYjjY=; b=UKhPU3VOQwDarjsTN4hQolUkFYZkmDOrmMpPA3pgODGa1RqXtUW9WSgXN2wtzQte0i BHILmwkVwOR+N2sCwZ/T3hvmAasnmhF0hvUwK9KqFEuMT97DU4NIB2Bb3afvO9BVwcnu RerWKtOo/o9UdzlETouctGoTIRI4yINI3/VDeZa69m7Bej0cmOoX4pyrpwM/oxAPl2Z7 RFLeVnMgqw97ePi9EYv8RBcY26yMco3Ke/9MRoaR2LOMQRCRYitwb2Zx+pz1jul7/oFW 6A8DXWaQ3wm8YovJ48bD6NhSdEYYLTgBbHAYd67awwIkTR7rSwRON3OjDMR2eO6ycJp/ VhGg== X-Received: by 10.194.58.37 with SMTP id n5mr122353086wjq.14.1419939675892; Tue, 30 Dec 2014 03:41:15 -0800 (PST) Received: from mobeast.localdomain (dynamic-adsl-84-221-153-137.clienti.tiscali.it. [84.221.153.137]) by mx.google.com with ESMTPSA id cs8sm43118763wib.1.2014.12.30.03.41.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Dec 2014 03:41:15 -0800 (PST) From: Fabio Porcedda To: buildroot@uclibc.org Date: Tue, 30 Dec 2014 12:41:07 +0100 Message-Id: <1419939667-27095-4-git-send-email-fabio.porcedda@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1419939667-27095-1-git-send-email-fabio.porcedda@gmail.com> References: <1419939667-27095-1-git-send-email-fabio.porcedda@gmail.com> Cc: Thomas Petazzoni , "Yann E. MORIN" Subject: [Buildroot] [PATCH v6 3/3] support/download: silence git if it is a silent build 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" If it is a silent build (make -s -> QUIET=-q) silence the git download helper using "git clone -q" just like others download helpers, e.g. wget. Signed-off-by: Fabio Porcedda --- package/pkg-download.mk | 1 + support/download/dl-wrapper | 2 +- support/download/git | 27 +++++++++++++++++++++++---- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/package/pkg-download.mk b/package/pkg-download.mk index 88d1437..37cf4b6 100644 --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -88,6 +88,7 @@ define DOWNLOAD_GIT $(EXTRA_ENV) $(DL_WRAPPER) -b git \ -o $(DL_DIR)/$($(PKG)_SOURCE) \ -H $(PKGDIR)/$($(PKG)_RAWNAME).hash \ + $(QUIET) \ -- \ $($(PKG)_SITE) \ $($(PKG)_DL_VERSION) \ diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper index 7cd8606..e84a757 100755 --- a/support/download/dl-wrapper +++ b/support/download/dl-wrapper @@ -48,7 +48,7 @@ main() { error "no hash-file specified, use -H\n" fi - if [ "${backend}" != "svn" ]; then + if [ ! \( "${backend}" == "git" -o "${backend}" == "svn" \) ]; then quiet= fi diff --git a/support/download/git b/support/download/git index 5d36ca4..b6ebfdc 100755 --- a/support/download/git +++ b/support/download/git @@ -4,6 +4,8 @@ set -e # Download helper for git, to be called from the download wrapper script +# Optional arguments: +# "-q": quiet flag # Expected arguments: # $1: output file # $2: git repo @@ -12,6 +14,19 @@ set -e # And this environment: # GIT : the git command to call +quiet= +while getopts "q" opt; do + case $opt in + q) + quiet=-q + ;; + \?) + exit 1 + ;; + esac +done +shift $((OPTIND-1)) + output="${1}" repo="${2}" cset="${3}" @@ -21,16 +36,20 @@ basename="${4}" # than a full clone. git_done=0 if [ -n "$(${GIT} ls-remote "${repo}" "${cset}" 2>&1)" ]; then - printf "Doing shallow clone\n" - if ${GIT} clone --depth 1 -b "${cset}" --bare "${repo}" "${basename}"; then + if [ -z "${quiet}" ]; then + printf "Doing shallow clone\n"; + fi + if ${GIT} clone ${quiet} --depth 1 -b "${cset}" --bare "${repo}" "${basename}"; then git_done=1 else printf "Shallow clone failed, falling back to doing a full clone\n" fi fi if [ ${git_done} -eq 0 ]; then - printf "Doing full clone\n" - ${GIT} clone --bare "${repo}" "${basename}" + if [ -z "${quiet}" ]; then + printf "Doing full clone\n"; + fi + ${GIT} clone ${quiet} --bare "${repo}" "${basename}" fi GIT_DIR="${basename}" \