Description of problem: rpmbuild -bp rpm.spec cannot find rpm-4.4.2.tar.gz Version-Release number of selected component (if applicable): rpm-build-4.4.2-46.fc7.i386.rpm How reproducible: very Steps to Reproduce: 1. rpm -i rpm-4.4.2-46.fc7.src.rpm 2. cd ~/rpmbuild/rpm-4.4.2 3. rpmbuild -bp rpm.spec The home directory (~) expands differently depending on your user name, so I've put '~' everywhere the absolute path to my home directory occured. Actual results: error: File ~/rpmbuild/rpm-1.10.2/rpm-4.4.2.tar.gz: No such file or directory Expected results: rpmbuild should be looking for ~/rpmbuild/rpm-4.4.2/rpm-4.4.2.tar.gz Additional info: I've installed Mike A. Harris's rpmbuild-nonroot files - see http://www.rpm.org/hintskinks/buildtree/ It appears from looking at the rpm.spec file that it's using the version info from rpm.spec line 74: Requires: popt = 1.10.2 - to locate the package source directory.
I don't recommend Mike Harris's rpmbuild-nonroot , try rpmdevtools from fedora as using %{version} will get confused in packages like rpm that have packages with multiple versions (it's the %package popt ... Version: not the line you point out).
I just tried rpmdevtools. It seems to only allow you to install one source RPM package that gets unpacked into the ~/rpmbuild/SOURCES directory - except for the .spec file - that goes into the ~/rpmbuild/SPEC directory. I tried to add the line %_sourcedir %{_topdir}/SOURCES/%{name}-%{version} to ~/.rpmmacros so that each installed source RPM would reside in it's own directory, but the problem re-surfaced - it seems that having "%{version}" anywhere in the %_sourcedir reproduces this problem - as you stated. rpmbuild needs to copy the "version" variable to "rpm_version" or something similiar the first time the "release" tag (barring a better option) is seen in order to resolve this situation as it appears that the "version" variable is being stepped on and so is unusable for this purpose. This approach hinges around the issue that there seems to be no way to identify a particular package as the "root" or "payload" package that these variables should come from - the one the entire source RPM would hopefully have been named after. Also is there a good reason for keeping the spec files in their own directory?
The only sane fix for this is to not try to bundle several packages with different packages into one spec IMO. Popt living inside rpm is a historical artifact mostly, one that's about to be removed for good by making popt into a standalone package as it should: see bug #249352.
User pnasrat's account has been closed
Reassigning to owner after bugzilla made a mess, sorry about the noise...
This has now been "fixed" in rawhide by splitting out popt from the rpm package. Attempting to fix all the cases where separate packages with their own versions are produced from a single spec with any arbitrary %_sourcedir isn't worth it.