Skip to contentSkip to conversation

Improve silent builds

PATCH New Fabio Porcedda 2 participants 9 messages Dec 30, 2014 – Jan 1, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

v7 cover Improve silent builds

This patch set improves silent builds.

Silent builds are also nice when top-level parallel make is being used to reduce the output clutter.

After this patch set is accepted I will prepare a patch set to convert the other helpers (scp wget hg) to use the quiet flag instead of the environment variable.

The rest of the change logs are in each patch.

v6:
- Remove the patch that renames QUIET to BR_QUIET

Fabio Porcedda (4):
Makefile: improve detection of make "-s" flag
pkg-download: silence check-hash if it is a silent build support/download: silence svn if it is a silent build support/download: silence git if it is a silent build

 Makefile                    |  2 +-
 package/pkg-download.mk     |  8 ++++++++
 support/download/check-hash | 22 ++++++++++++++++++++--
 support/download/dl-wrapper | 15 ++++++++++-----
 support/download/git        | 30 +++++++++++++++++++++++++-----
 support/download/svn        | 20 ++++++++++++++++++--
 6 files changed, 82 insertions(+), 15 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH v7 1/4 Makefile: improve detection of make "-s" flag

Because it's just checked the presence of the "s" character even a
make --warn-undefined-variables
is detected as a silent build so fix this by filtering out long options.

Cc Arnout Vandecappelle <[email protected]>

---

Notes:
v6:
- use QUIET instead of BR_QUIET
v5:
- remove spaces after commas (Yann)
v4:
- split this patch from the patch set to send to muster as bugfix
v2:
- remove spurious space at the beginning of the QUIET variable (Arnout)
v4:
- split this patch from the patch set to send to muster as bugfix
v2:
- remove spurious space at the beginning of the QUIET variable (Arnout)

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index e18a87e..c033620 100644
@@ -303,7 +303,7 @@ GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
 TARGETS :=
 
 # silent mode requested?
-QUIET := $(if $(findstring s,$(MAKEFLAGS)),-q)
+QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
 
 # Strip off the annoying quoting
 ARCH := $(call qstrip,$(BR2_ARCH))
Signature · 1 line
2.1.0
#2 lore raw

PATCH v7 1/4 Makefile: improve detection of make "-s" flag

Fabio, All,

On 2014-12-30 14:58 +0100, Fabio Porcedda spake thusly:

Quoted 6 lines

Because it's just checked the presence of the "s" character even a
make --warn-undefined-variables
is detected as a silent build so fix this by filtering out long options.

Cc Arnout Vandecappelle <[email protected]>

Regards,
Yann E. MORIN.

Quoted 35 lines

---

Notes:
v6:
- use QUIET instead of BR_QUIET
v5:
- remove spaces after commas (Yann)
v4:
- split this patch from the patch set to send to muster as bugfix
v2:
- remove spurious space at the beginning of the QUIET variable (Arnout)
v4:
- split this patch from the patch set to send to muster as bugfix
v2:
- remove spurious space at the beginning of the QUIET variable (Arnout)

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index e18a87e..c033620 100644
@@ -303,7 +303,7 @@ GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
 TARGETS :=
 
 # silent mode requested?
-QUIET := $(if $(findstring s,$(MAKEFLAGS)),-q)
+QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
 
 # Strip off the annoying quoting
 ARCH := $(call qstrip,$(BR2_ARCH))
Signature · 1 line
2.1.0
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v7 2/4 pkg-download: silence check-hash if it is a silent build

In reply to Fabio Porcedda

If it is a silent build (make -s -> QUIET=-q) silence the "check-hash" script.

---

Notes:
v7:
- Add this patch

 package/pkg-download.mk     |  8 ++++++++
 support/download/check-hash | 22 ++++++++++++++++++++--
 support/download/dl-wrapper |  9 +++++----
 3 files changed, 33 insertions(+), 6 deletions(-)
