Skip to contentSkip to conversation

Whitespace not allowed in COMPATIBLE_MACHINE

DISCUSSION Ulf Samuelsson 3 participants 5 messages Nov 29, 2011

lore
Share & tools
lore
#0 lore raw

Have had a lot of problems trying to get a recipe running.
I finally discovered that "COMPATIBLE_MACHINE" is sensitive to whitespace.

Working:
COMPATIBLE_MACHINE = "machine1"
COMPATIBLE_MACHINE = "machine1|machine2"
COMPATIBLE_MACHINE = "(machine1)"
COMPATIBLE_MACHINE = "(machine1|machine2)"

COMPATIBLE_MACHINE = "machine1"
COMPATIBLE_MACHINE += "|machine2"

Not Working:
COMPATIBLE_MACHINE = " machine1"
COMPATIBLE_MACHINE = "machine1 "
COMPATIBLE_MACHINE = "machine1|machine2"
COMPATIBLE_MACHINE = "machine1 |machine2"
COMPATIBLE_MACHINE = "machine1| machine2"
COMPATIBLE_MACHINE = "machine1 | machine2"
COMPATIBLE_MACHINE = " (machine1)"
COMPATIBLE_MACHINE = "(machine1|machine2) "
etc.

This is a real PITA expecially since COMPATIBLE_MACHINE is yet to be documented in the manual

Signature · 3 lines
Best Regards
Ulf Samuelsson
eMagii
#1 lore raw
Quoted 4 lines · Ulf Samuelsson

Have had a lot of problems trying to get a recipe running.
I finally discovered that "COMPATIBLE_MACHINE" is sensitive to whitespace. This is a real PITA expecially since COMPATIBLE_MACHINE is yet to be documented in the manual

Indeed, it's a regular expression. This is mentioned in documentation.conf:

COMPATIBLE_MACHINE[doc] = "A regular expression which matches the MACHINES support by the package/file. Failure to match will cause the file to be skipped by the parser."

If you think the description can be improved then I'm sure patches would be welcome.

Quoted 8 lines

Working:
COMPATIBLE_MACHINE = "machine1"
COMPATIBLE_MACHINE = "machine1|machine2"
COMPATIBLE_MACHINE = "(machine1)"
COMPATIBLE_MACHINE = "(machine1|machine2)"

COMPATIBLE_MACHINE = "machine1"
COMPATIBLE_MACHINE += "|machine2"

I'm slightly surprised that this last example would work. It ought to be equivalent to...

Quoted 1 line

COMPATIBLE_MACHINE = "machine1 |machine2"

p.

#2 lore raw
Quoted 8 lines · Phil Blundell
Quoted 4 lines · Ulf Samuelsson

Have had a lot of problems trying to get a recipe running.
I finally discovered that "COMPATIBLE_MACHINE" is sensitive to whitespace. This is a real PITA expecially since COMPATIBLE_MACHINE is yet to be documented in the manual

Indeed, it's a regular expression. This is mentioned in documentation.conf:

Quoted 6 lines

COMPATIBLE_MACHINE[doc] = "A regular expression which matches the MACHINES support by the package/file. Failure to match will cause the file to be skipped by the parser."

If you think the description can be improved then I'm sure patches would be welcome.

Its pretty clear, but this assumes that you are aware of the file itself. Have just started looking into openembedded-core, so I didnt even know the file existed. Is this file mentioned anywhere?

I was looking at the openembedded "manual" in the home page where COMPATIBLE_MACHINE is mentioned, but not much else.

Is there a reason to use a regular expression?
Why not a list of compatible machines?

Obviously you can have
COMPATIBLE_MACHINE = "at91*"
but if you need to list machines, and you have plenty of them you have one very long line...

Quoted 11 lines
Quoted 8 lines

Working:
COMPATIBLE_MACHINE = "machine1"
COMPATIBLE_MACHINE = "machine1|machine2"
COMPATIBLE_MACHINE = "(machine1)"
COMPATIBLE_MACHINE = "(machine1|machine2)"

COMPATIBLE_MACHINE = "machine1"
COMPATIBLE_MACHINE += "|machine2"

I'm slightly surprised that this last example would work. It ought to be equivalent to...

It seems to work for me.

I have in my U-Boot recipe:
COMPATIBLE_MACHINE = "at91sam9260ek|at91sam9xeek|at91sam9g20ek|at91sam9g20ek_2mmc"

