[virt-tools-list] rpm spec file problem

Daniel P. Berrange berrange at redhat.com
Tue Apr 2 18:10:01 UTC 2013


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.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the virt-tools-list mailing list