Improve silent builds
v5 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 in each patch.
Fabio Porcedda (4):
Rename the variable "QUIET" to "BR_QUIET" for conformance
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/Makefile.in | 2 +- package/berkeleydb/berkeleydb.mk | 2 +- package/gcc/gcc-final/gcc-final.mk | 2 +- package/pkg-autotools.mk | 4 ++-- package/pkg-download.mk | 10 ++++++---- support/download/dl-wrapper | 11 ++++++++--- support/download/git | 27 +++++++++++++++++++++++---- support/download/svn | 17 ++++++++++++++++- 9 files changed, 59 insertions(+), 18 deletions(-)
Signature · 1 line
2.2.1
PATCH v5 1/4 Rename the variable "QUIET" to "BR_QUIET" for conformance
Rename the variable "QUIET" to "BR_QUIET" accordingly to the convention that internal variables should be named BR_XXX.
---
Notes:
v5:
- add this patch (Yann)
Makefile | 2 +- package/Makefile.in | 2 +- package/berkeleydb/berkeleydb.mk | 2 +- package/gcc/gcc-final/gcc-final.mk | 2 +- package/pkg-autotools.mk | 4 ++-- package/pkg-download.mk | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-)
Makefile +1 -1
@@ -303,7 +303,7 @@ GNU_HOST_NAME := $(shell support/gnuconfig/config.guess) TARGETS := # silent mode requested? -QUIET := $(if $(findstring s,$(MAKEFLAGS)),-q) +BR_QUIET := $(if $(findstring s,$(MAKEFLAGS)),-q) # Strip off the annoying quoting ARCH := $(call qstrip,$(BR2_ARCH))
package/Makefile.in +1 -1
@@ -223,7 +223,7 @@ BISON := $(shell which bison || type -p bison) SED := $(shell which sed || type -p sed) -i -e UNZIP := $(shell which unzip || type -p unzip) -q -APPLY_PATCHES = support/scripts/apply-patches.sh $(if $(QUIET),-s) +APPLY_PATCHES = support/scripts/apply-patches.sh $(if $(BR_QUIET),-s) HOST_CPPFLAGS = -I$(HOST_DIR)/usr/include HOST_CFLAGS ?= -O2
package/berkeleydb/berkeleydb.mk +1 -1
@@ -25,7 +25,7 @@ define BERKELEYDB_CONFIGURE_CMDS (cd $(@D)/build_unix; rm -rf config.cache; \ $(TARGET_CONFIGURE_OPTS) \ $(TARGET_CONFIGURE_ARGS) \ - ../dist/configure $(QUIET) \ + ../dist/configure $(BR_QUIET) \ --target=$(GNU_TARGET_NAME) \ --host=$(GNU_TARGET_NAME) \ --build=$(GNU_HOST_NAME) \
package/gcc/gcc-final/gcc-final.mk +1 -1
@@ -36,7 +36,7 @@ define HOST_GCC_FINAL_CONFIGURE_CMDS --prefix="$(HOST_DIR)/usr" \ --sysconfdir="$(HOST_DIR)/etc" \ --enable-static \ - $(QUIET) $(HOST_GCC_FINAL_CONF_OPTS) \ + $(BR_QUIET) $(HOST_GCC_FINAL_CONF_OPTS) \ ) endef
package/pkg-autotools.mk +2 -2
@@ -204,7 +204,7 @@ define $(2)_CONFIGURE_CMDS $$(DISABLE_IPV6) \ $$(ENABLE_DEBUG) \ $$(SHARED_STATIC_LIBS_OPTS) \ - $$(QUIET) $$($$(PKG)_CONF_OPTS) \ + $$(BR_QUIET) $$($$(PKG)_CONF_OPTS) \ ) endef else
@@ -233,7 +233,7 @@ define $(2)_CONFIGURE_CMDS --with-xmlto=no \ --with-fop=no \ --disable-dependency-tracking \ - $$(QUIET) $$($$(PKG)_CONF_OPTS) \ + $$(BR_QUIET) $$($$(PKG)_CONF_OPTS) \ ) endef endif
package/pkg-download.mk +4 -4
@@ -8,14 +8,14 @@ ################################################################################ # Download method commands -export WGET := $(call qstrip,$(BR2_WGET)) $(QUIET) +export WGET := $(call qstrip,$(BR2_WGET)) $(BR_QUIET) export SVN := $(call qstrip,$(BR2_SVN)) export CVS := $(call qstrip,$(BR2_CVS)) export BZR := $(call qstrip,$(BR2_BZR)) export GIT := $(call qstrip,$(BR2_GIT)) -export HG := $(call qstrip,$(BR2_HG)) $(QUIET) -export SCP := $(call qstrip,$(BR2_SCP)) $(QUIET) -SSH := $(call qstrip,$(BR2_SSH)) $(QUIET) +export HG := $(call qstrip,$(BR2_HG)) $(BR_QUIET) +export SCP := $(call qstrip,$(BR2_SCP)) $(BR_QUIET) +SSH := $(call qstrip,$(BR2_SSH)) $(BR_QUIET) export LOCALFILES := $(call qstrip,$(BR2_LOCALFILES)) DL_WRAPPER = support/download/dl-wrapper
Signature · 1 line
2.2.1
PATCH v5 1/4 Rename the variable "QUIET" to "BR_QUIET" for conformance
Hello,
Quoted 4 lines · Fabio Porcedda
Rename the variable "QUIET" to "
BR_QUIET" accordingly to the convention that internal variables should be namedBR_XXX.Signed-off-by Fabio Porcedda <[email protected]>
Do we really want all internal variables to be named BR_* ? Like HOST_CONFIGURE_OPTS, TARGET_CONFIGURE_OPTS, TARGET_MAKE_ENV and al. ? I'm not sure we want to do this, do we?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v5 1/4 Rename the variable "QUIET" to "BR_QUIET" for conformance
Quoted 11 lines · Thomas Petazzoni
Hello,
Quoted 4 lines · Fabio Porcedda
Rename the variable "QUIET" to "
BR_QUIET" accordingly to the convention that internal variables should be namedBR_XXX.Signed-off-by Fabio Porcedda <[email protected]>Do we really want all internal variables to be named BR_* ? Like
HOST_CONFIGURE_OPTS,TARGET_CONFIGURE_OPTS,TARGET_MAKE_ENVand al. ? I'm not sure we want to do this, do we?
On Wed, Nov 26, 2014 at 10:35 PM, Yann E. MORIN <[email protected]> wrote:
<snip>
Quoted 4 lines
Also, in retrospect, QUIET was not a really good name for this variable in the
Makefile. It would have been better if it were namedBR_QUIET. But that was introduced way before we decided on a variable naming convention... :-/
So which naming conventions Yann was referring?
BR
Signature · 1 line
Fabio Porcedda
PATCH v5 1/4 Rename the variable "QUIET" to "BR_QUIET" for conformance
Quoted 14 lines · Fabio Porcedda
Quoted 11 lines · Thomas Petazzoni
Hello,
Quoted 4 lines · Fabio Porcedda
Rename the variable "QUIET" to "
BR_QUIET" accordingly to the convention that internal variables should be namedBR_XXX.Signed-off-by Fabio Porcedda <[email protected]>Do we really want all internal variables to be named BR_* ? Like
HOST_CONFIGURE_OPTS,TARGET_CONFIGURE_OPTS,TARGET_MAKE_ENVand al. ? I'm not sure we want to do this, do we?
Quoted 8 lines
On Wed, Nov 26, 2014 at 10:35 PM, Yann E. MORIN <[email protected]> wrote:
<snip>Quoted 4 lines
Also, in retrospect, QUIET was not a really good name for this variable in the
Makefile. It would have been better if it were namedBR_QUIET. But that was introduced way before we decided on a variable naming convention... :-/So which naming conventions Yann was referring?
Hi Yann,
Can you please explain further your opinion?
BR
Signature · 1 line
Fabio Porcedda
PATCH v5 1/4 Rename the variable "QUIET" to "BR_QUIET" for conformance
Fabio, All,
On 2014-12-28 17:24 +0100, Fabio Porcedda spake thusly:
Quoted 23 lines
Quoted 21 lines · Fabio Porcedda
Quoted 11 lines · Thomas Petazzoni
Hello,
Quoted 4 lines · Fabio Porcedda
Rename the variable "QUIET" to "
BR_QUIET" accordingly to the convention that internal variables should be namedBR_XXX.Signed-off-by Fabio Porcedda <[email protected]>Do we really want all internal variables to be named BR_* ? Like
HOST_CONFIGURE_OPTS,TARGET_CONFIGURE_OPTS,TARGET_MAKE_ENVand al. ? I'm not sure we want to do this, do we?On Wed, Nov 26, 2014 at 10:35 PM, Yann E. MORIN <[email protected]> wrote:
<snip>Quoted 4 lines
Also, in retrospect, QUIET was not a really good name for this variable in the
Makefile. It would have been better if it were namedBR_QUIET. But that was introduced way before we decided on a variable naming convention... :-/
Quoted 4 lines
Quoted 1 line
So which naming conventions Yann was referring?
Hi Yann,
Can you please explain further your opinion?
Oh, sorry, it seems I was not explicit enough in my mail...
What I said was "QUIET was not a really good name [...] that was introduced way before we decided on a variable naming convention..."
I did not want to make it sound like we should rename it, sorry.
I agree with Thomas here: we should keep QUIET as-is.
Sorry, sorry for the confusion... :-(
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. | '------------------------------^-------^------------------^--------------------'
PATCH v5 1/4 Rename the variable "QUIET" to "BR_QUIET" for conformance
Quoted 33 lines · Yann E. MORIN
Fabio, All,
On 2014-12-28 17:24 +0100, Fabio Porcedda spake thusly:
Quoted 23 lines
Quoted 21 lines · Fabio Porcedda
Quoted 11 lines · Thomas Petazzoni
Hello,
Quoted 4 lines · Fabio Porcedda
Rename the variable "QUIET" to "
BR_QUIET" accordingly to the convention that internal variables should be namedBR_XXX.Signed-off-by Fabio Porcedda <[email protected]>Do we really want all internal variables to be named BR_* ? Like
HOST_CONFIGURE_OPTS,TARGET_CONFIGURE_OPTS,TARGET_MAKE_ENVand al. ? I'm not sure we want to do this, do we?On Wed, Nov 26, 2014 at 10:35 PM, Yann E. MORIN <[email protected]> wrote:
<snip>Quoted 4 lines
Also, in retrospect, QUIET was not a really good name for this variable in the
Makefile. It would have been better if it were namedBR_QUIET. But that was introduced way before we decided on a variable naming convention... :-/Quoted 4 lines
Quoted 1 line
So which naming conventions Yann was referring?
Hi Yann,
Can you please explain further your opinion?Oh, sorry, it seems I was not explicit enough in my mail...
Quoted 8 lines
What I said was "QUIET was not a really good name [...] that was introduced way before we decided on a variable naming convention..."
I did not want to make it sound like we should rename it, sorry.
I agree with Thomas here: we should keep QUIET as-is.
Sorry, sorry for the confusion... :-(
Ok, I will sent an updated patch set without the renaming patch.
BR
Signature · 1 line
Fabio Porcedda
PATCH v5 1/4 Rename the variable "QUIET" to "BR_QUIET" for conformance
Quoted 37 lines · Fabio Porcedda
Quoted 36 lines · Yann E. MORIN
Fabio, All,
On 2014-12-28 17:24 +0100, Fabio Porcedda spake thusly:
Quoted 23 lines
Quoted 21 lines · Fabio Porcedda
Quoted 11 lines · Thomas Petazzoni
Hello,
Quoted 4 lines · Fabio Porcedda
Rename the variable "QUIET" to "
BR_QUIET" accordingly to the convention that internal variables should be namedBR_XXX.Signed-off-by Fabio Porcedda <[email protected]>Do we really want all internal variables to be named BR_* ? Like
HOST_CONFIGURE_OPTS,TARGET_CONFIGURE_OPTS,TARGET_MAKE_ENVand al. ? I'm not sure we want to do this, do we?On Wed, Nov 26, 2014 at 10:35 PM, Yann E. MORIN <[email protected]> wrote:
<snip>Quoted 4 lines
Also, in retrospect, QUIET was not a really good name for this variable in the
Makefile. It would have been better if it were namedBR_QUIET. But that was introduced way before we decided on a variable naming convention... :-/Quoted 4 lines
Quoted 1 line
So which naming conventions Yann was referring?
Hi Yann,
Can you please explain further your opinion?Oh, sorry, it seems I was not explicit enough in my mail...
What I said was "QUIET was not a really good name [...] that was introduced way before we decided on a variable naming convention..."
Quoted 7 lines
Quoted 5 lines
I did not want to make it sound like we should rename it, sorry.
I agree with Thomas here: we should keep QUIET as-is.
Sorry, sorry for the confusion... :-(
Ok, I will sent an updated patch set without the renaming patch.
I've sent an updated patch set:
http://lists.busybox.net/pipermail/buildroot/2014-December/116079.html
BR
Signature · 1 line
Fabio Porcedda
PATCH v5 2/4 Makefile: improve detection of make "-s" flag
In reply to Fabio PorceddaBecause 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.
---
Notes:
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
@@ -303,7 +303,7 @@ GNU_HOST_NAME := $(shell support/gnuconfig/config.guess) TARGETS := # silent mode requested? -BR_QUIET := $(if $(findstring s,$(MAKEFLAGS)),-q) +BR_QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q) # Strip off the annoying quoting ARCH := $(call qstrip,$(BR2_ARCH))
Signature · 1 line
2.2.1
PATCH v5 3/4 support/download: silence svn if it is a silent build
In reply to Fabio PorceddaIf it is a silent build (make -s -> BR_QUIET=-q) silence the svn download helper using "svn -q" just like others download helpers, e.g. wget.
---
Notes:
v5:
- use getopts
v4:
- instead of changing the "SVN" variable pass the "-q" option to the download helper (Thomas P.)
v3:
- add this patch
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
@@ -147,6 +147,7 @@ define DOWNLOAD_SVN $(EXTRA_ENV) $(DL_WRAPPER) -b svn \ -o $(DL_DIR)/$($(PKG)_SOURCE) \ -H $(PKGDIR)/$($(PKG)_RAWNAME).hash \ + $(BR_QUIET) \ -- \ $($(PKG)_SITE) \ $($(PKG)_DL_VERSION) \
support/download/dl-wrapper +8 -3
@@ -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
@@ -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.2.1
PATCH v5 4/4 support/download: silence git if it is a silent build
In reply to Fabio PorceddaIf it is a silent build (make -s -> BR_QUIET=-q) silence the git download helper using "git clone -q" just like others download helpers, e.g. wget.
---
Notes:
v5:
- use getopts
v3:
- add this patch
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
@@ -88,6 +88,7 @@ define DOWNLOAD_GIT $(EXTRA_ENV) $(DL_WRAPPER) -b git \ -o $(DL_DIR)/$($(PKG)_SOURCE) \ -H $(PKGDIR)/$($(PKG)_RAWNAME).hash \ + $(BR_QUIET) \ -- \ $($(PKG)_SITE) \ $($(PKG)_DL_VERSION) \
support/download/dl-wrapper +1 -1
@@ -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
@@ -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.2.1