Skip to contentSkip to conversation

sanity.bbclass: Add syntax check on MACHINE variable

PATCH In review Baptiste DURAND 2 participants 3 messages Mar 3, 2015 – Mar 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sanity.bbclass: Add syntax check on MACHINE variable

MACHINE variable should not contain uppercase characters.

Having uppercase in Machine name can lead to this kind of error : (here Machine is set to nuc-E3815)
ERROR: initramfs-live-boot not found in the base feeds (nuc_E3815 corei7-64-intel-common corei7-64 core2-64 x86_64 noarch any all).

---
 meta/classes/sanity.bbclass | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
meta/classes/sanity.bbclass +10 -5
index 31b99d4..1fa2e58 100644
@@ -713,12 +713,17 @@ def check_sanity_everybuild(status, d):
 
     # Check that the MACHINE is valid, if it is set
     machinevalid = True
-    if d.getVar('MACHINE', True):
-        if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
-            status.addresult('Please set a valid MACHINE in your local.conf or environment\n')
-            machinevalid = False
+    machinevar = d.getVar('MACHINE', True)
+    if machinevar:
+        if machinevar == machinevar.lower():
+            if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
+               status.addresult('Please set a valid MACHINE in your local.conf or environment\n')
+               machinevalid = False
+            else:
+               status.addresult(check_sanity_validmachine(d))
         else:
-            status.addresult(check_sanity_validmachine(d))
+            status.addresult('Please set a valid MACHINE : uppercase characters are not allowed in machine name : ${MACHINE} should be ' + machinevar.lower() + ' \n    Please rename file conf/machine/${MACHINE}.conf as conf/machine/' + machinevar.lower() + '.conf\n')
+            machinevalid = False
     else:
         status.addresult('Please set a MACHINE in your local.conf or environment\n')
         machinevalid = False
Signature · 1 line
1.8.1.4
#1 lore raw

Why? Uppercase letters should be allowed and work fine for the most part. Below are a few excerpts from last year:

On Wed, Mar 5, 2014 at 11:45 AM, Paul Eggleton <
[email protected]> wrote:

Quoted 44 lines · On Wednesday 05 March 2014 11:00:31 Michael Gloff wrote:

On Mon, Mar 3, 2014 at 12:52 PM, Paul Eggleton
<[email protected]

Quoted 3 lines
Quoted 2 lines · wrote:
Quoted 1 line · On Sunday 02 March 2014 19:58:41 Michael Gloff wrote:

Is there a reason why the toolchain cannot be built with a machine

name

Quoted 1 line
Quoted 1 line
Quoted 1 line

that contains capital letters? Seems weird, everything else builds

fine,

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

but meta-toolchain fails complaining about caps.

Although machine names are traditionally all lower case in our build system, there's no deliberate restriction in place that enforces this.

Quoted 9 lines
Quoted 3 lines

Would you be able to provide more details, such as the version of the build system you are using, the exact capital letters you used in the machine name, and the error you received?

The error is below. Machine name: PMX-090T. This is on dora 1.5.1

ERROR: Function failed: opkg-build execution failed
ERROR: Logfile of failure stored in:

/opt/oe/build/tmp/work/i686-nativesdk-emacsdk-linux/meta-environment-PMX-090

Quoted 11 lines

T/1.0-r8/temp/log.do_package_write_ipk.15358
Log data follows:

| DEBUG: Executing python function sstate_task_prefunc
| DEBUG: Python function sstate_task_prefunc finished
| DEBUG: Executing python function do_package_write_ipk
| DEBUG: Executing python function read_subpackage_metadata
| DEBUG: Python function read_subpackage_metadata finished
| DEBUG: Executing python function do_package_ipk
| meta-environment-PMX-090T
| *** Error: Package name  contains illegal characters, (other than

[a-z0-9.+-])

Perhaps I spoke too soon. There might not be a direct restriction on machine
names; but opkg does restrict characters allowed in package names, and for meta-environment the machine name ends up as part of the package name. You could probably hack around it if you felt the need to, but the simplest thing
would be to just change the machine name to be all lower-case.

Quoted 3 lines

Cheers,
Paul

=============================================================================================
Paul Barker <[email protected]>
3/6/14

to Khem, me, Paul, Yocto

Quoted 6 lines · Khem Raj
Quoted 2 lines · Michael Gloff

| *** Error: Package name contains illegal characters, (other than [a-z0-9.+-])

hmm meta-environment-PMX-090T is a package name and thats limitation of opkg backend, if you are too tied to

opkg itself doesn't seem to have this limitation, I just created and installed a
test package named 'A' perfectly fine.

The Debian policy says:
Package names (both source and binary, see Package, Section 5.6.7) must consist only of lower case letters (a-z), digits (0-9), plus (+) and
minus
(-) signs, and periods (.). They must be at least two characters long
and
must start with an alphanumeric character.

So I think the restriction is there to keep generated packages compatible with dpkg-deb.

We could consider removing the restriction if that compatibility isn't necessary.

===========================================================================

I think we should fix the SDK generation that has a problem with caps instead of dis-allowing it completely.

Michael Gloff

Quoted 55 lines · Baptiste DURAND

MACHINE variable should not contain uppercase characters.

Having uppercase in Machine name can lead to this kind of error : (here Machine is set to nuc-E3815)
ERROR: initramfs-live-boot not found in the base feeds (nuc_E3815 corei7-64-intel-common corei7-64 core2-64 x86_64 noarch any all).

---
 meta/classes/sanity.bbclass | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
meta/classes/sanity.bbclass +9 -5
index 31b99d4..1fa2e58 100644
@@ -713,12 +713,17 @@ def check_sanity_everybuild(status, d):
 
     # Check that the MACHINE is valid, if it is set
     machinevalid = True