COMPATIBLE_MACHINE    += "|at91sam9261ek|at91sam9g10ek"
COMPATIBLE_MACHINE    += "|at91sam9263ek"
COMPATIBLE_MACHINE    += "|at91sam9g45ek|at91sam9g45ekes|at91sam9m10ekes|at91sam9m10g45ek"
COMPATIBLE_MACHINE    += "|at91sam9g15ek|at91sam9g25ek|at91sam9g35ek|at91sam9x25ek|at91sam9x35ek"
COMPATIBLE_MACHINE    += "|at91sam9rlek"

MACHINE = "at91sam9g35ek"
If I add a space in the COMPATIBLE_MACHINE definition somewhere, then the recipe is not used.

Hmm, I just realized why it will work.
If I try to build for "at91sam9263ek" then the regexp becomes "at91sam963ek " (with a space), so it will only work for machines which are not at the end of a line...

If I want to split into several lines, then I guess an ugly hack would be.
COMPATIBLE_MACHINE = "at91sam9260ek|at91sam9xeek|at91sam9g20ek|at91sam9g20ek_2mmc|

               XX1"

COMPATIBLE_MACHINE += "|at91sam9261ek|at91sam9g10ek|

XX2"
COMPATIBLE_MACHINE += "|at91sam9263ek|

             XX3"
COMPATIBLE_MACHINE    += "|at91sam9g45ek|at91sam9g45ekes|at91sam9m10ekes|at91sam9m10g45ek|       
            XX4"
COMPATIBLE_MACHINE    += "|at91sam9g15ek|at91sam9g25ek|at91sam9g35ek|at91sam9x25ek|at91sam9x35ek|    
    XX5"

COMPATIBLE_MACHINE += "|at91sam9rlek"

BR
Ulf Samuelsson

Quoted 9 lines
Quoted 1 line

COMPATIBLE_MACHINE = "machine1 |machine2"

p.

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

Signature · 3 lines
Best Regards
Ulf Samuelsson
eMagii
#3 lore raw
Quoted 27 lines · Ulf Samuelsson
Quoted 7 lines
Quoted 7 lines

Working:
COMPATIBLE_MACHINE = "machine1"
COMPATIBLE_MACHINE = "machine1|machine2"
COMPATIBLE_MACHINE = "(machine1)"
COMPATIBLE_MACHINE = "(machine1|machine2)"

Quoted 6 lines
Quoted 2 lines

COMPATIBLE_MACHINE = "machine1"
COMPATIBLE_MACHINE += "|machine2"

I'm slightly surprised that this last example would work.  It ought to be equivalent to...

It seems to work for me.

I have in my U-Boot recipe:
COMPATIBLE_MACHINE     = "at91sam9260ek|at91sam9xeek|at91sam9g20ek|at91sam9g20ek_2mmc" COMPATIBLE_MACHINE    += "|at91sam9261ek|at91sam9g10ek" COMPATIBLE_MACHINE    += "|at91sam9263ek"
COMPATIBLE_MACHINE    += "|at91sam9g45ek|at91sam9g45ekes|at91sam9m10ekes|at91sam9m10g45ek" COMPATIBLE_MACHINE    += "|at91sam9g15ek|at91sam9g25ek|at91sam9g35ek|at91sam9x25ek|at91sam9x35ek" COMPATIBLE_MACHINE    += "|at91sam9rlek"

Quoted 3 lines

MACHINE =  "at91sam9g35ek"
If I add a space in the COMPATIBLE_MACHINE definition somewhere, then the recipe is not used.

As Phil points out, += results in a space separator. If you want direct concatenation without a separator, use .=.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#4 lore raw
In reply to Ulf Samuelsson
Quoted 4 lines · Ulf Samuelsson

Its pretty clear, but this assumes that you are aware of the file itself. Have just started looking into openembedded-core, so I didnt even know the file existed.
Is this file mentioned anywhere?

Hm, good question. I think the primary use of documentation.conf is for bitdoc but, given that the copy of bitdoc in oe-core is sufficiently bitrotten that it doesn't currently run at all, I suspect not many people are using it. I'm not sure if there are any other links to that config file.

Quoted 2 lines

Is there a reason to use a regular expression?
Why not a list of compatible machines?

A regular expression can always represent a list (via the A|B|C notation) and it allows you to have more complex/concise expressions as well.

Quoted 5 lines

If I want to split into several lines, then I guess an ugly hack would be.
COMPATIBLE_MACHINE =
"at91sam9260ek|at91sam9xeek|at91sam9g20ek|at91sam9g20ek_2mmc|

                XX1"

COMPATIBLE_MACHINE += "|at91sam9261ek|at91sam9g10ek|

You can use ".=" to avoid that issue.

p.