diff options
author | Fabio Porcedda <fabio.porcedda@gmail.com> | 2015-01-02 16:53:40 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2015-01-04 18:39:46 +0100 |
commit | 0b600227b059695453b737af647747e01b2b522a (patch) | |
tree | 268a6c1631dea0c63d78d0fca8347cbf704f5c68 /support | |
parent | 50c8b7e947765d83da6269fc0568a000088bc971 (diff) | |
download | buildroot-0b600227b059695453b737af647747e01b2b522a.tar.gz buildroot-0b600227b059695453b737af647747e01b2b522a.zip |
pkg-download: silence downloads if make is silent
If doing a silent build (make -s -> QUIET=-q), silence all downloads,
by passing the -q flag downward to backends as well as to check-hash.
Change a printf to use the trace functions.
Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
-rwxr-xr-x | support/download/dl-wrapper | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper index cced8f6a4c..3b30840a0c 100755 --- a/support/download/dl-wrapper +++ b/support/download/dl-wrapper @@ -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,11 +50,11 @@ 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}" - printf "Re-downloading '%s'...\n" "${output##*/}" + warn "Re-downloading '%s'...\n" "${output##*/}" fi # tmpd is a temporary directory in which backends may store intermediate @@ -75,7 +76,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 @@ -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 |