-    if d.getVar('MACHINE', True):
-        if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
-            status.addresult('Please set a valid MACHINE in your
 local.conf or environment\n')
-            machinevalid = False
+    machinevar = d.getVar('MACHINE', True)
+    if machinevar:
+        if machinevar == machinevar.lower():
+            if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
+               status.addresult('Please set a valid MACHINE in your
 local.conf or environment\n')
+               machinevalid = False
+            else:
+               status.addresult(check_sanity_validmachine(d))
         else:
-            status.addresult(check_sanity_validmachine(d))
+            status.addresult('Please set a valid MACHINE : uppercase

characters are not allowed in machine name : ${MACHINE} should be ' +
machinevar.lower() + ' \n Please rename file
conf/machine/${MACHINE}.conf as conf/machine/' + machinevar.lower() + '.conf\n')
+ machinevalid = False
else:
status.addresult('Please set a MACHINE in your local.conf or
environment\n')
machinevalid = False
--
1.8.1.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw

Hello,

I noticed an issue when I tried to develop a BSP meta for a NUC (model E3815TKHE).

In my first implementation, I named the conf file nuc_E3815.conf.

This leads to a bitbake error described in the commit message.
ERROR: initramfs-live-boot not found in the base feeds (nuc_E3815 corei7-64-intel-common corei7-64 core2-64 x86_64 noarch any all).

When I renamed the file without upercase (ie nuc_e3815.conf) , the error disappeared.

As I never saw any Machine name with uppercase, I thought that it was forbidden ( and the root cause of the issue I saw).

This seems to be linked to the path name generation of the rpm repositories.

Sorry for the noise.

Baptiste

2015-03-05 7:26 GMT+01:00 Michael Gloff <[email protected]>:

Quoted 157 lines

Why? Uppercase letters should be allowed and work fine for the most part. Below are a few excerpts from last year:

On Wed, Mar 5, 2014 at 11:45 AM, Paul Eggleton <
[email protected]> wrote:

Quoted 44 lines · On Wednesday 05 March 2014 11:00:31 Michael Gloff wrote:

On Mon, Mar 3, 2014 at 12:52 PM, Paul Eggleton
<[email protected]

Quoted 3 lines
Quoted 2 lines · wrote:
Quoted 1 line · On Sunday 02 March 2014 19:58:41 Michael Gloff wrote:

Is there a reason why the toolchain cannot be built with a machine

name

Quoted 1 line
Quoted 1 line
Quoted 1 line

that contains capital letters? Seems weird, everything else builds

fine,

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

but meta-toolchain fails complaining about caps.

Although machine names are traditionally all lower case in our build system, there's no deliberate restriction in place that enforces this.

Quoted 9 lines
Quoted 3 lines

Would you be able to provide more details, such as the version of the build system you are using, the exact capital letters you used in the machine name, and the error you received?

The error is below. Machine name: PMX-090T. This is on dora 1.5.1

ERROR: Function failed: opkg-build execution failed
ERROR: Logfile of failure stored in:

/opt/oe/build/tmp/work/i686-nativesdk-emacsdk-linux/meta-environment-PMX-090

Quoted 11 lines

T/1.0-r8/temp/log.do_package_write_ipk.15358
Log data follows:

| DEBUG: Executing python function sstate_task_prefunc
| DEBUG: Python function sstate_task_prefunc finished
| DEBUG: Executing python function do_package_write_ipk
| DEBUG: Executing python function read_subpackage_metadata
| DEBUG: Python function read_subpackage_metadata finished
| DEBUG: Executing python function do_package_ipk
| meta-environment-PMX-090T
| *** Error: Package name  contains illegal characters, (other than

[a-z0-9.+-])

Perhaps I spoke too soon. There might not be a direct restriction on machine
names; but opkg does restrict characters allowed in package names, and for meta-environment the machine name ends up as part of the package name. You could probably hack around it if you felt the need to, but the simplest thing
would be to just change the machine name to be all lower-case.

Quoted 3 lines

Cheers,
Paul

=============================================================================================
Paul Barker <[email protected]>
3/6/14

to Khem, me, Paul, Yocto

Quoted 1 line · Khem Raj

On Wed, Mar 5, 2014 at 9:00 AM, Michael Gloff <[email protected]>

Quoted 5 lines · wrote:
Quoted 2 lines

| *** Error: Package name contains illegal characters, (other than [a-z0-9.+-])

hmm meta-environment-PMX-090T is a package name and thats limitation of opkg backend, if you are too tied to

opkg itself doesn't seem to have this limitation, I just created and installed a
test package named 'A' perfectly fine.

The Debian policy says:
Package names (both source and binary, see Package, Section 5.6.7) must consist only of lower case letters (a-z), digits (0-9), plus (+) and
minus
(-) signs, and periods (.). They must be at least two characters long
and
must start with an alphanumeric character.

So I think the restriction is there to keep generated packages compatible with dpkg-deb.

We could consider removing the restriction if that compatibility isn't necessary.

===========================================================================

I think we should fix the SDK generation that has a problem with caps instead of dis-allowing it completely.

Michael Gloff

On Tue, Mar 3, 2015 at 5:01 AM, Baptiste DURAND <[email protected]

Quoted 57 lines

wrote:

MACHINE variable should not contain uppercase characters.

Having uppercase in Machine name can lead to this kind of error : (here Machine is set to nuc-E3815)
ERROR: initramfs-live-boot not found in the base feeds (nuc_E3815 corei7-64-intel-common corei7-64 core2-64 x86_64 noarch any all).

---
 meta/classes/sanity.bbclass | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
meta/classes/sanity.bbclass +9 -5
index 31b99d4..1fa2e58 100644
@@ -713,12 +713,17 @@ def check_sanity_everybuild(status, d):
 
     # Check that the MACHINE is valid, if it is set
     machinevalid = True
-    if d.getVar('MACHINE', True):
-        if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
-            status.addresult('Please set a valid MACHINE in your
 local.conf or environment\n')
-            machinevalid = False
+    machinevar = d.getVar('MACHINE', True)
+    if machinevar:
+        if machinevar == machinevar.lower():
+            if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
+               status.addresult('Please set a valid MACHINE in your
 local.conf or environment\n')
+               machinevalid = False
+            else:
+               status.addresult(check_sanity_validmachine(d))
         else:
-            status.addresult(check_sanity_validmachine(d))
+            status.addresult('Please set a valid MACHINE : uppercase

characters are not allowed in machine name : ${MACHINE} should be ' +
machinevar.lower() + ' \n Please rename file
conf/machine/${MACHINE}.conf as conf/machine/' + machinevar.lower() + '.conf\n')
+ machinevalid = False
else:
status.addresult('Please set a MACHINE in your local.conf or
environment\n')
machinevalid = False
--
1.8.1.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 1 line
Baptiste DURAND