Patchwork uboot-config.bbclass; Raise an error for unknown configs

login
register
mail settings
Submitter Otavio Salvador
Date Oct. 10, 2013, 6:15 p.m.
Message ID <1381428927-7057-1-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/59615/
State New
Headers show

Comments

Otavio Salvador - Oct. 10, 2013, 6:15 p.m.
When passing the wrong value for UBOOT_CONFIG it ought to raise an
error otherwise it is quite difficult for user to notice it didn't
behave as expected.

Reported-by: Lauren Post <lauren.post@freescale.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/classes/uboot-config.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
Richard Purdie - Oct. 11, 2013, 8:18 a.m.
On Thu, 2013-10-10 at 15:15 -0300, Otavio Salvador wrote:
> When passing the wrong value for UBOOT_CONFIG it ought to raise an
> error otherwise it is quite difficult for user to notice it didn't
> behave as expected.
> 
> Reported-by: Lauren Post <lauren.post@freescale.com>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  meta/classes/uboot-config.bbclass | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass
> index ba01bff..ff226a1 100644
> --- a/meta/classes/uboot-config.bbclass
> +++ b/meta/classes/uboot-config.bbclass
> @@ -51,4 +51,9 @@ python () {
>              if len(items) > 1 and items[1]:
>                  bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1])
>                  d.appendVar('IMAGE_FSTYPES', ' ' + items[1])
> +
> +            # Go out as we found a match!
> +            break
> +    else:
> +        raise bb.parse.SkipPackage("UBOOT_CONFIG %s is not supported" % ubootconfig)
>  }

Shouldn't this be an exception such as ValueError rather than
SkipPackage?

Cheers,

Richard
Otavio Salvador - Oct. 11, 2013, 11:54 a.m.
On Fri, Oct 11, 2013 at 5:18 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Thu, 2013-10-10 at 15:15 -0300, Otavio Salvador wrote:
>> When passing the wrong value for UBOOT_CONFIG it ought to raise an
>> error otherwise it is quite difficult for user to notice it didn't
>> behave as expected.
>>
>> Reported-by: Lauren Post <lauren.post@freescale.com>
>> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>> ---
>>  meta/classes/uboot-config.bbclass | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass
>> index ba01bff..ff226a1 100644
>> --- a/meta/classes/uboot-config.bbclass
>> +++ b/meta/classes/uboot-config.bbclass
>> @@ -51,4 +51,9 @@ python () {
>>              if len(items) > 1 and items[1]:
>>                  bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1])
>>                  d.appendVar('IMAGE_FSTYPES', ' ' + items[1])
>> +
>> +            # Go out as we found a match!
>> +            break
>> +    else:
>> +        raise bb.parse.SkipPackage("UBOOT_CONFIG %s is not supported" % ubootconfig)
>>  }
>
> Shouldn't this be an exception such as ValueError rather than
> SkipPackage?

Good point; I will send a v2 fixing this.

Thanks for reviewing it.

Patch

diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass
index ba01bff..ff226a1 100644
--- a/meta/classes/uboot-config.bbclass
+++ b/meta/classes/uboot-config.bbclass
@@ -51,4 +51,9 @@  python () {
             if len(items) > 1 and items[1]:
                 bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1])
                 d.appendVar('IMAGE_FSTYPES', ' ' + items[1])
+
+            # Go out as we found a match!
+            break
+    else:
+        raise bb.parse.SkipPackage("UBOOT_CONFIG %s is not supported" % ubootconfig)
 }