home     open source
PHP and modifications
RPM Building
SuSE Linux RPMs
Linux Installation
Privacy Statement

RPM building: Separating SPEC and source files

The default setup of rpm to build rpms has the drawback that all spec and source files are located in a single directory. This setup has the danger that files from one package overwrite files from another package. Mike Harris created a configuration that separates spec and source files into separate directories per package. Although Mike speaks of an rpmbuild-nonroot setup this setup can also be used for the root user (although I advice against building rpms as root).

Sadly there is a bug in rpm that causes it to overwrite the value of all macros for which a tag is specified in another than the initial package on parsing of the spec file. This bug causes the rpmbuild to fail for packages that have sources with different versions (f.e. rpm itself, as the macro %{version} is substituted with the version of popt instead of rpm). The following patch fixes the issue by setting the macros only for the initial package.