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

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



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


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