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

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

 



On Wed, Mar 16, 2011 at 11:37:33 -0600, Eric Blake wrote:
> 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.
> 
> Figured it out without lua: Use %{expand:} to only encounter %define
> after the shell substitution has completed (that is, instead of defining
> a macro to be a shell substitution, we use shell substitution to
> conditionally define a macro to be a constant value).
> 
> # 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
> 
> Works on RHEL 5, too, since it doesn't use lua.

Ah, nice. I played with %{expand:} a bit but didn't dedicate it enough time to
get this far.

ACK to this version

Jirka

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