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

Fix Specfile.update_value() #280

Merged
merged 4 commits into from
Aug 31, 2023
Merged

Conversation

nforro
Copy link
Member

@nforro nforro commented Aug 30, 2023

Related to packit/packit#2033.

nforro added 2 commits August 30, 2023 12:19
Macro definitions and tags that are in a false branch of a condition
can not be considered modifiable, because modyfing their values would
have no effect on the value being updated.

Signed-off-by: Nikola Forró <[email protected]>
There can be multiple tags or macro definitions with the same name
in a spec file. In such case, a name is not unique-enough key
to search for the corresponding object, a position is needed as well.

Signed-off-by: Nikola Forró <[email protected]>
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/461adabb5294476bbe75997b45051f1d

✔️ pre-commit SUCCESS in 1m 22s
✔️ specfile-tests-rpm-deps SUCCESS in 59s
✔️ specfile-tests-pip-deps SUCCESS in 1m 01s

Copy link
Member

@lbarcziova lbarcziova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍 maybe a test case would be nice

@nforro
Copy link
Member Author

nforro commented Aug 30, 2023

Good point, let me extend test_update_tag.

Signed-off-by: Nikola Forró <[email protected]>
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/d3c6974ee4634ca7a684ce2e3c78b497

✔️ pre-commit SUCCESS in 1m 22s
✔️ specfile-tests-rpm-deps SUCCESS in 1m 03s
✔️ specfile-tests-pip-deps SUCCESS in 1m 00s

@nforro
Copy link
Member Author

nforro commented Aug 31, 2023

It turns out RPM version in EL8 doesn't support the %expr macro and expression expansion doesn't work either, so it's not possible to evaluate an expression in a condition without reimplementing the entire expression solver.

I'm going to mark the test_update_tag as expected to fail with RPM older than 4.16 and mention that in the documentation.

@nforro
Copy link
Member Author

nforro commented Aug 31, 2023

@lbarcziova Do you think I should also adjust the code to raise an exception when the evaluation doesn't work? The current implementation makes it silently pass, with every condition expression evaluated as True.

@nforro
Copy link
Member Author

nforro commented Aug 31, 2023

@lbarcziova Do you think I should also adjust the code to raise an exception when the evaluation doesn't work? The current implementation makes it silently pass, with every condition expression evaluated as True.

Actually, to stick with the current logic, it makes more sense to just resolve it as False.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/e584e78b57104ed688490242a95ea069

✔️ pre-commit SUCCESS in 1m 31s
✔️ specfile-tests-rpm-deps SUCCESS in 1m 04s
✔️ specfile-tests-pip-deps SUCCESS in 1m 03s

Copy link
Member

@lbarcziova lbarcziova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, to stick with the current logic, it makes more sense to just resolve it as False.

+1

@nforro nforro added the mergeit Zuul, merge it! label Aug 31, 2023
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).
https://softwarefactory-project.io/zuul/t/packit-service/buildset/87ce4fc90d1b47b9b7a3570bdb1632c8

✔️ pre-commit SUCCESS in 17m 43s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 6d8d0b1 into main Aug 31, 2023
@delete-merged-branch delete-merged-branch bot deleted the update_value branch August 31, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit Zuul, merge it!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants