Patchwork [2/3] uboot-config.bbclass: Handle UBOOT_MACHINE setting

login
register
mail settings
Submitter Otavio Salvador
Date Sept. 19, 2013, 1:28 p.m.
Message ID <1379597321-5447-3-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/58373/
State New
Headers show

Comments

Otavio Salvador - Sept. 19, 2013, 1:28 p.m.
The class now consolidate the handle of UBOOT_MACHINE and UBOOT_CONFIG
variables and handle possible mistakes done by user when using these
variables.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/classes/uboot-config.bbclass | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
Hans Beckérus - Sept. 19, 2013, 3:25 p.m.
On Thu, Sep 19, 2013 at 3:28 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> The class now consolidate the handle of UBOOT_MACHINE and UBOOT_CONFIG
> variables and handle possible mistakes done by user when using these
> variables.
>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  meta/classes/uboot-config.bbclass | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass
> index 44b46ff..b81cc60 100644
> --- a/meta/classes/uboot-config.bbclass
> +++ b/meta/classes/uboot-config.bbclass
> @@ -1,14 +1,30 @@
> -# Allow easy override of U-Boot config for a machine
> +# Handle U-Boot config for a machine
>  #
>  # The format to specify it, in the machine, is:
>  #
>  # UBOOT_CONFIG ??= <default>
>  # UBOOT_CONFIG[foo] = "config,images"
>  #
> +# or
> +#
> +# UBOOT_MACHINE = "config"
> +#
>  # Copyright 2013 (C) O.S. Systems Software LTDA.
>
>  python () {
> +    ubootmachine = d.getVar("UBOOT_MACHINE", True)
>      ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
> +
> +    if not ubootmachine and not ubootconfigflags:
> +        PN = d.getVar("PN", True)
> +        FILE = os.path.basename(d.getVar("FILE", True))
> +        bb.debug(1, "To build %s, see %s for instructions on \
> +                 setting up your machine config" % (PN, FILE))
> +        raise bb.parse.SkipPackage("Either UBOOT_MACHINE or UBOOT_CONFIG are must be set in the %s machine configuration." % d.getVar("MACHINE", True))
> +
Minor grammar error;  UBOOT_CONFIG are must >  UBOOT_CONFIG must

> +    if ubootmachine and ubootconfigflags:
> +        raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at same time.")
> +
Minor grammar error;  at same time -> at the same time

Thanks.
Hans

>      if not ubootconfigflags:
>          return
>
> --
> 1.8.4.rc3
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Otavio Salvador - Sept. 19, 2013, 3:32 p.m.
On Thu, Sep 19, 2013 at 12:25 PM, Hans Beckérus <hans.beckerus@gmail.com> wrote:
> On Thu, Sep 19, 2013 at 3:28 PM, Otavio Salvador
> <otavio@ossystems.com.br> wrote:
>> The class now consolidate the handle of UBOOT_MACHINE and UBOOT_CONFIG
>> variables and handle possible mistakes done by user when using these
>> variables.
>>
>> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>> ---
>>  meta/classes/uboot-config.bbclass | 18 +++++++++++++++++-
>>  1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass
>> index 44b46ff..b81cc60 100644
>> --- a/meta/classes/uboot-config.bbclass
>> +++ b/meta/classes/uboot-config.bbclass
>> @@ -1,14 +1,30 @@
>> -# Allow easy override of U-Boot config for a machine
>> +# Handle U-Boot config for a machine
>>  #
>>  # The format to specify it, in the machine, is:
>>  #
>>  # UBOOT_CONFIG ??= <default>
>>  # UBOOT_CONFIG[foo] = "config,images"
>>  #
>> +# or
>> +#
>> +# UBOOT_MACHINE = "config"
>> +#
>>  # Copyright 2013 (C) O.S. Systems Software LTDA.
>>
>>  python () {
>> +    ubootmachine = d.getVar("UBOOT_MACHINE", True)
>>      ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
>> +
>> +    if not ubootmachine and not ubootconfigflags:
>> +        PN = d.getVar("PN", True)
>> +        FILE = os.path.basename(d.getVar("FILE", True))
>> +        bb.debug(1, "To build %s, see %s for instructions on \
>> +                 setting up your machine config" % (PN, FILE))
>> +        raise bb.parse.SkipPackage("Either UBOOT_MACHINE or UBOOT_CONFIG are must be set in the %s machine configuration." % d.getVar("MACHINE", True))
>> +
> Minor grammar error;  UBOOT_CONFIG are must >  UBOOT_CONFIG must
>
>> +    if ubootmachine and ubootconfigflags:
>> +        raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at same time.")
>> +
> Minor grammar error;  at same time -> at the same time

Thanks; I fixed both in my local tree and will wait some more time for
feedback and I send a v2.

Patch

diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass
index 44b46ff..b81cc60 100644
--- a/meta/classes/uboot-config.bbclass
+++ b/meta/classes/uboot-config.bbclass
@@ -1,14 +1,30 @@ 
-# Allow easy override of U-Boot config for a machine
+# Handle U-Boot config for a machine
 #
 # The format to specify it, in the machine, is:
 #
 # UBOOT_CONFIG ??= <default>
 # UBOOT_CONFIG[foo] = "config,images"
 #
+# or
+#
+# UBOOT_MACHINE = "config"
+#
 # Copyright 2013 (C) O.S. Systems Software LTDA.
 
 python () {
+    ubootmachine = d.getVar("UBOOT_MACHINE", True)
     ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
+
+    if not ubootmachine and not ubootconfigflags:
+        PN = d.getVar("PN", True)
+        FILE = os.path.basename(d.getVar("FILE", True))
+        bb.debug(1, "To build %s, see %s for instructions on \
+                 setting up your machine config" % (PN, FILE))
+        raise bb.parse.SkipPackage("Either UBOOT_MACHINE or UBOOT_CONFIG are must be set in the %s machine configuration." % d.getVar("MACHINE", True))
+
+    if ubootmachine and ubootconfigflags:
+        raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at same time.")
+
     if not ubootconfigflags:
         return