package/pkg-download.mk +8 -0
index ba72fc1..9c782fe 100644
@@ -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) \
@@ -109,6 +110,7 @@ define DOWNLOAD_BZR
 	$(EXTRA_ENV) $(DL_WRAPPER) -b bzr \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
@@ -127,6 +129,7 @@ define DOWNLOAD_CVS
 	$(EXTRA_ENV) $(DL_WRAPPER) -b cvs \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
 		$($(PKG)_DL_VERSION) \
@@ -147,6 +150,7 @@ define DOWNLOAD_SVN
 	$(EXTRA_ENV) $(DL_WRAPPER) -b svn \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
@@ -168,6 +172,7 @@ define DOWNLOAD_SCP
 	$(EXTRA_ENV) $(DL_WRAPPER) -b scp \
 		-o $(DL_DIR)/$(2) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		'$(call stripurischeme,$(call qstrip,$(1)))'
 endef
@@ -185,6 +190,7 @@ define DOWNLOAD_HG
 	$(EXTRA_ENV) $(DL_WRAPPER) -b hg \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
@@ -206,6 +212,7 @@ define DOWNLOAD_WGET
 	$(EXTRA_ENV) $(DL_WRAPPER) -b wget \
 		-o $(DL_DIR)/$(2) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		'$(call qstrip,$(1))'
 endef
@@ -222,6 +229,7 @@ define DOWNLOAD_LOCALFILES
 	$(EXTRA_ENV) $(DL_WRAPPER) -b cp \
 		-o $(DL_DIR)/$(2) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$(call stripurischeme,$(call qstrip,$(1)))
 endef
support/download/check-hash +20 -2
index b59fd2a..82f2e65 100755
@@ -2,7 +2,10 @@
 set -e
 
 # Helper to check a file matches its known hash
-# Call it with:
+#
+# Optional arguments:
+#   "-q": quiet flag
+# Required arguments:
 #   $1: the path of the file containing all the the expected hashes
 #   $2: the full path to the temporary file that was downloaded, and
 #       that is to be checked
@@ -10,6 +13,19 @@ set -e
 #       saved as, to be able to match it to the corresponding hashes
 #       in the .hash file
 
+quiet=
+while getopts "q" opt; do
+    case $opt in
+	q)
+	    quiet=-q
+	    ;;
+	\?)
+	    exit 1
+	    ;;
+    esac
+done
+shift $((OPTIND-1))
+
 h_file="${1}"
 file="${2}"
 base="${3}"
@@ -43,7 +59,9 @@ check_one_hash() {
     # Do the hashes match?
     _hash=$( ${_h}sum "${_file}" |cut -d ' ' -f 1 )
     if [ "${_hash}" = "${_known}" ]; then
-        printf "%s: OK (%s: %s)\n" "${base}" "${_h}" "${_hash}"
+	if [ -z "${quiet}" ]; then
+            printf "%s: OK (%s: %s)\n" "${base}" "${_h}" "${_hash}"
+	fi
         return 0
     fi
 
support/download/dl-wrapper +5 -4
index cced8f6..337fc48 100755
@@ -21,15 +21,16 @@ set -e
 
 main() {
     local OPT OPTARG
-    local backend output hfile
+    local backend output hfile quiet
 
     # Parse our options; anything after '--' is for the backend
-    while getopts :hb:o:H: OPT; do
+    while getopts :hb:o:H:q OPT; do
         case "${OPT}" in
         h)  help; exit 0;;
         b)  backend="${OPTARG}";;
         o)  output="${OPTARG}";;
         H)  hfile="${OPTARG}";;
+        q)  quiet="-q";;
         :)  error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
         \?) error "unknown option '%s'\n" "${OPTARG}";;
         esac
