[libvirt] [PATCH] spec: Guess rhel/fedora macros from dist

Jiri Denemark jdenemar at redhat.com
Thu Mar 17 12:48:15 UTC 2011


On Thu, Mar 17, 2011 at 11:20:15 +0000, Daniel P. Berrange wrote:
> On Wed, Mar 16, 2011 at 12:54:38PM +0100, Jiri Denemark wrote:
> > +# if neither fedora nor rhel was defined, try to guess them from %{dist}
> > +%if !0%{?rhel} && !0%{?fedora}
> > +%define rhel %(echo "%{?dist}" | sed -ne 's/^\\.el\\([0-9]\\+\\).*/\\1/p')
> > +%define fedora %(echo "%{?dist}" | sed -ne 's/^\\.fc\\?\\([0-9]\\+\\).*/\\1/p')
> > +%endif
> > +
> >  # A client only build will create a libvirt.so only containing
> >  # the generic RPC driver, and test driver and no libvirtd
> >  # Default to a full server + client build
> 
> What is the particular reason we need this ?   %dist is set by
> redhat-rpm-macros, which also sets  %rhel/%fedora, so I would not
> expect to have one but not the other

The reason is %rhel is not set at least on RHEL-5 and we want to have a single
spec file which is able to build the package correctly there. Not that I was
able to decode where the hack redhat-rpm-config tries to set anything like
%dist or %rhel/%fedora but the macros are apparently set somewhere since,
e.g., on RHEL-6 one can build a package with make rpm. This doesn't work on
RHEL-5 without explicit --define "rhel 5".

Jirka




More information about the libvir-list mailing list