From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Date: Wed, 9 Jul 2014 10:11:26 +0200 From: Alexander Aring Message-ID: <20140709081124.GC11028@omega> References: <1404830025-22351-1-git-send-email-alex.aring@gmail.com> <53BC03E9.301@pengutronix.de> <20140709072036.GA4423@omega> <53BCEFFE.4080505@pengutronix.de> <20140709080318.GB11028@omega> <53BCF7B3.5030403@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <53BCF7B3.5030403@pengutronix.de> Subject: Re: [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: Marc Kleine-Budde Cc: ptxdist@pengutronix.de On Wed, Jul 09, 2014 at 10:05:07AM +0200, Marc Kleine-Budde wrote: > On 07/09/2014 10:03 AM, Alexander Aring wrote: > > On Wed, Jul 09, 2014 at 09:32:14AM +0200, Marc Kleine-Budde wrote: > >> On 07/09/2014 09:20 AM, Alexander Aring wrote: > >>> On Tue, Jul 08, 2014 at 04:44:57PM +0200, Marc Kleine-Budde wrote: > >>>> On 07/08/2014 04:33 PM, Alexander Aring wrote: > >>>>> This patch adds error handling for the ptxd_make_dts_dtb function. > >>>>> > >>>>> Signed-off-by: Alexander Aring > >>>>> --- > >>>>> scripts/lib/ptxd_make_dts_dtc.sh | 14 ++++++++------ > >>>>> 1 file changed, 8 insertions(+), 6 deletions(-) > >>>>> > >>>>> diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh > >>>>> index 24c5604..46eaa9d 100644 > >>>>> --- a/scripts/lib/ptxd_make_dts_dtc.sh > >>>>> +++ b/scripts/lib/ptxd_make_dts_dtc.sh > >>>>> @@ -29,7 +29,7 @@ ptxd_make_dts_dtb() { > >>>>> deps="${ptx_state_dir}/dtc.$(basename "${dts}").deps" > >>>>> tmp_deps="${PTXDIST_TEMPDIR}/dts.deps" > >>>>> > >>>>> - echo "CPP $(ptxd_print_path "${tmp_dts}")" > >>>>> + echo "CPP $(ptxd_print_path "${tmp_dts}")" && > >>>>> cpp \ > >>>>> -Wp,-MD,${tmp_deps} \ > >>>>> -Wp,-MT,${tmp_dts} \ > >>>>> @@ -42,22 +42,22 @@ ptxd_make_dts_dtb() { > >>>>> -I${dts_kernel_dir}/include \ > >>>>> -undef -D__DTS__ -x assembler-with-cpp \ > >>>>> -o ${tmp_dts} \ > >>>>> - ${dts} > >>>>> + ${dts} && > >>>>> > >>>>> sed -e "s;^${tmp_dts}:;${dts_dtb}:;" \ > >>>>> - -e 's;^ \([^ ]*\); $(wildcard \1);' "${tmp_deps}" > "${deps}" > >>>>> + -e 's;^ \([^ ]*\); $(wildcard \1);' "${tmp_deps}" > "${deps}" && > >>>>> > >>>>> if dtc -h 2>&1 | grep -q '^[[:space:]]\+-i\(,.*\)\?$'; then > >>>>> dtc_include="-i $(dirname "${dts}") -i ${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts" > >>>>> fi > >>>> > >>>> ^^^ > >>>> I think a && is missing here. > >>>> > >>> I tought that too, because the dirname call. But when I insert a && > >> > >> It's not only about the dirname call, the && is needed, so that the || > >> bailout will kick in. > >> > >>> there I get: > >>> > >>> ../scripts/lib/ptxd_make_dts_dtc.sh: line 53: syntax error near unexpected token `&&' > >>> ../scripts/lib/ptxd_make_dts_dtc.sh: line 53: ` &&' > >>> ptxdist: error: failed to source lib: ..scripts/lib/ptxd_make_dts_dtc.sh > >> > > > > I tested: > > > > if dtc -h 2>&1 | grep -q '^[[:space:]]\+-i\(,.*\)\?$'; then > > dtc_include="-i $(dirname "${dts}") -i ${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts" > > fi > > && > > > > and > > > > if dtc -h 2>&1 | grep -q '^[[:space:]]\+-i\(,.*\)\?$'; then > > dtc_include="-i $(dirname "${dts}") -i ${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts" > > && > > fi > > > > ... > > > > vi show me at the last one that's a syntax mismatch. > > What about: > > >> if dtc -h 2>&1 | grep -q '^[[:space:]]\+-i\(,.*\)\?$'; then > >> dtc_include="-i $(dirname "${dts}") -i ${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts" > >> fi && > that works. Now I remember it, sometimes I do: while true do foo done | bar Which is similar for "&&" and "|". Thanks Marc. - Alex -- ptxdist mailing list ptxdist@pengutronix.de