Issue
So I already know how to define macros and include these in my main spec file. However, I also want to be able to include a set of constants; something like this:
hostnames.spec
%define HOST1 host1
%define HOST2 host2
...
main.spec
%include hostnames.spec
...
checkHost %{HOST1}
Is there a way to do this with RPM?
Solution
Perhaps you can:
- According to More "RPM argh" or how to use %includes properly ,
rpm
(no version mentioned) allows%include
, provided that you list (and package) the included files as sources in the RPM. The blog entry goes on to mention that this complicates the include path, by making it refer to../SOURCES
(under yourrpmbuild
directory) rather than within the build-directory. - Another (can an RPM spec file “include” other files?) asserts that "Sufficiently recent versions of rpmbuild certainly do support %include", and reiterates the problem about the include-directories.
- "Sufficiently recent" might be not a problem, since the feature is mentioned in a 2002 report about RPM 3.0.6 (Two issues related to %if and %include).
Answered By - Thomas Dickey Answer Checked By - Cary Denson (WPSolving Admin)