Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the parser write the parsed Bitbake file? #47

Open
jetm opened this issue Nov 11, 2022 · 2 comments
Open

Can the parser write the parsed Bitbake file? #47

jetm opened this issue Nov 11, 2022 · 2 comments

Comments

@jetm
Copy link

jetm commented Nov 11, 2022

Is supported by the parser to change the parsed content and write it to the same conf file?

Something like https://docs.python.org/3/library/configparser.html does but for Bitbake files. I have read the documentation and source code without luck.

I have been using Shell scripting to change Bitbake configuration files, but it's a hacky and ugly way to do it.

@jetm jetm changed the title Is there a way to update a Bitbake configuration file that has been parsed? Can the parser write the parsed Bitbake file? Nov 11, 2022
@priv-kweihmann
Copy link
Owner

In theory that should be possible.
The property you are looking for is https://github.com/priv-kweihmann/oelint-parser/blob/main/docs/api-documentation.md#oelint_parser.cls_item.Item.RealRaw, it should be available for every parsed item.

An example how to do it can be seen here https://github.com/priv-kweihmann/oelint-adv/blob/b9f8c5c8f02cb91909b97f40753343bdb176afdb/oelint_adv/rule_base/rule_var_section_lowercase.py#L29.

The difficult part might be reassembling the items in the correct order - oelint-adv does that here https://github.com/priv-kweihmann/oelint-adv/blob/b9f8c5c8f02cb91909b97f40753343bdb176afdb/oelint_adv/__main__.py#L319.

TBF I never tested the parser on conf files (their syntax seems to be a subset of the overall bitbake syntax), but I think that should be doable

@priv-kweihmann
Copy link
Owner

In case you succeed with that, I would welcome a tiny piece of documentation, as I guess other users would have the same question. So feel free to open a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants