Search code examples
linuxscriptingrpmrpm-spec

can an RPM spec file "include" other files?


Is there a kind of "include" directive in RPM spec? I couldn't find an answer by googling.

Motivation: I have a RPM spec template which the build process modifies with the version, revision and other build-specific data. This is done by sed currently. I think it would be cleaner if the spec would #include a build-specific definitions file, which would be generated by the build process, so I don't need to search and replace in the spec.

If there is no include, is there an idiomatic way to do this (quite common, I believe) task?


Solution

  • RPM does not support includes.

    I have solved similar problems with either m4 macro processor or by just concatenating parts of spec (when the "include" was at the beginning).

    If you only need to pass a few variables at build time, and not include several lines from another file, you can run

    rpmbuild --define 'myvar SOMEVALUE' -bb myspec.spec
    

    and you can use %myvar in the spec.