]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: improve rpm generation for distro backports
authorEric Blake <eblake@redhat.com>
Wed, 16 Mar 2011 17:50:44 +0000 (11:50 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 16 Mar 2011 17:56:00 +0000 (11:56 -0600)
When building for an older distro, it's convenient to just
tell rpmbuild to define dist (for example, to .el6_0), rather
than also remembering to define rhel to 6.

* libvirt.spec.in: Guess %{rhel} based on %{dist}.
Based on an idea by Jiri Denemark.

libvirt.spec.in

index 45a8fe0e32ca457bfa8c286a85b8de264cf5d8e2..1946a153a1c2c4e6fae924774fa44c311aef1772 100644 (file)
@@ -1,5 +1,13 @@
 # -*- rpm-spec -*-
 
+# If neither fedora nor rhel was defined, try to guess them from %{dist}
+%if !0%{?rhel} && !0%{?fedora}
+%{expand:%(echo "%{?dist}" | \
+  sed -ne 's/^\.el\([0-9]\+\).*/%%define rhel \1/p')}
+%{expand:%(echo "%{?dist}" | \
+  sed -ne 's/^\.fc\?\([0-9]\+\).*/%%define fedora \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