[virt-tools-list] rpm spec file problem
Gene Czarcinski
gene at czarc.net
Wed Apr 3 16:13:55 UTC 2013
On 04/02/2013 02:10 PM, Daniel P. Berrange wrote:
> On Tue, Apr 02, 2013 at 01:48:31PM -0400, Gene Czarcinski wrote:
>> As I stated in a previous message, I have a problem doing rpmbuild
>> -ts with the tarball created for virt-manager. This problem
>> predates the gtk3.2 branch since it also occurs with
>> RELEASE-0.9.4-1. I know what the problem is but not why it is
>> happening or how to (acceptably) fix it.
>>
>> I have my own rpm build tree (like most folks do). However, I like
>> my source and spec files grouped and not in one big pile. Therefore,
>> I have an .rpmmacros file with the following specified:
>> # %_sourcedir is where the source code tarballs, patches, etc. will be
>> # placed after you do an "rpm -ivh somepackage.1.0-1.src.rpm"
>> %_sourcedir %{_topdir}/%{name}-%{version}
>>
>> # %_specdir is where the specfile gets placed when installing a
>> src.rpm. I
>> # prefer the specfile to be in the same directory as the source
>> tarballs, etc.
>> %_specdir %{_sourcedir}
>>
>> and the problem is that I specify %{_topdir}/%{name}-%{version}
>> although it could have also been
>> %{_topdir}/SOURCE/%{name}-%{version}
>> with the same results:
>>> rpmbuild -ts virt-manager-0.9.4.tar.gz
>>> error: Unable to open
>>> /home/gc/devel/rpmbuild/SOURCE/virt-manager/virt-manager.spec: No
>>> such file or directory
>> with %_sourcedir %{_topdir}/SOURCE/%{name}
>>
>> or
>>> rpmbuild -ts virt-manager-0.9.4.tar.gz
>>> error: Unable to open
>>> /home/gc/devel/rpmbuild/SOURCE/virt-manager-0.9.4/virt-manager.spec:
>>> No such file or directory
>> with %_sourcedir %{_topdir}/%{name}-%{version}
>>
>> I have run this way for years and have never had a problem with any
>> other package so I must conclude that it is something about the
>> virt-manager.spec file that is causing the problem. It may be a
>> problem with rpmbuild it it is only with the virt-manager.spec file.
>>
>> Anybody have any ideas?
>>
>> One solution that is not acceptable is to remove %{name}-%{version}
> You know this is not actually doing what you think it is because you
> have created a chicken+egg problem. When you do "rpmbuild -ta" RPM,
> RPM has no knowledge of what %name and %version should be when extracting
> the .spec files from the tar.gz. As a result you'll see it has actually
> created a directory literally called "rpmbuild/%{name}-%{version}" and
> put virt-manager.spec there.
>
> $ rpmbuild -ta src/fedora/virt-manager/virt-manager-0.9.5.tar.gz
> error: Unable to open /home/berrange/rpmbuild/virt-manager-0.9.5/virt-manager.spec: No such file or directory
> $ ls ~/rpmbuild/
> BUILD BUILDROOT %{name}-%{version} RPMS SOURCES SPECS SRPMS
> $ ls ~/rpmbuild/%\{name\}-%\{version\}/
> virt-manager.spec
>
> Evidentally when it then tries to run the build, %name and %version
> be expanded causing rpmbuild to look in "rpmbuild/virt-manager-0.9.5"
> for the spec file, which is obviously not where we just saved the
> file.
>
> I don't know why this works for some archives and not others though.
> I'd expect all of them to be broken with the way you configured your
> macros.
>
I have no idea which some packages work. I have realized that it is not
%_sourcedir that is the problem. No, it is %_specdir and if a package
does "work', the spec file is put in "%_topdir/\%{name}-\%{version}"
So, the solution is to specify %_specdir %_topdir/SPECS or let it
default which is the same thing.
Googling around, I find that other folks are also using this
configuration based on something Mike Harris did years ago. The may be
worth an RFE to the rpm folks but, for myself, I am going to use
%_topdir/SPECS and move on to other things.
Gene
More information about the virt-tools-list
mailing list