@@ -49,7 +50,7 @@ main() {
 
     # If the output file already exists, do not download it again
     if [ -e "${output}" ]; then
-        if support/download/check-hash "${hfile}" "${output}" "${output##*/}"; then
+        if support/download/check-hash ${quiet} "${hfile}" "${output}" "${output##*/}"; then
             exit 0
         fi
         rm -f "${output}"
@@ -85,7 +86,7 @@ main() {
 
     # Check if the downloaded file is sane, and matches the stored hashes
     # for that file
-    if ! support/download/check-hash "${hfile}" "${tmpf}" "${output##*/}"; then
+    if ! support/download/check-hash ${quiet} "${hfile}" "${tmpf}" "${output##*/}"; then
         rm -rf "${tmpd}"
         exit 1
     fi
Signature · 1 line
2.1.0
#4 lore raw

PATCH v7 2/4 pkg-download: silence check-hash if it is a silent build

Fabio, All,

On 2014-12-30 14:58 +0100, Fabio Porcedda spake thusly:

Quoted 4 lines

If it is a silent build (make -s -> QUIET=-q) silence the "check-hash" script.

[tested by downloading busybox + a toolchain, then tweaking busybox' hash to ensure a failed check was still visible]

Regards,
Yann E. MORIN.

Quoted 170 lines

---

Notes:
v7:
- Add this patch

 package/pkg-download.mk     |  8 ++++++++
 support/download/check-hash | 22 ++++++++++++++++++++--
 support/download/dl-wrapper |  9 +++++----
 3 files changed, 33 insertions(+), 6 deletions(-)
package/pkg-download.mk +8 -0
index ba72fc1..9c782fe 100644
@@ -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) \
@@ -109,6 +110,7 @@ define DOWNLOAD_BZR
 	$(EXTRA_ENV) $(DL_WRAPPER) -b bzr \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
@@ -127,6 +129,7 @@ define DOWNLOAD_CVS
 	$(EXTRA_ENV) $(DL_WRAPPER) -b cvs \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
 		$($(PKG)_DL_VERSION) \
@@ -147,6 +150,7 @@ define DOWNLOAD_SVN
 	$(EXTRA_ENV) $(DL_WRAPPER) -b svn \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
@@ -168,6 +172,7 @@ define DOWNLOAD_SCP
 	$(EXTRA_ENV) $(DL_WRAPPER) -b scp \
 		-o $(DL_DIR)/$(2) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		'$(call stripurischeme,$(call qstrip,$(1)))'
 endef
@@ -185,6 +190,7 @@ define DOWNLOAD_HG
 	$(EXTRA_ENV) $(DL_WRAPPER) -b hg \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
@@ -206,6 +212,7 @@ define DOWNLOAD_WGET
 	$(EXTRA_ENV) $(DL_WRAPPER) -b wget \
 		-o $(DL_DIR)/$(2) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		'$(call qstrip,$(1))'
 endef
@@ -222,6 +229,7 @@ define DOWNLOAD_LOCALFILES
 	$(EXTRA_ENV) $(DL_WRAPPER) -b cp \
 		-o $(DL_DIR)/$(2) \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
+		$(QUIET) \
 		-- \
 		$(call stripurischeme,$(call qstrip,$(1)))
 endef
support/download/check-hash +20 -2
index b59fd2a..82f2e65 100755
@@ -2,7 +2,10 @@
 set -e
 
 # Helper to check a file matches its known hash
-# Call it with:
+#
+# Optional arguments:
+#   "-q": quiet flag
+# Required arguments:
 #   $1: the path of the file containing all the the expected hashes
 #   $2: the full path to the temporary file that was downloaded, and
 #       that is to be checked
@@ -10,6 +13,19 @@ set -e
 #       saved as, to be able to match it to the corresponding hashes
 #       in the .hash file
 
+quiet=
+while getopts "q" opt; do
+    case $opt in
+	q)
+	    quiet=-q
+	    ;;
+	\?)
+	    exit 1
+	    ;;
+    esac
+done
+shift $((OPTIND-1))
+
 h_file="${1}"
 file="${2}"
 base="${3}"
@@ -43,7 +59,9 @@ check_one_hash() {
     # Do the hashes match?
     _hash=$( ${_h}sum "${_file}" |cut -d ' ' -f 1 )
     if [ "${_hash}" = "${_known}" ]; then
-        printf "%s: OK (%s: %s)\n" "${base}" "${_h}" "${_hash}"
+	if [ -z "${quiet}" ]; then
+            printf "%s: OK (%s: %s)\n" "${base}" "${_h}" "${_hash}"
+	fi
         return 0
     fi
 
support/download/dl-wrapper +5 -4
index cced8f6..337fc48 100755
@@ -21,15 +21,16 @@ set -e
 
 main() {
     local OPT OPTARG
-    local backend output hfile
+    local backend output hfile quiet
 
     # Parse our options; anything after '--' is for the backend
-    while getopts :hb:o:H: OPT; do
+    while getopts :hb:o:H:q OPT; do
         case "${OPT}" in
         h)  help; exit 0;;
         b)  backend="${OPTARG}";;
         o)  output="${OPTARG}";;
         H)  hfile="${OPTARG}";;
+        q)  quiet="-q";;
         :)  error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
         \?) error "unknown option '%s'\n" "${OPTARG}";;
         esac
@@ -49,7 +50,7 @@ main() {
 
     # If the output file already exists, do not download it again
     if [ -e "${output}" ]; then
-        if support/download/check-hash "${hfile}" "${output}" "${output##*/}"; then
+        if support/download/check-hash ${quiet} "${hfile}" "${output}" "${output##*/}"; then
             exit 0
         fi
         rm -f "${output}"
@@ -85,7 +86,7 @@ main() {
 
     # Check if the downloaded file is sane, and matches the stored hashes
     # for that file
-    if ! support/download/check-hash "${hfile}" "${tmpf}" "${output##*/}"; then
+    if ! support/download/check-hash ${quiet} "${hfile}" "${tmpf}" "${output##*/}"; then
         rm -rf "${tmpd}"
         exit 1
     fi
Signature · 1 line
2.1.0
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v7 2/4 pkg-download: silence check-hash if it is a silent build

In reply to Fabio Porcedda

Fabio, All,

On 2014-12-30 14:58 +0100, Fabio Porcedda spake thusly:

Quoted 4 lines

If it is a silent build (make -s -> QUIET=-q) silence the "check-hash" script.

Even though I acked it earlier, I missed something... Sorry... :-(

Quoted 8 lines
support/download/check-hash +0 -0
index b59fd2a..82f2e65 100755
@@ -10,6 +13,19 @@ set -e
 #       saved as, to be able to match it to the corresponding hashes
 #       in the .hash file
 

support/download/check-hash set -e · line 25

Quoted 10 lines
support/download/check-hash +10 -0
+quiet=
+while getopts "q" opt; do
+    case $opt in
+	q)
+	    quiet=-q
+	    ;;
+	\?)
+	    exit 1
+	    ;;
+    esac

This script does not use TABs, so do not introduce any.

Quoted 7 lines
support/download/check-hash +3 -0
+done
+shift $((OPTIND-1))
+
 h_file="${1}"
 file="${2}"
 base="${3}"

support/download/check-hash check_one_hash() { · line 64

Quoted 7 lines
support/download/check-hash +3 -1
@@ -43,7 +59,9 @@ check_one_hash() {
     # Do the hashes match?
     _hash=$( ${_h}sum "${_file}" |cut -d ' ' -f 1 )
     if [ "${_hash}" = "${_known}" ]; then
-        printf "%s: OK (%s: %s)\n" "${base}" "${_h}" "${_hash}"
+	if [ -z "${quiet}" ]; then
+            printf "%s: OK (%s: %s)\n" "${base}" "${_h}" "${_hash}"
+	fi

Ditto, do not introduce TABs.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH v7 3/4 support/download: silence svn if it is a silent build

In reply to Fabio Porcedda

If it is a silent build (make -s -> QUIET=-q) silence the svn download helper using "svn -q" just like others download helpers, e.g. wget.

Cc Thomas Petazzoni <[email protected]>
Cc Yann E. MORIN <[email protected]>

---

Notes:
v7:
- use "backend_quiet" instead of "quiet" in the dl-wrapper
v6:
- Use QUIET instead of BR_QUIET
v5:
- Use getopts

v4:
- Instead of changing the "SVN" variable pass the "-q" option to the download helper (Thomas P.)
v3:
- Add this patch

 support/download/dl-wrapper |  8 ++++++--
 support/download/svn        | 20 ++++++++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)
support/download/dl-wrapper +6 -2
index 337fc48..e9002fb 100755
@@ -21,7 +21,7 @@ set -e
 
 main() {
     local OPT OPTARG
-    local backend output hfile quiet
+    local backend output hfile quiet backend_quiet
 
     # Parse our options; anything after '--' is for the backend
     while getopts :hb:o:H:q OPT; do
@@ -48,6 +48,10 @@ main() {
         error "no hash-file specified, use -H\n"
     fi
 
+    if [ "${backend}" == "svn" ]; then
+	backend_quiet=${quiet}
+    fi
+
     # If the output file already exists, do not download it again
     if [ -e "${output}" ]; then
         if support/download/check-hash ${quiet} "${hfile}" "${output}" "${output##*/}"; then
@@ -76,7 +80,7 @@ main() {
     # If the backend fails, we can just remove the temporary directory to
     # remove all the cruft it may have left behind. Then we just exit in
     # error too.
-    if ! "${OLDPWD}/support/download/${backend}" "${tmpf}" "${@}"; then
+    if ! "${OLDPWD}/support/download/${backend}" ${backend_quiet} "${tmpf}" "${@}"; then
         rm -rf "${tmpd}"
         exit 1
     fi
support/download/svn +18 -2
index a960f7d..4873219 100755
@@ -4,7 +4,10 @@
 set -e
 
 # Download helper for svn, to be called from the download wrapper script
-# Expected arguments:
+#
+# Optional arguments:
+#   "-q": quiet flag
+# Required arguments:
 #   $1: output file
 #   $2: svn repo
 #   $3: svn revision
@@ -12,11 +15,24 @@ set -e
 # And this environment:
 #   SVN      : the svn 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}"
 rev="${3}"
 basename="${4}"
 
-${SVN} export "${repo}@${rev}" "${basename}"
+${SVN} ${quiet} export "${repo}@${rev}" "${basename}"
 
 tar czf "${output}" "${basename}"
Signature · 1 line
2.1.0
#7 lore raw

PATCH v7 4/4 support/download: silence git if it is a silent build

In reply to Fabio Porcedda

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.

---

Notes:
Notes:
v7:
- Use "backend_quiet" instead of "quiet" in the dl-wrapper
v6:
- Use QUIET instead of BR_QUIET
v5:
- Use getopts
v3:
- Add this patch

 support/download/dl-wrapper |  2 +-
 support/download/git        | 30 +++++++++++++++++++++++++-----
 2 files changed, 26 insertions(+), 6 deletions(-)
support/download/dl-wrapper +1 -1
index e9002fb..5850a1d 100755
@@ -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
 	backend_quiet=${quiet}
     fi
 
support/download/git +25 -5
index 5d36ca4..f068c63 100755
@@ -4,7 +4,10 @@
 set -e
 
 # Download helper for git, to be called from the download wrapper script
-# Expected arguments:
+#
+# Optional arguments:
+#   "-q": quiet flag
+# Required arguments:
 #   $1: output file
 #   $2: git repo
 #   $3: git cset
@@ -12,6 +15,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 +37,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}" \
Signature · 1 line
2.1.0
#8 lore raw

v7 cover Improve silent builds

In reply to Fabio Porcedda

Fabio, All,

On 2014-12-30 14:58 +0100, Fabio Porcedda spake thusly:

Quoted 1 line

This patch set improves silent builds.

I've sent an updated, my simpler solution:

    http://patchwork.ozlabs.org/patch/424892/
    http://patchwork.ozlabs.org/patch/424893/
Quoted 3 lines

After this patch set is accepted I will prepare a patch set to convert the other helpers (scp wget hg) to use the quiet flag instead of the environment variable.

Well, with this new solution, that will no longer be needed.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'