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

Jiri Denemark jdenemar at redhat.com
Wed Mar 16 11:54:38 UTC 2011


---
If anyone knows how to make rpm to evaluate %(...) immediately and not
at every appearance of rhel/fedora, that would be really cool.

 libvirt.spec.in |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 02be928..bfc9206 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1,5 +1,11 @@
 # -*- rpm-spec -*-
 
+# 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
-- 
1.7.4.1




More information about the libvir-list mailing list