From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6C6E7139085 for ; Thu, 22 Dec 2016 01:20:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CAF462241FA; Thu, 22 Dec 2016 01:20:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 99C982241FB for ; Thu, 22 Dec 2016 01:20:21 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A51CD34121E for ; Thu, 22 Dec 2016 01:20:20 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EB4F824E5 for ; Thu, 22 Dec 2016 01:20:18 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1482369603.e8186ef489fa1d36d3c8116cb294ff8faf01ac55.vapier@gentoo> Subject: [gentoo-commits] proj/releng:master commit in: tools/ X-VCS-Repository: proj/releng X-VCS-Files: tools/catalyst-auto X-VCS-Directories: tools/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: e8186ef489fa1d36d3c8116cb294ff8faf01ac55 X-VCS-Branch: master Date: Thu, 22 Dec 2016 01:20:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 82fbc493-15e7-4bc0-b76f-88defc640343 X-Archives-Hash: ea065987db6bab81aaf63db96fbd5023 commit: e8186ef489fa1d36d3c8116cb294ff8faf01ac55 Author: Mike Frysinger gentoo org> AuthorDate: Fri Dec 9 04:51:29 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu Dec 22 01:20:03 2016 +0000 URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=e8186ef4 catalyst-auto: rework run_cmd pass through Make the logfile the first arg so the rest of the args are the command to actually run. This allows us to properly quote arguments. tools/catalyst-auto | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tools/catalyst-auto b/tools/catalyst-auto index 793e0c6..ad4a95a 100755 --- a/tools/catalyst-auto +++ b/tools/catalyst-auto @@ -71,15 +71,16 @@ send_email() { /usr/sbin/sendmail -f "${EMAIL_FROM}" ${EMAIL_TO//,/ } } +# Usage: run_cmd run_cmd() { - local cmd=$1 - local logfile=$2 + local logfile="$1" + shift if [ $verbose = 1 ]; then - echo "*** Running command: ${cmd}" - ${cmd} 2>&1 | tee "${logfile}" + echo "*** Running command: $*" + "$@" 2>&1 | tee "${logfile}" else - ${cmd} &> "${logfile}" + "$@" &> "${logfile}" fi } @@ -220,7 +221,7 @@ if ! mkdir -p "${TMPDIR}"/{specs,kconfig,log}; then exit 1 fi -if ! run_cmd "pre_build" "${TMPDIR}/log/pre_build.log"; then +if ! run_cmd "${TMPDIR}/log/pre_build.log" pre_build; then send_email "Catalyst build error - pre_build" "The pre_build function failed" "${TMPDIR}/log/pre_build.log" exit 1 fi @@ -299,15 +300,15 @@ if [[ ${preclean} -eq 1 ]]; then fi # Create snapshot -if ! run_cmd "catalyst -c ${CATALYST_CONFIG} -s ${DATESTAMP}" "${TMPDIR}/log/snapshot.log"; then +if ! run_cmd "${TMPDIR}/log/snapshot.log" catalyst -c "${CATALYST_CONFIG}" -s "${DATESTAMP}"; then send_email "Catalyst build error - snapshot" "" "${TMPDIR}/log/snapshot.log" exit 1 fi build_failure=0 -timeprefix="" -which time >/dev/null && timeprefix="time" +timeprefix=() +which time >/dev/null && timeprefix=( "time" ) for a in "" ${SETS}; do if [ -z "${a}" ]; then @@ -320,7 +321,7 @@ for a in "" ${SETS}; do for i in ${!specs_var}; do LOGFILE="${TMPDIR}/log/$(echo "${i}" | sed -e 's:/:_:' -e 's:\.spec$::').log" - run_cmd "${timeprefix} catalyst -a -p -c ${CATALYST_CONFIG} -f ${i}" "${LOGFILE}" + run_cmd "${LOGFILE}" "${timeprefix[@]}" catalyst -a -p -c "${CATALYST_CONFIG}" -f "${i}" if [ $? != 0 ]; then build_failure=1 send_email "Catalyst fatal build error - ${i}" "" "${LOGFILE}" @@ -330,7 +331,7 @@ for a in "" ${SETS}; do for i in ${!optional_specs_var}; do LOGFILE="${TMPDIR}/log/$(echo "${i}" | sed -e 's:/:_:' -e 's:\.spec$::').log" - run_cmd "${timeprefix} catalyst -a -p -c ${CATALYST_CONFIG} -f ${i}" "${LOGFILE}" + run_cmd "${LOGFILE}" "${timeprefix[@]}" catalyst -a -p -c "${CATALYST_CONFIG}" -f "${i}" if [ $? != 0 ]; then build_failure=1 send_email "Catalyst non-fatal build error - ${i}" "" "${LOGFILE}" @@ -340,13 +341,13 @@ for a in "" ${SETS}; do for i in ${!specs_var} ${!optional_specs_var}; do LOGFILE="${TMPDIR}/log/$(echo "${i}" | sed -e 's:/:_:' -e 's:\.spec$::')_purge.log" - run_cmd "${timeprefix} catalyst -P -c ${CATALYST_CONFIG} -f ${i}" "${LOGFILE}" + run_cmd "${LOGFILE}" "${timeprefix[@]}" catalyst -P -c "${CATALYST_CONFIG}" -f "${i}" done update_symlinks done -if ! run_cmd "post_build" "${TMPDIR}/log/post_build.log"; then +if ! run_cmd "${TMPDIR}/log/post_build.log" post_build; then send_email "Catalyst build error - post_build" "The post_build function failed" "${TMPDIR}/log/post_build.log" exit 1 fi