[oe] Improving consistency

cyril Romain c.romain at laposte.net
Tue Sep 5 14:16:31 UTC 2006


Koen Kooi wrote:
>>> Is it possible to have a 'bitbake sanitize <provider>' command that will output a
>>> sanitized .bb? It doesn't have to be perfect, but some aid in this tedious task would be
>>> helpfull.
>>>       
>> That depends. I have been thinking about this for quite some time,
>> because
>> I really would like to have such a thing. We already have a bit of the
>> infrastructure
>> in place, but the one thing missing is that once the metadata is parsed,
>> we lose
>> a) order and b) source statements (pointers to a .bb or even better the
>> textual entity
>> that was the source for a certain statement).
>>     
>
> What about a simple script that sorts DESCRIPTION, LICENSE, do_install(), etc? That would
> make an excellent addition to the contrib/ dir in the repo.
>   

Ok.
In attachment is a first attempt for such a script. It is a 
quick-and-dirty written script that don't write any file yet. It only 
dumps the sanitized file into the console.
Since Python does not have ordered dictionary, I used this one (also in 
attachment): http://www.voidspace.org.uk/python/odict.html

To test it:
./sanitize.py yourBitbakeFile.bb

To create a sanitized file and a patch e.g. for gcc_4.1.1.bb:
./sanitize.py gcc_4.1.1.bb > gcc_4.1.1.bb.sanitized; diff -u 
gcc_4.1.1.bb  gcc_4.1.1.bb.sanitized > gcc_4.1.1.bb.patch

There is still many things to do, but if you find it useful I can 
improve and finalize it.
As you will see, the script dumps warnings on unknown variables, i.e. 
the variables that are used in .bb file that are not listed in the Style 
Guidelines.
Can anyone please update the Style Guidelines with the complete list of 
variables ?
Hum... maybe I'd rather using the script to grep for all the unknown 
variables and add them to the wiki, so that you (Mickey or anyone else) 
can sort them.

I suggest to add in the Style Guidelines a rule that recommend to put 
comments into do_ routines or into VARIABLE="... " sections, otherwise 
it is tricky or even not possible to correctly handle comments.

I don't know how bitbake internally handles data from a .bb file, but 
maybe it is better to handle the sanitization from bitbake, especially 
because bitbake knows how to read (and therefore to write) a .bb file. 
Any thought on that ?

Feel free to answer for any requests, bugs or suggestions.

Best regards,

  Cyril




More information about the Openembedded-devel mailing list