Hi,
I wrote,
I've come up with a patch that fixes the macros %{PACKAGE_VERSION} and %{PACKAGE_RELEASE} so one can use
%_sourcedir %{_topdir}/%{name}-%{PACKAGE_VERSION}
Fixing the preferred macros %{version} and %{release} via headerAddEntry() is much more intrusive, so I'm not sure if creating such a patch is worth the time spent (not even sure if inclusion would be considered as the above bug is a WONTFIX).
The patch to fix the other macros was not as intrusive as I thought. The attached patch now distinguishes between PART_PREAMBLE and PART_PACKAGE (newly introduced). It sets initialPackage to 0 only after the first %package tag is found and sets the macros conditionally.
This patch seems to work as intended. You can now use %_sourcedir %{_topdir}/%{name}-%{version}
The only question remaining is if there are other macros apart from %{version} and %{release} that should not be overwritten when a next package is parsed.
Leonard.