-
Notifications
You must be signed in to change notification settings - Fork 15
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
Implement processing of conditions #276
Conversation
Are there any performance concerns? (E.g. in Copr) |
Well, it will make things slower, but it shouldn't be noticeable. Parsing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wow, this really shows what it means to parse the specfile..;-D
I am only not sure if I am able to review this..;) So, just a few code-style nit picks.
Signed-off-by: Nikola Forró <[email protected]>
Signed-off-by: Nikola Forró <[email protected]>
Signed-off-by: Nikola Forró <[email protected]>
recheck |
Build succeeded. ✔️ pre-commit SUCCESS in 1m 23s |
Build succeeded (gate pipeline). ✔️ pre-commit SUCCESS in 1m 22s |
This is not a full support for conditions, i.e. it doesn't re-solve #231 where an entire section can be conditionalized (however, the new
process_conditions()
function is generic enough to be used as a base for the resolution of that issue), nevertheless I think it's quite an improvement.Note that macro definitions have to be parsed twice, because a macro definition can contain a condition (see https://src.fedoraproject.org/rpms/kernel/blob/rawhide/f/kernel.spec for examples), and vice versa, a condition can encapsulate a macro definition.
Macro definitions and tags gained a
valid
attribute that can be used to determine if that particular macro definition/tag is valid and can affect other entities in the spec file or if it would be ignored when parsing the spec file with RPM. This will be used to fixSpecfile.update_value()
andSpecfile.update_tag()
, but it could be beneficial for other use cases as well.Related to packit/packit#2033.
RELEASE NOTES BEGIN
Macro definitions and tags gained a new
valid
attribute. A macro definition/tag is considered valid if it doesn't appear in a false branch of any condition appearing in the spec file.RELEASE NOTES END