From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1X4Vj7-0007ND-Bf for ptxdist@pengutronix.de; Tue, 08 Jul 2014 15:46:34 +0200 Received: by mail-wi0-f175.google.com with SMTP id ho1so1030339wib.8 for ; Tue, 08 Jul 2014 06:46:26 -0700 (PDT) Received: from omega (p20030064A9383D77E2CB4EFFFE1BB546.dip0.t-ipconnect.de. [2003:64:a938:3d77:e2cb:4eff:fe1b:b546]) by mx.google.com with ESMTPSA id l2sm52738648wjw.31.2014.07.08.06.46.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2014 06:46:26 -0700 (PDT) Date: Tue, 8 Jul 2014 15:46:21 +0200 From: Alexander Aring Message-ID: <20140708134619.GA8389@omega> References: <1404824365-7638-1-git-send-email-alex.aring@gmail.com> <1404824365-7638-2-git-send-email-alex.aring@gmail.com> <53BBF08A.1050802@pengutronix.de> <20140708132434.GA28466@omega> <53BBF27D.50005@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <53BBF27D.50005@pengutronix.de> Subject: Re: [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure 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: ptxdist@pengutronix.de On Tue, Jul 08, 2014 at 03:30:37PM +0200, Marc Kleine-Budde wrote: > On 07/08/2014 03:24 PM, Alexander Aring wrote: > > On Tue, Jul 08, 2014 at 03:22:18PM +0200, Marc Kleine-Budde wrote: > >> On 07/08/2014 02:59 PM, Alexander Aring wrote: > >>> This patch adds a error handling for the dtc and call a ptxd_bailout if > >>> an error occur. > >>> > >>> Signed-off-by: Alexander Aring > >>> --- > >>> scripts/lib/ptxd_make_dts_dtc.sh | 4 ++++ > >>> 1 file changed, 4 insertions(+) > >>> > >>> diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh > >>> index 24c5604..6a09cae 100644 > >>> --- a/scripts/lib/ptxd_make_dts_dtc.sh > >>> +++ b/scripts/lib/ptxd_make_dts_dtc.sh > >>> @@ -59,6 +59,10 @@ ptxd_make_dts_dtb() { > >>> -I dts -O dtb -b 0 \ > >>> -o "${dts_dtb}" "${tmp_dts}" > >>> > >>> + if [ "$?" != "0" ]; then > >>> + ptxd_bailout "Unable to generate ${dts_dtb} file." > >>> + fi > >> > >> What about: > >> > >> || ptxd_bailout "Unable to generate ${dts_dtb} file." > >> > > > > okay, yes then we could save the if. I can also add > > > > || ptxd_bailout ... for cpp call. > > Or better concatenate everything with a && and add || bailout at the end. > uiuiuiui, but we have some other steps in the middle and the most looks currently like magic for me. But I think we could do: sed -e "s;^${tmp_dts}:;${dts_dtb}:;" \ -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 echo "CPP $(ptxd_print_path "${tmp_dts}")" cpp \ -Wp,-MD,${tmp_deps} \ -Wp,-MT,${tmp_dts} \ -nostdinc \ -P \ -I$(dirname "${dts}") \ -I${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts \ -I${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts/include \ -I${dts_kernel_dir}/drivers/of/testcase-data \ -I${dts_kernel_dir}/include \ -undef -D__DTS__ -x assembler-with-cpp \ -o ${tmp_dts} \ ${dts} && \ echo "DTC $(ptxd_print_path "${dts_dtb}")" && \ dtc \ $(ptxd_get_ptxconf PTXCONF_DTC_EXTRA_ARGS) \ ${dtc_include} \ -d "${tmp_deps}" \ -I dts -O dtb -b 0 \ -o "${dts_dtb}" "${tmp_dts}" || \ ptxd_bailout "Unable to generate ${dts_dtb} file." normally we can forget to check error on echo, but it's in the middle of the generation. I also moved the sed and dtc_include setting before calling cpp step. I think this should work, maybe it looks a little bit ugly, don't know what is a nice indentation. :-/ - Alex -- ptxdist mailing list ptxdist@pengutronix.de