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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/16/2011 05:54 AM, Jiri Denemark wrote:
> ---
> If anyone knows how to make rpm to evaluate %(...) immediately and not
> at every appearance of rhel/fedora, that would be really cool.

It looks like %{lua: expression} is the trick to do an immediate
evaluation; my problem is that I don't know the appropriate lua
expression to replace your sed script.

http://www.rpm.org/wiki/PackagerDocs/RpmLua

> +++ 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

This looks reasonable as is, but like you said, it would be nicer to
compute it once.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]