[Rpm-maint] [rpm-software-management/rpm] Automatically reload rpm configuration on mismatching BuildArch (PR #3071)
Panu Matilainen
notifications at github.com
Tue Apr 30 10:47:33 UTC 2024
When BuildArch is encountered during spec parse, rpm recurses the parse, but this doesn't reset/reload the global configuration and macros to match. So eg a "BuildArch: noarch" package gets built with a dramatically different macros depending on whether "--target noarch" was used or not, whereas people expect it to be the same - after all we give zero indication that anything might be wrong when --target wasn't specified.
Automatically detect and handle this condition in the rpmbuild tool: if the spec parse architecture disagrees with our loaded configuration, request a reparse with reloaded configuration for the matching target. This ensures 'rpmbuild -bb noarch.spec' and 'rpmbuild -bb --target noarch noarch.spec' run with the same exact configuration.
Doing this also fixes the situation where build-time macro expansion of build scriptlets (for template bits and dynamically generated spec parts) yields totally different (bogus) than in the initial spec parse. This also goes for RPM_ARCH environment and similar.
Avoid --undefine for dependency generation test, it doesn't work. --undefine with --target was always broken, now it's just more visible since it automatically applies to BuildArch too. Fixing that is a separate matter (#3070).
A more sophisticated fix could be having a stack of macro contexts that we copy, push and pop as necessary. That ought to solve the undefine too.
Fixes: #3049
You can view, comment on, or merge this pull request online at:
https://github.com/rpm-software-management/rpm/pull/3071
-- Commit Summary --
* Don't emit target build into on --quiet
* Automatically reload rpm configuration on mismatching BuildArch
-- File Changes --
M tests/rpmbuild.at (46)
M tools/rpmbuild.c (39)
-- Patch Links --
https://github.com/rpm-software-management/rpm/pull/3071.patch
https://github.com/rpm-software-management/rpm/pull/3071.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3071
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/3071 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240430/5d44b8f3/attachment.html>
More information about the Rpm-maint
mailing list