-
Notifications
You must be signed in to change notification settings - Fork 6
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
Parsing a specfile multiple times leaves the lua tables dirty #185
Comments
It's not just Lua state, spec parsing also affects global macro state so parsing specs without resetting the entire rpm context in between can and will yield different results. So, rpm.reloadConfig() before another parse (whether the same spec or different) is the right thing to do, as blunt as that hammer may seem. I would love to have a have the entire spec parse context isolated to the spec object itself, but that's a long road. |
Come to think of it, this little fact that you need to call rpm.reloadConfig() probably isn't documented anywhere... |
Fixes fedora-infra#185 See rpm-software-management/rpm#3357 Signed-off-by: Miro Hrončok <miro@hroncok.cz>
Fixes fedora-infra#185 See rpm-software-management/rpm#3357 Signed-off-by: Miro Hrončok <miro@hroncok.cz>
Fixes fedora-infra#185 See rpm-software-management/rpm#3357 Signed-off-by: Miro Hrončok <miro@hroncok.cz>
Good catch, thanks for digging into the problem and implementing a solution! |
So, I recently discovered a weird sitation.
Consider https://src.fedoraproject.org/rpms/fedora-obsolete-packages with this:
Regular RPM passing errors like this -- this is expected and correct:
However, rpmautospec (e.g. via
fedpkg verrel
) errors like this:This is certainly unexpected: gimp-save-for-web is not obsoleted multiple times.
Adding this to the beginning of the spec:
Makes the problem go away.
What happens is that the specfile does not suspect it will be parsed twice with the same Lua state. But rpmautospec does that in
rpmautospec/rpmautospec/pkg_history.py
Line 158 in 31978b4
...which is kinda my doing :/
The easy solution is to move the macro definitions into the for:
rpmautospec/rpmautospec/pkg_history.py
Lines 133 to 140 in 31978b4
And call
rpm.reloadConfig()
after each attempt.However, that might be overkill. I will see if we can "restart" the Lua state somehow.
The text was updated successfully, but these errors were encountered: