Skip to contentSkip to conversation

Improve silent builds

PATCH Superseded Fabio Porcedda 1 participant 5 messages Dec 30, 2014 Kbuild

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 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 change logs are also in each patch.

v6:
- Remove the patch that renames QUIET to BR_QUIET

Fabio Porcedda (3):
Makefile: improve detection of make "-s" flag 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     |  2 ++
 support/download/dl-wrapper | 11 ++++++++---
 support/download/git        | 27 +++++++++++++++++++++++----
 support/download/svn        | 17 ++++++++++++++++-
 5 files changed, 50 insertions(+), 9 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH v6 1/3 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]>
---
 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 v6 2/3 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]>
---
 package/pkg-download.mk     |  1 +
 support/download/dl-wrapper | 11 ++++++++---
 support/download/svn        | 17 ++++++++++++++++-
 3 files changed, 25 insertions(+), 4 deletions(-)
package/pkg-download.mk +1 -0
index ba72fc1..88d1437 100644
@@ -147,6 +147,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) \
support/download/dl-wrapper +8 -3
index cced8f6..7cd8606 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
@@ -47,6 +48,10 @@ main() {
         error "no hash-file specified, use -H\n"
     fi
 
+    if [ "${backend}" != "svn" ]; then
+	quiet=
+    fi
+
     # If the output file already exists, do not download it again
     if [ -e "${output}" ]; then
         if support/download/check-hash "${hfile}" "${output}" "${output##*/}"; then
@@ -75,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}" ${quiet} "${tmpf}" "${@}"; then
         rm -rf "${tmpd}"
         exit 1
     fi
support/download/svn +16 -1
index a960f7d..90470dd 100755
@@ -4,6 +4,8 @@
 set -e
 
 # Download helper for svn, to be called from the download wrapper script
+# Optional arguments:
+#   "-q": quiet flag
 # Expected arguments:
 #   $1: output file
 #   $2: svn repo
@@ -12,11 +14,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
#3 lore raw

PATCH v6 3/3 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.

---
 package/pkg-download.mk     |  1 +
 support/download/dl-wrapper |  2 +-
 support/download/git        | 27 +++++++++++++++++++++++----
 3 files changed, 25 insertions(+), 5 deletions(-)
package/pkg-download.mk +1 -0
index 88d1437..37cf4b6 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) \
support/download/dl-wrapper +1 -1
index 7cd8606..e84a757 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
 	quiet=
     fi
 
support/download/git +23 -4
index 5d36ca4..b6ebfdc 100755
@@ -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}" \
Signature · 1 line
2.1.0
#4 lore raw

v6 cover Improve silent builds

In reply to Fabio Porcedda
Quoted 5 lines · Fabio Porcedda

This patch set improves silent builds.

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

Quoted 9 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.

The change logs are also in each patch.

v6:
- Remove the patch that renames QUIET to BR_QUIET

I've sent an updated patch set:
http://lists.busybox.net/pipermail/buildroot/2014-December/116085.html

BR

Signature · 1 line
Fabio Porcedda