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

Jiri Denemark jdenemar at redhat.com
Wed Mar 16 16:23:08 UTC 2011


On Wed, Mar 16, 2011 at 09:31:13 -0600, Eric Blake wrote:
> This works for one-shot evaluation:
> 
> # if neither fedora nor rhel was defined, try to guess them from %{dist}
> %if !0%{?rhel} && !0%{?fedora}
> %define rhel %{lua: v=string.match(rpm.expand("%{?dist}"),
>   "^%.el([0-9]+).*"); if v ~= nil then print(v) end}
> %define fedora %{lua: v=string.match(rpm.expand("%{?dist}"),
>  "^%.fc?([0-9]+).*"); if v ~= nil then print(v) end}
> %endif

Hmm, this is nice in avoiding forks but it unfortunately doesn't seem to work
on RHEL-5:

error: lua script failed: [string "<lua>"]:1: attempt to call field `match' (a nil value)
  1<   (empty)
  0< %if 0
error: line 18: %if 0

Jirka




More information about the libvir-list mailing list