Reassign values to %define variables in spec file - RPM
linux, rpm, specifications
Solution
No.
`%define` macros are always re-evaluated, top to bottom in the spec file, so you cannot have loops.
`%global` macros are one-time.
Example, from another question concerning 'requires' processing:
%global _use_internal_dependency_generator 0
%global __find_requires_orig %{__find_requires}
%define __find_requires %{_builddir}/%{?buildsubdir}/build/find-requires %{__find_requires_orig}
If I had used `%define` to declare `__find_requires_orig`, it would error out with a macro loop.
If this doesn't answer your question, please elaborate what information you are looking for, or your end goal.
ETA:
The `%pre` and `%post` sections will already have the macros hard-coded from when the RPM is built. If you need additional run-time decisions to be made, they will need to be done in those shell scripts.
Problem
When we define variables using the %define tag in a spec file to build an RPM using the rpmbuild command ... is it possible to update its value on %pre and use it later on ?