mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed
@ 2014-07-08 14:33 Alexander Aring
  2014-07-08 14:44 ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2014-07-08 14:33 UTC (permalink / raw)
  To: ptxdist; +Cc: Alexander Aring, mkl

This patch adds error handling for the ptxd_make_dts_dtb function.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 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
 
-    echo "DTC $(ptxd_print_path "${dts_dtb}")"
+    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}"
+	-o "${dts_dtb}" "${tmp_dts}" &&
 
     awk '{ \
 	    printf "%s", $1 ;  \
@@ -65,6 +65,8 @@ ptxd_make_dts_dtb() {
 		printf " $(wildcard %s)", $i; \
 	    }; \
 	    print "" \
-	}' "${tmp_deps}" >> "${deps}"
+	}' "${tmp_deps}" >> "${deps}" ||
+
+    ptxd_bailout "Unable to generate dtb file."
 }
 export -f ptxd_make_dts_dtb
-- 
2.0.1


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed
  2014-07-08 14:33 [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed Alexander Aring
@ 2014-07-08 14:44 ` Marc Kleine-Budde
  2014-07-09  7:20   ` Alexander Aring
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2014-07-08 14:44 UTC (permalink / raw)
  To: Alexander Aring, ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 2388 bytes --]

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 <alex.aring@gmail.com>
> ---
>  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.

>  
> -    echo "DTC $(ptxd_print_path "${dts_dtb}")"
> +    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}"
> +	-o "${dts_dtb}" "${tmp_dts}" &&
>  
>      awk '{ \
>  	    printf "%s", $1 ;  \
> @@ -65,6 +65,8 @@ ptxd_make_dts_dtb() {
>  		printf " $(wildcard %s)", $i; \
>  	    }; \
>  	    print "" \
> -	}' "${tmp_deps}" >> "${deps}"
> +	}' "${tmp_deps}" >> "${deps}" ||
> +
> +    ptxd_bailout "Unable to generate dtb file."
>  }
>  export -f ptxd_make_dts_dtb
> 

otherwise looks good.

Marc


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed
  2014-07-08 14:44 ` Marc Kleine-Budde
@ 2014-07-09  7:20   ` Alexander Aring
  2014-07-09  7:32     ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2014-07-09  7:20 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: ptxdist

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 <alex.aring@gmail.com>
> > ---
> >  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 &&
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

- Alex

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed
  2014-07-09  7:20   ` Alexander Aring
@ 2014-07-09  7:32     ` Marc Kleine-Budde
  2014-07-09  8:03       ` Alexander Aring
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2014-07-09  7:32 UTC (permalink / raw)
  To: Alexander Aring; +Cc: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 2347 bytes --]

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 <alex.aring@gmail.com>
>>> ---
>>>  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

Where have you added the &&?

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed
  2014-07-09  7:32     ` Marc Kleine-Budde
@ 2014-07-09  8:03       ` Alexander Aring
  2014-07-09  8:05         ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2014-07-09  8:03 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: ptxdist

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 <alex.aring@gmail.com>
> >>> ---
> >>>  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.

- Alex

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed
  2014-07-09  8:03       ` Alexander Aring
@ 2014-07-09  8:05         ` Marc Kleine-Budde
  2014-07-09  8:11           ` Alexander Aring
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2014-07-09  8:05 UTC (permalink / raw)
  To: Alexander Aring; +Cc: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 3380 bytes --]

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 <alex.aring@gmail.com>
>>>>> ---
>>>>>  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 &&

Marc


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed
  2014-07-09  8:05         ` Marc Kleine-Budde
@ 2014-07-09  8:11           ` Alexander Aring
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2014-07-09  8:11 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: ptxdist

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 <alex.aring@gmail.com>
> >>>>> ---
> >>>>>  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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-09  8:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-08 14:33 [ptxdist] [PATCH] ptxd_make_dts_dtc: handle error if dtc failed Alexander Aring
2014-07-08 14:44 ` Marc Kleine-Budde
2014-07-09  7:20   ` Alexander Aring
2014-07-09  7:32     ` Marc Kleine-Budde
2014-07-09  8:03       ` Alexander Aring
2014-07-09  8:05         ` Marc Kleine-Budde
2014-07-09  8:11           ` Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox